diff options
| author | Kenichi Handa | 2009-07-14 11:55:19 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2009-07-14 11:55:19 +0000 |
| commit | 497e54d8da7cb9862490eb89abbd32d96865abf4 (patch) | |
| tree | f074c0c3d0c3ad822b979bb077834968ff439ab9 /src/ftfont.c | |
| parent | bfc99364d98004ce7d128f4d126d5af03f9c1b81 (diff) | |
| download | emacs-497e54d8da7cb9862490eb89abbd32d96865abf4.tar.gz emacs-497e54d8da7cb9862490eb89abbd32d96865abf4.zip | |
(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.
Diffstat (limited to 'src/ftfont.c')
| -rw-r--r-- | src/ftfont.c | 28 |
1 files changed, 19 insertions, 9 deletions
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) | |||
| 700 | } | 700 | } |
| 701 | 701 | ||
| 702 | static FcPattern *ftfont_spec_pattern P_ ((Lisp_Object, char *, | 702 | static FcPattern *ftfont_spec_pattern P_ ((Lisp_Object, char *, |
| 703 | struct OpenTypeSpec **)); | 703 | struct OpenTypeSpec **, |
| 704 | char **langname)); | ||
| 704 | 705 | ||
| 705 | static FcPattern * | 706 | static FcPattern * |
| 706 | ftfont_spec_pattern (spec, otlayout, otspec) | 707 | ftfont_spec_pattern (spec, otlayout, otspec, langname) |
| 707 | Lisp_Object spec; | 708 | Lisp_Object spec; |
| 708 | char *otlayout; | 709 | char *otlayout; |
| 709 | struct OpenTypeSpec **otspec; | 710 | struct OpenTypeSpec **otspec; |
| 711 | char **langname; | ||
| 710 | { | 712 | { |
| 711 | Lisp_Object tmp, extra; | 713 | Lisp_Object tmp, extra; |
| 712 | FcPattern *pattern = NULL; | 714 | FcPattern *pattern = NULL; |
| @@ -744,7 +746,8 @@ ftfont_spec_pattern (spec, otlayout, otspec) | |||
| 744 | if (fc_charset_idx < 0) | 746 | if (fc_charset_idx < 0) |
| 745 | return NULL; | 747 | return NULL; |
| 746 | charset = fc_charset_table[fc_charset_idx].fc_charset; | 748 | charset = fc_charset_table[fc_charset_idx].fc_charset; |
| 747 | lang = (FcChar8 *) fc_charset_table[fc_charset_idx].lang; | 749 | *langname = fc_charset_table[fc_charset_idx].lang; |
| 750 | lang = (FcChar8 *) *langname; | ||
| 748 | if (lang) | 751 | if (lang) |
| 749 | { | 752 | { |
| 750 | langset = FcLangSetCreate (); | 753 | langset = FcLangSetCreate (); |
| @@ -876,6 +879,7 @@ ftfont_list (frame, spec) | |||
| 876 | char otlayout[15]; /* For "otlayout:XXXX" */ | 879 | char otlayout[15]; /* For "otlayout:XXXX" */ |
| 877 | struct OpenTypeSpec *otspec = NULL; | 880 | struct OpenTypeSpec *otspec = NULL; |
| 878 | int spacing = -1; | 881 | int spacing = -1; |
| 882 | char *langname = NULL; | ||
| 879 | 883 | ||
| 880 | if (! fc_initialized) | 884 | if (! fc_initialized) |
| 881 | { | 885 | { |
| @@ -883,7 +887,7 @@ ftfont_list (frame, spec) | |||
| 883 | fc_initialized = 1; | 887 | fc_initialized = 1; |
| 884 | } | 888 | } |
| 885 | 889 | ||
| 886 | pattern = ftfont_spec_pattern (spec, otlayout, &otspec); | 890 | pattern = ftfont_spec_pattern (spec, otlayout, &otspec, &langname); |
| 887 | if (! pattern) | 891 | if (! pattern) |
| 888 | return Qnil; | 892 | return Qnil; |
| 889 | if (FcPatternGetCharSet (pattern, FC_CHARSET, 0, &charset) != FcResultMatch) | 893 | if (FcPatternGetCharSet (pattern, FC_CHARSET, 0, &charset) != FcResultMatch) |
| @@ -1023,13 +1027,18 @@ ftfont_list (frame, spec) | |||
| 1023 | if (j == ASIZE (chars)) | 1027 | if (j == ASIZE (chars)) |
| 1024 | continue; | 1028 | continue; |
| 1025 | } | 1029 | } |
| 1026 | if (! NILP (adstyle)) | 1030 | if (! NILP (adstyle) || langname) |
| 1027 | { | 1031 | { |
| 1028 | Lisp_Object this_adstyle = get_adstyle_property (fontset->fonts[i]); | 1032 | Lisp_Object this_adstyle = get_adstyle_property (fontset->fonts[i]); |
| 1029 | 1033 | ||
| 1030 | if (NILP (this_adstyle) | 1034 | if (! NILP (adstyle) |
| 1031 | || xstrcasecmp (SDATA (SYMBOL_NAME (adstyle)), | 1035 | && (NILP (this_adstyle) |
| 1032 | SDATA (SYMBOL_NAME (this_adstyle))) != 0) | 1036 | || xstrcasecmp (SDATA (SYMBOL_NAME (adstyle)), |
| 1037 | SDATA (SYMBOL_NAME (this_adstyle))) != 0)) | ||
| 1038 | continue; | ||
| 1039 | if (langname | ||
| 1040 | && ! NILP (this_adstyle) | ||
| 1041 | && xstrcasecmp (langname, SDATA (SYMBOL_NAME (this_adstyle)))) | ||
| 1033 | continue; | 1042 | continue; |
| 1034 | } | 1043 | } |
| 1035 | entity = ftfont_pattern_entity (fontset->fonts[i], | 1044 | entity = ftfont_pattern_entity (fontset->fonts[i], |
| @@ -1062,6 +1071,7 @@ ftfont_match (frame, spec) | |||
| 1062 | FcResult result; | 1071 | FcResult result; |
| 1063 | char otlayout[15]; /* For "otlayout:XXXX" */ | 1072 | char otlayout[15]; /* For "otlayout:XXXX" */ |
| 1064 | struct OpenTypeSpec *otspec = NULL; | 1073 | struct OpenTypeSpec *otspec = NULL; |
| 1074 | char *langname = NULL; | ||
| 1065 | 1075 | ||
| 1066 | if (! fc_initialized) | 1076 | if (! fc_initialized) |
| 1067 | { | 1077 | { |
| @@ -1069,7 +1079,7 @@ ftfont_match (frame, spec) | |||
| 1069 | fc_initialized = 1; | 1079 | fc_initialized = 1; |
| 1070 | } | 1080 | } |
| 1071 | 1081 | ||
| 1072 | pattern = ftfont_spec_pattern (spec, otlayout, &otspec); | 1082 | pattern = ftfont_spec_pattern (spec, otlayout, &otspec, &langname); |
| 1073 | if (! pattern) | 1083 | if (! pattern) |
| 1074 | return Qnil; | 1084 | return Qnil; |
| 1075 | 1085 | ||