aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2006-07-03 00:51:17 +0000
committerKenichi Handa2006-07-03 00:51:17 +0000
commita85f724a85e078f098dc41a9cda09036e4a5c6f0 (patch)
tree3763493c587bdc12d4a0a28b14e7c579188c61a7 /src
parent21ff5ed60724f906a27bc8800048957b55c5ab89 (diff)
downloademacs-a85f724a85e078f098dc41a9cda09036e4a5c6f0.tar.gz
emacs-a85f724a85e078f098dc41a9cda09036e4a5c6f0.zip
(ftfont_list): Handle QCotf property.
(ftfont_open): Set charset related members to -1.
Diffstat (limited to 'src')
-rw-r--r--src/ftfont.c36
1 files changed, 30 insertions, 6 deletions
diff --git a/src/ftfont.c b/src/ftfont.c
index 1de670fee4e..ecbe425140a 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -315,6 +315,7 @@ ftfont_list (frame, spec)
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
@@ -348,8 +349,11 @@ ftfont_list (frame, spec)
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 {
@@ -358,8 +362,15 @@ ftfont_list (frame, spec)
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 {
@@ -382,11 +393,12 @@ ftfont_list (frame, spec)
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))
397 script = XCDR (tmp);
398 if (! NILP (script) && ! charset)
386 { 399 {
387 Lisp_Object script = XCDR (tmp); 400 Lisp_Object chars
388 Lisp_Object chars = assq_no_quit (script, 401 = assq_no_quit (script, Vscript_representative_chars);
389 Vscript_representative_chars);
390 402
391 if (CONSP (chars)) 403 if (CONSP (chars))
392 { 404 {
@@ -461,6 +473,8 @@ ftfont_list (frame, spec)
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)
@@ -501,6 +515,15 @@ ftfont_list (frame, spec)
501 || this > FC_WEIGHT_MEDIUM))) 515 || this > FC_WEIGHT_MEDIUM)))
502 continue; 516 continue;
503 } 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))
525 continue;
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);
@@ -652,6 +675,7 @@ ftfont_open (f, entity, pixel_size)
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;