diff options
| author | Paul Eggert | 2011-03-18 22:03:30 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-03-18 22:03:30 -0700 |
| commit | 49eaafbac1695d9244329b3518309bfcc1a98aa4 (patch) | |
| tree | 8ab41c7ee1ffcd94df3824b79825d0b5160e3b6d /src | |
| parent | e932860f4b4ecee35ae0f69f8c3082f5d32ef193 (diff) | |
| download | emacs-49eaafbac1695d9244329b3518309bfcc1a98aa4.tar.gz emacs-49eaafbac1695d9244329b3518309bfcc1a98aa4.zip | |
* ftfont.c: (get_adstyle_property, ftfont_pattern_entity):
(ftfont_lookup_cache, ftfont_open, ftfont_anchor_point):
Rename locals to avoid shadowing.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/ftfont.c | 39 |
2 files changed, 23 insertions, 19 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5ec2d88ea90..ec9f513b045 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -4,6 +4,9 @@ | |||
| 4 | (ftfont_otf_capability, ftfont_shape): Omit decls if not needed. | 4 | (ftfont_otf_capability, ftfont_shape): Omit decls if not needed. |
| 5 | (OTF_TAG_SYM): Omit macro if not needed. | 5 | (OTF_TAG_SYM): Omit macro if not needed. |
| 6 | (ftfont_list): Remove unused local. | 6 | (ftfont_list): Remove unused local. |
| 7 | (get_adstyle_property, ftfont_pattern_entity): | ||
| 8 | (ftfont_lookup_cache, ftfont_open, ftfont_anchor_point): | ||
| 9 | Rename locals to avoid shadowing. | ||
| 7 | 10 | ||
| 8 | * xfont.c (xfont_list_family): Mark var as initialized. | 11 | * xfont.c (xfont_list_family): Mark var as initialized. |
| 9 | 12 | ||
diff --git a/src/ftfont.c b/src/ftfont.c index 28042bb9c66..ad01149106e 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -168,11 +168,11 @@ get_adstyle_property (FcPattern *p) | |||
| 168 | for (end = str; *end && *end != ' '; end++); | 168 | for (end = str; *end && *end != ' '; end++); |
| 169 | if (*end) | 169 | if (*end) |
| 170 | { | 170 | { |
| 171 | char *p = alloca (end - str + 1); | 171 | char *newstr = alloca (end - str + 1); |
| 172 | memcpy (p, str, end - str); | 172 | memcpy (newstr, str, end - str); |
| 173 | p[end - str] = '\0'; | 173 | newstr[end - str] = '\0'; |
| 174 | end = p + (end - str); | 174 | end = newstr + (end - str); |
| 175 | str = p; | 175 | str = newstr; |
| 176 | } | 176 | } |
| 177 | if (xstrcasecmp (str, "Regular") == 0 | 177 | if (xstrcasecmp (str, "Regular") == 0 |
| 178 | || xstrcasecmp (str, "Bold") == 0 | 178 | || xstrcasecmp (str, "Bold") == 0 |
| @@ -190,18 +190,18 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) | |||
| 190 | { | 190 | { |
| 191 | Lisp_Object key, cache, entity; | 191 | Lisp_Object key, cache, entity; |
| 192 | char *file, *str; | 192 | char *file, *str; |
| 193 | int index; | 193 | int idx; |
| 194 | int numeric; | 194 | int numeric; |
| 195 | double dbl; | 195 | double dbl; |
| 196 | FcBool b; | 196 | FcBool b; |
| 197 | 197 | ||
| 198 | if (FcPatternGetString (p, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch) | 198 | if (FcPatternGetString (p, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch) |
| 199 | return Qnil; | 199 | return Qnil; |
| 200 | if (FcPatternGetInteger (p, FC_INDEX, 0, &index) != FcResultMatch) | 200 | if (FcPatternGetInteger (p, FC_INDEX, 0, &idx) != FcResultMatch) |
| 201 | return Qnil; | 201 | return Qnil; |
| 202 | 202 | ||
| 203 | key = Fcons (make_unibyte_string ((char *) file, strlen ((char *) file)), | 203 | key = Fcons (make_unibyte_string ((char *) file, strlen ((char *) file)), |
| 204 | make_number (index)); | 204 | make_number (idx)); |
| 205 | cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY); | 205 | cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY); |
| 206 | entity = XCAR (cache); | 206 | entity = XCAR (cache); |
| 207 | if (! NILP (entity)) | 207 | if (! NILP (entity)) |
| @@ -265,7 +265,7 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) | |||
| 265 | 265 | ||
| 266 | ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p)); | 266 | ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p)); |
| 267 | if ((ft_library || FT_Init_FreeType (&ft_library) == 0) | 267 | if ((ft_library || FT_Init_FreeType (&ft_library) == 0) |
| 268 | && FT_New_Face (ft_library, file, index, &ft_face) == 0) | 268 | && FT_New_Face (ft_library, file, idx, &ft_face) == 0) |
| 269 | { | 269 | { |
| 270 | BDF_PropertyRec rec; | 270 | BDF_PropertyRec rec; |
| 271 | 271 | ||
| @@ -394,14 +394,14 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for) | |||
| 394 | ? ! cache_data->ft_face : ! cache_data->fc_charset) | 394 | ? ! cache_data->ft_face : ! cache_data->fc_charset) |
| 395 | { | 395 | { |
| 396 | char *filename = SSDATA (XCAR (key)); | 396 | char *filename = SSDATA (XCAR (key)); |
| 397 | int index = XINT (XCDR (key)); | 397 | int idx = XINT (XCDR (key)); |
| 398 | 398 | ||
| 399 | if (cache_for == FTFONT_CACHE_FOR_FACE) | 399 | if (cache_for == FTFONT_CACHE_FOR_FACE) |
| 400 | { | 400 | { |
| 401 | if (! ft_library | 401 | if (! ft_library |
| 402 | && FT_Init_FreeType (&ft_library) != 0) | 402 | && FT_Init_FreeType (&ft_library) != 0) |
| 403 | return Qnil; | 403 | return Qnil; |
| 404 | if (FT_New_Face (ft_library, filename, index, &cache_data->ft_face) | 404 | if (FT_New_Face (ft_library, filename, idx, &cache_data->ft_face) |
| 405 | != 0) | 405 | != 0) |
| 406 | return Qnil; | 406 | return Qnil; |
| 407 | } | 407 | } |
| @@ -413,7 +413,7 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for) | |||
| 413 | FcCharSet *charset = NULL; | 413 | FcCharSet *charset = NULL; |
| 414 | 414 | ||
| 415 | pat = FcPatternBuild (0, FC_FILE, FcTypeString, (FcChar8 *) filename, | 415 | pat = FcPatternBuild (0, FC_FILE, FcTypeString, (FcChar8 *) filename, |
| 416 | FC_INDEX, FcTypeInteger, index, NULL); | 416 | FC_INDEX, FcTypeInteger, idx, NULL); |
| 417 | if (! pat) | 417 | if (! pat) |
| 418 | goto finish; | 418 | goto finish; |
| 419 | objset = FcObjectSetBuild (FC_CHARSET, FC_STYLE, NULL); | 419 | objset = FcObjectSetBuild (FC_CHARSET, FC_STYLE, NULL); |
| @@ -1159,7 +1159,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 1159 | FT_Face ft_face; | 1159 | FT_Face ft_face; |
| 1160 | FT_Size ft_size; | 1160 | FT_Size ft_size; |
| 1161 | FT_UInt size; | 1161 | FT_UInt size; |
| 1162 | Lisp_Object val, filename, index, cache, font_object; | 1162 | Lisp_Object val, filename, idx, cache, font_object; |
| 1163 | int scalable; | 1163 | int scalable; |
| 1164 | int spacing; | 1164 | int spacing; |
| 1165 | char name[256]; | 1165 | char name[256]; |
| @@ -1174,7 +1174,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 1174 | if (NILP (cache)) | 1174 | if (NILP (cache)) |
| 1175 | return Qnil; | 1175 | return Qnil; |
| 1176 | filename = XCAR (val); | 1176 | filename = XCAR (val); |
| 1177 | index = XCDR (val); | 1177 | idx = XCDR (val); |
| 1178 | val = XCDR (cache); | 1178 | val = XCDR (cache); |
| 1179 | cache_data = XSAVE_VALUE (XCDR (cache))->pointer; | 1179 | cache_data = XSAVE_VALUE (XCDR (cache))->pointer; |
| 1180 | ft_face = cache_data->ft_face; | 1180 | ft_face = cache_data->ft_face; |
| @@ -1216,7 +1216,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 1216 | font = XFONT_OBJECT (font_object); | 1216 | font = XFONT_OBJECT (font_object); |
| 1217 | ftfont_info = (struct ftfont_info *) font; | 1217 | ftfont_info = (struct ftfont_info *) font; |
| 1218 | ftfont_info->ft_size = ft_face->size; | 1218 | ftfont_info->ft_size = ft_face->size; |
| 1219 | ftfont_info->index = XINT (index); | 1219 | ftfont_info->index = XINT (idx); |
| 1220 | #ifdef HAVE_LIBOTF | 1220 | #ifdef HAVE_LIBOTF |
| 1221 | ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; | 1221 | ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; |
| 1222 | ftfont_info->otf = NULL; | 1222 | ftfont_info->otf = NULL; |
| @@ -1461,7 +1461,8 @@ ftfont_get_bitmap (struct font *font, unsigned int code, struct font_bitmap *bit | |||
| 1461 | } | 1461 | } |
| 1462 | 1462 | ||
| 1463 | static int | 1463 | static int |
| 1464 | ftfont_anchor_point (struct font *font, unsigned int code, int index, int *x, int *y) | 1464 | ftfont_anchor_point (struct font *font, unsigned int code, int idx, |
| 1465 | int *x, int *y) | ||
| 1465 | { | 1466 | { |
| 1466 | struct ftfont_info *ftfont_info = (struct ftfont_info *) font; | 1467 | struct ftfont_info *ftfont_info = (struct ftfont_info *) font; |
| 1467 | FT_Face ft_face = ftfont_info->ft_size->face; | 1468 | FT_Face ft_face = ftfont_info->ft_size->face; |
| @@ -1472,10 +1473,10 @@ ftfont_anchor_point (struct font *font, unsigned int code, int index, int *x, in | |||
| 1472 | return -1; | 1473 | return -1; |
| 1473 | if (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) | 1474 | if (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE) |
| 1474 | return -1; | 1475 | return -1; |
| 1475 | if (index >= ft_face->glyph->outline.n_points) | 1476 | if (idx >= ft_face->glyph->outline.n_points) |
| 1476 | return -1; | 1477 | return -1; |
| 1477 | *x = ft_face->glyph->outline.points[index].x; | 1478 | *x = ft_face->glyph->outline.points[idx].x; |
| 1478 | *y = ft_face->glyph->outline.points[index].y; | 1479 | *y = ft_face->glyph->outline.points[idx].y; |
| 1479 | return 0; | 1480 | return 0; |
| 1480 | } | 1481 | } |
| 1481 | 1482 | ||