diff options
| author | Kenichi Handa | 2006-11-24 01:47:43 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2006-11-24 01:47:43 +0000 |
| commit | 0b9660215fe2329c3530359322e8183841f02f83 (patch) | |
| tree | a1346710b86f3280248f57448c08a8908232a4a4 /src | |
| parent | b2e0f61878ce9cdb4b2e0273806b6af6c36a8be6 (diff) | |
| download | emacs-0b9660215fe2329c3530359322e8183841f02f83.tar.gz emacs-0b9660215fe2329c3530359322e8183841f02f83.zip | |
(ftfont_pattern_entity): Add fontformat in a pattern.
(ftfont_list): Include FC_FONTFORMAT in FcObject.
(ftfont_open): Set font->format.
(ftfont_font_format): New function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ftfont.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/src/ftfont.c b/src/ftfont.c index 6010314b7d1..927673bb7ab 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -73,6 +73,7 @@ static Lisp_Object ftfont_pattern_entity P_ ((FcPattern *, | |||
| 73 | Lisp_Object, Lisp_Object)); | 73 | Lisp_Object, Lisp_Object)); |
| 74 | static Lisp_Object ftfont_list_generic_family P_ ((Lisp_Object, Lisp_Object, | 74 | static Lisp_Object ftfont_list_generic_family P_ ((Lisp_Object, Lisp_Object, |
| 75 | Lisp_Object)); | 75 | Lisp_Object)); |
| 76 | Lisp_Object ftfont_font_format P_ ((FcPattern *)); | ||
| 76 | 77 | ||
| 77 | #define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM)) | 78 | #define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM)) |
| 78 | 79 | ||
| @@ -102,7 +103,7 @@ ftfont_pattern_entity (p, frame, registry) | |||
| 102 | Lisp_Object frame, registry; | 103 | Lisp_Object frame, registry; |
| 103 | { | 104 | { |
| 104 | Lisp_Object entity; | 105 | Lisp_Object entity; |
| 105 | FcChar8 *file; | 106 | FcChar8 *file, *fontformat; |
| 106 | FcCharSet *charset; | 107 | FcCharSet *charset; |
| 107 | char *str; | 108 | char *str; |
| 108 | int numeric; | 109 | int numeric; |
| @@ -112,6 +113,8 @@ ftfont_pattern_entity (p, frame, registry) | |||
| 112 | return Qnil; | 113 | return Qnil; |
| 113 | if (FcPatternGetCharSet (p, FC_CHARSET, 0, &charset) != FcResultMatch) | 114 | if (FcPatternGetCharSet (p, FC_CHARSET, 0, &charset) != FcResultMatch) |
| 114 | charset = NULL; | 115 | charset = NULL; |
| 116 | if (FcPatternGetString (p, FC_FONTFORMAT, 0, &fontformat) != FcResultMatch) | ||
| 117 | fontformat = NULL; | ||
| 115 | 118 | ||
| 116 | entity = Fmake_vector (make_number (FONT_ENTITY_MAX), null_string); | 119 | entity = Fmake_vector (make_number (FONT_ENTITY_MAX), null_string); |
| 117 | 120 | ||
| @@ -150,7 +153,10 @@ ftfont_pattern_entity (p, frame, registry) | |||
| 150 | return Qnil; | 153 | return Qnil; |
| 151 | 154 | ||
| 152 | if (FcPatternAddString (p, FC_FILE, file) == FcFalse | 155 | if (FcPatternAddString (p, FC_FILE, file) == FcFalse |
| 153 | || (charset && FcPatternAddCharSet (p, FC_CHARSET, charset) == FcFalse) | 156 | || (charset |
| 157 | && FcPatternAddCharSet (p, FC_CHARSET, charset) == FcFalse) | ||
| 158 | || (fontformat | ||
| 159 | && FcPatternAddString (p, FC_FONTFORMAT, fontformat) == FcFalse) | ||
| 154 | || (numeric >= 0 | 160 | || (numeric >= 0 |
| 155 | && FcPatternAddInteger (p, FC_SPACING, numeric) == FcFalse)) | 161 | && FcPatternAddInteger (p, FC_SPACING, numeric) == FcFalse)) |
| 156 | { | 162 | { |
| @@ -189,7 +195,7 @@ ftfont_list_generic_family (spec, frame, registry) | |||
| 189 | 195 | ||
| 190 | objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT, | 196 | objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT, |
| 191 | FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING, | 197 | FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING, |
| 192 | FC_CHARSET, FC_FILE, NULL); | 198 | FC_CHARSET, FC_FILE, FC_FONTFORMAT, NULL); |
| 193 | if (! objset) | 199 | if (! objset) |
| 194 | goto err; | 200 | goto err; |
| 195 | pattern = FcPatternBuild (NULL, FC_FAMILY, FcTypeString, | 201 | pattern = FcPatternBuild (NULL, FC_FAMILY, FcTypeString, |
| @@ -459,7 +465,7 @@ ftfont_list (frame, spec) | |||
| 459 | 465 | ||
| 460 | objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT, | 466 | objset = FcObjectSetBuild (FC_FOUNDRY, FC_FAMILY, FC_WEIGHT, FC_SLANT, |
| 461 | FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING, | 467 | FC_WIDTH, FC_PIXEL_SIZE, FC_SPACING, |
| 462 | FC_CHARSET, FC_FILE, NULL); | 468 | FC_CHARSET, FC_FILE, FC_FONTFORMAT, NULL); |
| 463 | if (! objset) | 469 | if (! objset) |
| 464 | goto err; | 470 | goto err; |
| 465 | if (otf_script[0]) | 471 | if (otf_script[0]) |
| @@ -708,6 +714,7 @@ ftfont_open (f, entity, pixel_size) | |||
| 708 | ftfont_info->ft_size = ft_size; | 714 | ftfont_info->ft_size = ft_size; |
| 709 | 715 | ||
| 710 | font = (struct font *) ftfont_info; | 716 | font = (struct font *) ftfont_info; |
| 717 | font->format = ftfont_font_format (pattern); | ||
| 711 | font->entity = entity; | 718 | font->entity = entity; |
| 712 | font->pixel_size = size; | 719 | font->pixel_size = size; |
| 713 | font->driver = &ftfont_driver; | 720 | font->driver = &ftfont_driver; |
| @@ -930,6 +937,24 @@ ftfont_anchor_point (font, code, index, x, y) | |||
| 930 | return 0; | 937 | return 0; |
| 931 | } | 938 | } |
| 932 | 939 | ||
| 940 | Lisp_Object | ||
| 941 | ftfont_font_format (FcPattern *pattern) | ||
| 942 | { | ||
| 943 | FcChar8 *fmt; | ||
| 944 | |||
| 945 | if (FcPatternGetString (pattern, FC_FONTFORMAT, 0, &fmt) != FcResultMatch) | ||
| 946 | return Qnil; | ||
| 947 | if (strcmp ((char *) fmt, "TrueType") == 0) | ||
| 948 | return intern ("truetype"); | ||
| 949 | if (strcmp ((char *) fmt, "Tyep 1") == 0) | ||
| 950 | return intern ("type1"); | ||
| 951 | if (strcmp ((char *) fmt, "PCF") == 0) | ||
| 952 | return intern ("pcf"); | ||
| 953 | if (strcmp ((char *) fmt, "BDF") == 0) | ||
| 954 | return intern ("bdf"); | ||
| 955 | return intern ("unknown"); | ||
| 956 | } | ||
| 957 | |||
| 933 | 958 | ||
| 934 | void | 959 | void |
| 935 | syms_of_ftfont () | 960 | syms_of_ftfont () |