From 497e54d8da7cb9862490eb89abbd32d96865abf4 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Tue, 14 Jul 2009 11:55:19 +0000 Subject: [PATCH] (ftfont_spec_pattern): New arg langname. Caller changed. (ftfont_list): Adjusted for the change of ftfont_spec_pattern. Reject a font who has adstyle property that is different from a langname derived from registry property. (ftfont_match): Adjusted for the change of ftfont_spec_pattern. --- src/ChangeLog | 9 +++++++++ src/ftfont.c | 28 +++++++++++++++++++--------- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index cedf1066e61..27a544e8789 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2009-07-14 Kenichi Handa + + * ftfont.c (ftfont_spec_pattern): New arg langname. Caller + changed. + (ftfont_list): Adjusted for the change of ftfont_spec_pattern. + Reject a font who has adstyle property that is different from a + langname derived from registry property. + (ftfont_match): Adjusted for the change of ftfont_spec_pattern. + 2009-07-13 Eli Zaretskii * dired.c (directory_files_internal) [WINDOWSNT]: Don't make a diff --git a/src/ftfont.c b/src/ftfont.c index 789e6a7f685..367b796a212 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -700,13 +700,15 @@ ftfont_get_open_type_spec (Lisp_Object otf_spec) } static FcPattern *ftfont_spec_pattern P_ ((Lisp_Object, char *, - struct OpenTypeSpec **)); + struct OpenTypeSpec **, + char **langname)); static FcPattern * -ftfont_spec_pattern (spec, otlayout, otspec) +ftfont_spec_pattern (spec, otlayout, otspec, langname) Lisp_Object spec; char *otlayout; struct OpenTypeSpec **otspec; + char **langname; { Lisp_Object tmp, extra; FcPattern *pattern = NULL; @@ -744,7 +746,8 @@ ftfont_spec_pattern (spec, otlayout, otspec) if (fc_charset_idx < 0) return NULL; charset = fc_charset_table[fc_charset_idx].fc_charset; - lang = (FcChar8 *) fc_charset_table[fc_charset_idx].lang; + *langname = fc_charset_table[fc_charset_idx].lang; + lang = (FcChar8 *) *langname; if (lang) { langset = FcLangSetCreate (); @@ -876,6 +879,7 @@ ftfont_list (frame, spec) char otlayout[15]; /* For "otlayout:XXXX" */ struct OpenTypeSpec *otspec = NULL; int spacing = -1; + char *langname = NULL; if (! fc_initialized) { @@ -883,7 +887,7 @@ ftfont_list (frame, spec) fc_initialized = 1; } - pattern = ftfont_spec_pattern (spec, otlayout, &otspec); + pattern = ftfont_spec_pattern (spec, otlayout, &otspec, &langname); if (! pattern) return Qnil; if (FcPatternGetCharSet (pattern, FC_CHARSET, 0, &charset) != FcResultMatch) @@ -1023,13 +1027,18 @@ ftfont_list (frame, spec) if (j == ASIZE (chars)) continue; } - if (! NILP (adstyle)) + if (! NILP (adstyle) || langname) { Lisp_Object this_adstyle = get_adstyle_property (fontset->fonts[i]); - if (NILP (this_adstyle) - || xstrcasecmp (SDATA (SYMBOL_NAME (adstyle)), - SDATA (SYMBOL_NAME (this_adstyle))) != 0) + if (! NILP (adstyle) + && (NILP (this_adstyle) + || xstrcasecmp (SDATA (SYMBOL_NAME (adstyle)), + SDATA (SYMBOL_NAME (this_adstyle))) != 0)) + continue; + if (langname + && ! NILP (this_adstyle) + && xstrcasecmp (langname, SDATA (SYMBOL_NAME (this_adstyle)))) continue; } entity = ftfont_pattern_entity (fontset->fonts[i], @@ -1062,6 +1071,7 @@ ftfont_match (frame, spec) FcResult result; char otlayout[15]; /* For "otlayout:XXXX" */ struct OpenTypeSpec *otspec = NULL; + char *langname = NULL; if (! fc_initialized) { @@ -1069,7 +1079,7 @@ ftfont_match (frame, spec) fc_initialized = 1; } - pattern = ftfont_spec_pattern (spec, otlayout, &otspec); + pattern = ftfont_spec_pattern (spec, otlayout, &otspec, &langname); if (! pattern) return Qnil; -- 2.39.2