Mercurial > emacs
comparison src/ftfont.c @ 90510:69dc5ab6d693
(ftfont_list): Handle QCotf property.
(ftfont_open): Set charset related members to -1.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 03 Jul 2006 00:51:17 +0000 |
parents | 60e0667ab709 |
children | 891aa54b7498 |
comparison
equal
deleted
inserted
replaced
90509:c1ec6b950928 | 90510:69dc5ab6d693 |
---|---|
313 Lisp_Object registry = Qunicode_bmp; | 313 Lisp_Object registry = Qunicode_bmp; |
314 int weight = 0; | 314 int weight = 0; |
315 double dpi = -1; | 315 double dpi = -1; |
316 int spacing = -1; | 316 int spacing = -1; |
317 int scalable = -1; | 317 int scalable = -1; |
318 char otf_script[15]; /* For "otlayout\:XXXX" */ | |
318 | 319 |
319 val = null_vector; | 320 val = null_vector; |
320 | 321 |
321 if (! fc_initialized) | 322 if (! fc_initialized) |
322 { | 323 { |
346 return val; | 347 return val; |
347 } | 348 } |
348 | 349 |
349 extra = AREF (spec, FONT_EXTRA_INDEX); | 350 extra = AREF (spec, FONT_EXTRA_INDEX); |
350 font_name = Qnil; | 351 font_name = Qnil; |
352 otf_script[0] = '\0'; | |
351 if (CONSP (extra)) | 353 if (CONSP (extra)) |
352 { | 354 { |
355 Lisp_Object script = Qnil; | |
356 | |
353 tmp = assq_no_quit (QCname, extra); | 357 tmp = assq_no_quit (QCname, extra); |
354 if (CONSP (tmp)) | 358 if (CONSP (tmp)) |
355 { | 359 { |
356 font_name = XCDR (tmp); | 360 font_name = XCDR (tmp); |
357 if (SDATA (font_name)[0] != ':') | 361 if (SDATA (font_name)[0] != ':') |
358 return val; | 362 return val; |
359 } | 363 } |
360 tmp = assq_no_quit (QCotf, extra); | 364 tmp = assq_no_quit (QCotf, extra); |
361 if (! NILP (tmp)) | 365 if (CONSP (tmp) && SYMBOLP (XCDR (tmp))) |
362 return val; | 366 { |
367 tmp = XCDR (tmp); | |
368 script = assq_no_quit (tmp, Votf_script_alist); | |
369 if (CONSP (script) && SYMBOLP (XCDR (script))) | |
370 script = XCDR (script); | |
371 tmp = SYMBOL_NAME (tmp); | |
372 sprintf (otf_script, "otlayout:%s", (char *) SDATA (tmp)); | |
373 } | |
363 tmp = assq_no_quit (QClanguage, extra); | 374 tmp = assq_no_quit (QClanguage, extra); |
364 if (CONSP (tmp)) | 375 if (CONSP (tmp)) |
365 { | 376 { |
366 langset = FcLangSetCreate (); | 377 langset = FcLangSetCreate (); |
367 if (! langset) | 378 if (! langset) |
380 goto err; | 391 goto err; |
381 tmp = XCDR (tmp); | 392 tmp = XCDR (tmp); |
382 } | 393 } |
383 } | 394 } |
384 tmp = assq_no_quit (QCscript, extra); | 395 tmp = assq_no_quit (QCscript, extra); |
385 if (CONSP (tmp) && ! charset) | 396 if (CONSP (tmp)) |
386 { | 397 script = XCDR (tmp); |
387 Lisp_Object script = XCDR (tmp); | 398 if (! NILP (script) && ! charset) |
388 Lisp_Object chars = assq_no_quit (script, | 399 { |
389 Vscript_representative_chars); | 400 Lisp_Object chars |
401 = assq_no_quit (script, Vscript_representative_chars); | |
390 | 402 |
391 if (CONSP (chars)) | 403 if (CONSP (chars)) |
392 { | 404 { |
393 charset = FcCharSetCreate (); | 405 charset = FcCharSetCreate (); |
394 if (! charset) | 406 if (! charset) |
459 objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT, | 471 objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT, |
460 FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING, | 472 FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING, |
461 FC_CHARSET, FC_FILE, NULL); | 473 FC_CHARSET, FC_FILE, NULL); |
462 if (! objset) | 474 if (! objset) |
463 goto err; | 475 goto err; |
476 if (otf_script[0] && ! FcObjectSetAdd (objset, FC_CAPABILITY)) | |
477 goto err; | |
464 | 478 |
465 fontset = FcFontList (NULL, pattern, objset); | 479 fontset = FcFontList (NULL, pattern, objset); |
466 if (! fontset) | 480 if (! fontset) |
467 goto err; | 481 goto err; |
468 | 482 |
497 &this) != FcResultMatch | 511 &this) != FcResultMatch |
498 || (this != weight | 512 || (this != weight |
499 && (weight != 100 | 513 && (weight != 100 |
500 || this < FC_WEIGHT_REGULAR | 514 || this < FC_WEIGHT_REGULAR |
501 || this > FC_WEIGHT_MEDIUM))) | 515 || this > FC_WEIGHT_MEDIUM))) |
516 continue; | |
517 } | |
518 if (otf_script[0]) | |
519 { | |
520 FcChar8 *this; | |
521 | |
522 if (FcPatternGetString (fontset->fonts[i], FC_CAPABILITY, 0, | |
523 &this) != FcResultMatch | |
524 || ! strstr ((char *) this, otf_script)) | |
502 continue; | 525 continue; |
503 } | 526 } |
504 entity = ftfont_pattern_entity (fontset->fonts[i], frame, registry); | 527 entity = ftfont_pattern_entity (fontset->fonts[i], frame, registry); |
505 if (! NILP (entity)) | 528 if (! NILP (entity)) |
506 val = Fcons (entity, val); | 529 val = Fcons (entity, val); |
650 font->pixel_size = size; | 673 font->pixel_size = size; |
651 font->driver = &ftfont_driver; | 674 font->driver = &ftfont_driver; |
652 font->font.name = font->font.full_name = NULL; | 675 font->font.name = font->font.full_name = NULL; |
653 font->file_name = (char *) file; | 676 font->file_name = (char *) file; |
654 font->font.size = ft_face->size->metrics.max_advance >> 6; | 677 font->font.size = ft_face->size->metrics.max_advance >> 6; |
678 font->font.charset = font->encoding_charset = font->repertory_charset = -1; | |
655 font->ascent = ft_face->size->metrics.ascender >> 6; | 679 font->ascent = ft_face->size->metrics.ascender >> 6; |
656 font->descent = - ft_face->size->metrics.descender >> 6; | 680 font->descent = - ft_face->size->metrics.descender >> 6; |
657 font->font.height = ft_face->size->metrics.height >> 6; | 681 font->font.height = ft_face->size->metrics.height >> 6; |
658 if (FcPatternGetInteger (pattern, FC_SPACING, 0, &spacing) != FcResultMatch | 682 if (FcPatternGetInteger (pattern, FC_SPACING, 0, &spacing) != FcResultMatch |
659 || spacing != FC_PROPORTIONAL) | 683 || spacing != FC_PROPORTIONAL) |