diff options
| author | Kenichi Handa | 2006-11-27 04:33:07 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2006-11-27 04:33:07 +0000 |
| commit | e907d979f1b9db5f8b1ecb08419f2c2bba762210 (patch) | |
| tree | 0a28e41ac82de838b8a4c59f99c956bbc51efd07 | |
| parent | 85c3e9081ff2c6865dddc714f2086972c1001b60 (diff) | |
| download | emacs-e907d979f1b9db5f8b1ecb08419f2c2bba762210.tar.gz emacs-e907d979f1b9db5f8b1ecb08419f2c2bba762210.zip | |
(ftfont_pattern_entity): Check if FC_FONTFORMAT is
defined.
(ftfont_list_generic_family, ftfont_list, ftfont_font_format):
Likewise.
| -rw-r--r-- | src/ftfont.c | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/src/ftfont.c b/src/ftfont.c index 927673bb7ab..32e503b33f7 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -113,7 +113,9 @@ ftfont_pattern_entity (p, frame, registry) | |||
| 113 | return Qnil; | 113 | return Qnil; |
| 114 | if (FcPatternGetCharSet (p, FC_CHARSET, 0, &charset) != FcResultMatch) | 114 | if (FcPatternGetCharSet (p, FC_CHARSET, 0, &charset) != FcResultMatch) |
| 115 | charset = NULL; | 115 | charset = NULL; |
| 116 | #ifdef FC_FONTFORMAT | ||
| 116 | if (FcPatternGetString (p, FC_FONTFORMAT, 0, &fontformat) != FcResultMatch) | 117 | if (FcPatternGetString (p, FC_FONTFORMAT, 0, &fontformat) != FcResultMatch) |
| 118 | #endif /* FC_FONTFORMAT */ | ||
| 117 | fontformat = NULL; | 119 | fontformat = NULL; |
| 118 | 120 | ||
| 119 | entity = Fmake_vector (make_number (FONT_ENTITY_MAX), null_string); | 121 | entity = Fmake_vector (make_number (FONT_ENTITY_MAX), null_string); |
| @@ -155,8 +157,10 @@ ftfont_pattern_entity (p, frame, registry) | |||
| 155 | if (FcPatternAddString (p, FC_FILE, file) == FcFalse | 157 | if (FcPatternAddString (p, FC_FILE, file) == FcFalse |
| 156 | || (charset | 158 | || (charset |
| 157 | && FcPatternAddCharSet (p, FC_CHARSET, charset) == FcFalse) | 159 | && FcPatternAddCharSet (p, FC_CHARSET, charset) == FcFalse) |
| 160 | #ifdef FC_FONTFORMAT | ||
| 158 | || (fontformat | 161 | || (fontformat |
| 159 | && FcPatternAddString (p, FC_FONTFORMAT, fontformat) == FcFalse) | 162 | && FcPatternAddString (p, FC_FONTFORMAT, fontformat) == FcFalse) |
| 163 | #endif /* FC_FONTFORMAT */ | ||
| 160 | || (numeric >= 0 | 164 | || (numeric >= 0 |
| 161 | && FcPatternAddInteger (p, FC_SPACING, numeric) == FcFalse)) | 165 | && FcPatternAddInteger (p, FC_SPACING, numeric) == FcFalse)) |
| 162 | { | 166 | { |
| @@ -195,7 +199,11 @@ ftfont_list_generic_family (spec, frame, registry) | |||
| 195 | 199 | ||
| 196 | objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT, | 200 | objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT, |
| 197 | FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING, | 201 | FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING, |
| 198 | FC_CHARSET, FC_FILE, FC_FONTFORMAT, NULL); | 202 | FC_CHARSET, FC_FILE, |
| 203 | #ifdef FC_FONTFORMAT | ||
| 204 | FC_FONTFORMAT, | ||
| 205 | #endif /* FC_FONTFORMAT */ | ||
| 206 | NULL); | ||
| 199 | if (! objset) | 207 | if (! objset) |
| 200 | goto err; | 208 | goto err; |
| 201 | pattern = FcPatternBuild (NULL, FC_FAMILY, FcTypeString, | 209 | pattern = FcPatternBuild (NULL, FC_FAMILY, FcTypeString, |
| @@ -465,7 +473,11 @@ ftfont_list (frame, spec) | |||
| 465 | 473 | ||
| 466 | objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT, | 474 | objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT, |
| 467 | FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING, | 475 | FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING, |
| 468 | FC_CHARSET, FC_FILE, FC_FONTFORMAT, NULL); | 476 | FC_CHARSET, FC_FILE, |
| 477 | #ifdef FC_FONTFORMAT | ||
| 478 | FC_FONTFORMAT, | ||
| 479 | #endif /* FC_FONTFORMAT */ | ||
| 480 | NULL); | ||
| 469 | if (! objset) | 481 | if (! objset) |
| 470 | goto err; | 482 | goto err; |
| 471 | if (otf_script[0]) | 483 | if (otf_script[0]) |
| @@ -940,18 +952,31 @@ ftfont_anchor_point (font, code, index, x, y) | |||
| 940 | Lisp_Object | 952 | Lisp_Object |
| 941 | ftfont_font_format (FcPattern *pattern) | 953 | ftfont_font_format (FcPattern *pattern) |
| 942 | { | 954 | { |
| 943 | FcChar8 *fmt; | 955 | FcChar8 *str; |
| 944 | 956 | ||
| 945 | if (FcPatternGetString (pattern, FC_FONTFORMAT, 0, &fmt) != FcResultMatch) | 957 | #ifdef FC_FONTFORMAT |
| 958 | if (FcPatternGetString (pattern, FC_FONTFORMAT, 0, &str) != FcResultMatch) | ||
| 946 | return Qnil; | 959 | return Qnil; |
| 947 | if (strcmp ((char *) fmt, "TrueType") == 0) | 960 | if (strcmp ((char *) str, "TrueType") == 0) |
| 948 | return intern ("truetype"); | 961 | return intern ("truetype"); |
| 949 | if (strcmp ((char *) fmt, "Tyep 1") == 0) | 962 | if (strcmp ((char *) str, "Tyep 1") == 0) |
| 950 | return intern ("type1"); | 963 | return intern ("type1"); |
| 951 | if (strcmp ((char *) fmt, "PCF") == 0) | 964 | if (strcmp ((char *) str, "PCF") == 0) |
| 952 | return intern ("pcf"); | 965 | return intern ("pcf"); |
| 953 | if (strcmp ((char *) fmt, "BDF") == 0) | 966 | if (strcmp ((char *) str, "BDF") == 0) |
| 954 | return intern ("bdf"); | 967 | return intern ("bdf"); |
| 968 | #else /* not FC_FONTFORMAT */ | ||
| 969 | if (FcPatternGetString (pattern, FC_FILE, 0, &file) != FcResultMatch) | ||
| 970 | return Qnil; | ||
| 971 | if (strcasestr ((char *) str, ".ttf") == 0) | ||
| 972 | return intern ("truetype"); | ||
| 973 | if (strcasestr ((char *) str, "pfb") == 0) | ||
| 974 | return intern ("type1"); | ||
| 975 | if (strcasestr ((char *) str, "pcf") == 0) | ||
| 976 | return intern ("pcf"); | ||
| 977 | if (strcasestr ((char *) str, "bdf") == 0) | ||
| 978 | return intern ("bdf"); | ||
| 979 | #endif /* not FC_FONTFORMAT */ | ||
| 955 | return intern ("unknown"); | 980 | return intern ("unknown"); |
| 956 | } | 981 | } |
| 957 | 982 | ||