diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/ftfont.c | 29 |
2 files changed, 27 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 27dbdd7cb11..c8811f7708b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,13 @@ | |||
| 1 | 2011-04-09 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-04-09 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | * ftfont.c: Distingish more carefully between FcChar8 and char. | ||
| 4 | The previous code passed unsigned char * to a functions like | ||
| 5 | strlen and xstrcasecmp that expect char *, which does not | ||
| 6 | conform to the C standard. | ||
| 7 | (get_adstyle_property, ftfont_pattern_entity): Use FcChar8 for | ||
| 8 | arguments to FcPatternGetString, and explicitly cast FcChar8 * to | ||
| 9 | char * when the C standard requires it. | ||
| 10 | |||
| 3 | * keyboard.c (read_char): Remove unused var. | 11 | * keyboard.c (read_char): Remove unused var. |
| 4 | 12 | ||
| 5 | * eval.c: Port to Windows vsnprintf (Bug#8435). | 13 | * eval.c: Port to Windows vsnprintf (Bug#8435). |
diff --git a/src/ftfont.c b/src/ftfont.c index 06ba6d7fe25..2e66222d268 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -160,11 +160,13 @@ static struct | |||
| 160 | static Lisp_Object | 160 | static Lisp_Object |
| 161 | get_adstyle_property (FcPattern *p) | 161 | get_adstyle_property (FcPattern *p) |
| 162 | { | 162 | { |
| 163 | unsigned char *str, *end; | 163 | FcChar8 *fcstr; |
| 164 | char *str, *end; | ||
| 164 | Lisp_Object adstyle; | 165 | Lisp_Object adstyle; |
| 165 | 166 | ||
| 166 | if (FcPatternGetString (p, FC_STYLE, 0, (FcChar8 **) &str) != FcResultMatch) | 167 | if (FcPatternGetString (p, FC_STYLE, 0, &fcstr) != FcResultMatch) |
| 167 | return Qnil; | 168 | return Qnil; |
| 169 | str = (char *) fcstr; | ||
| 168 | for (end = str; *end && *end != ' '; end++); | 170 | for (end = str; *end && *end != ' '; end++); |
| 169 | if (*end) | 171 | if (*end) |
| 170 | { | 172 | { |
| @@ -189,19 +191,20 @@ static Lisp_Object | |||
| 189 | ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) | 191 | ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) |
| 190 | { | 192 | { |
| 191 | Lisp_Object key, cache, entity; | 193 | Lisp_Object key, cache, entity; |
| 192 | unsigned char *file, *str; | 194 | FcChar8 *str; |
| 195 | char *file; | ||
| 193 | int idx; | 196 | int idx; |
| 194 | int numeric; | 197 | int numeric; |
| 195 | double dbl; | 198 | double dbl; |
| 196 | FcBool b; | 199 | FcBool b; |
| 197 | 200 | ||
| 198 | if (FcPatternGetString (p, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch) | 201 | if (FcPatternGetString (p, FC_FILE, 0, &str) != FcResultMatch) |
| 199 | return Qnil; | 202 | return Qnil; |
| 200 | if (FcPatternGetInteger (p, FC_INDEX, 0, &idx) != FcResultMatch) | 203 | if (FcPatternGetInteger (p, FC_INDEX, 0, &idx) != FcResultMatch) |
| 201 | return Qnil; | 204 | return Qnil; |
| 202 | 205 | ||
| 203 | key = Fcons (make_unibyte_string ((char *) file, strlen ((char *) file)), | 206 | file = (char *) str; |
| 204 | make_number (idx)); | 207 | key = Fcons (make_unibyte_string (file, strlen (file)), make_number (idx)); |
| 205 | cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY); | 208 | cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY); |
| 206 | entity = XCAR (cache); | 209 | entity = XCAR (cache); |
| 207 | if (! NILP (entity)) | 210 | if (! NILP (entity)) |
| @@ -219,10 +222,16 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) | |||
| 219 | ASET (entity, FONT_TYPE_INDEX, Qfreetype); | 222 | ASET (entity, FONT_TYPE_INDEX, Qfreetype); |
| 220 | ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1); | 223 | ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1); |
| 221 | 224 | ||
| 222 | if (FcPatternGetString (p, FC_FOUNDRY, 0, (FcChar8 **) &str) == FcResultMatch) | 225 | if (FcPatternGetString (p, FC_FOUNDRY, 0, &str) == FcResultMatch) |
| 223 | ASET (entity, FONT_FOUNDRY_INDEX, font_intern_prop (str, strlen (str), 1)); | 226 | { |
| 224 | if (FcPatternGetString (p, FC_FAMILY, 0, (FcChar8 **) &str) == FcResultMatch) | 227 | char *s = (char *) str; |
| 225 | ASET (entity, FONT_FAMILY_INDEX, font_intern_prop (str, strlen (str), 1)); | 228 | ASET (entity, FONT_FOUNDRY_INDEX, font_intern_prop (s, strlen (s), 1)); |
| 229 | } | ||
| 230 | if (FcPatternGetString (p, FC_FAMILY, 0, &str) == FcResultMatch) | ||
| 231 | { | ||
| 232 | char *s = (char *) str; | ||
| 233 | ASET (entity, FONT_FAMILY_INDEX, font_intern_prop (s, strlen (s), 1)); | ||
| 234 | } | ||
| 226 | if (FcPatternGetInteger (p, FC_WEIGHT, 0, &numeric) == FcResultMatch) | 235 | if (FcPatternGetInteger (p, FC_WEIGHT, 0, &numeric) == FcResultMatch) |
| 227 | { | 236 | { |
| 228 | if (numeric >= FC_WEIGHT_REGULAR && numeric < FC_WEIGHT_MEDIUM) | 237 | if (numeric >= FC_WEIGHT_REGULAR && numeric < FC_WEIGHT_MEDIUM) |