Commit 49eaafba authored by Paul Eggert's avatar Paul Eggert
Browse files

* ftfont.c: (get_adstyle_property, ftfont_pattern_entity):

(ftfont_lookup_cache, ftfont_open, ftfont_anchor_point):
Rename locals to avoid shadowing.
parent e932860f
......@@ -4,6 +4,9 @@
(ftfont_otf_capability, ftfont_shape): Omit decls if not needed.
(OTF_TAG_SYM): Omit macro if not needed.
(ftfont_list): Remove unused local.
(get_adstyle_property, ftfont_pattern_entity):
(ftfont_lookup_cache, ftfont_open, ftfont_anchor_point):
Rename locals to avoid shadowing.
 
* xfont.c (xfont_list_family): Mark var as initialized.
 
......@@ -168,11 +168,11 @@ get_adstyle_property (FcPattern *p)
for (end = str; *end && *end != ' '; end++);
if (*end)
{
char *p = alloca (end - str + 1);
memcpy (p, str, end - str);
p[end - str] = '\0';
end = p + (end - str);
str = p;
char *newstr = alloca (end - str + 1);
memcpy (newstr, str, end - str);
newstr[end - str] = '\0';
end = newstr + (end - str);
str = newstr;
}
if (xstrcasecmp (str, "Regular") == 0
|| xstrcasecmp (str, "Bold") == 0
......@@ -190,18 +190,18 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
{
Lisp_Object key, cache, entity;
char *file, *str;
int index;
int idx;
int numeric;
double dbl;
FcBool b;
if (FcPatternGetString (p, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch)
return Qnil;
if (FcPatternGetInteger (p, FC_INDEX, 0, &index) != FcResultMatch)
if (FcPatternGetInteger (p, FC_INDEX, 0, &idx) != FcResultMatch)
return Qnil;
key = Fcons (make_unibyte_string ((char *) file, strlen ((char *) file)),
make_number (index));
make_number (idx));
cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY);
entity = XCAR (cache);
if (! NILP (entity))
......@@ -265,7 +265,7 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
ASET (entity, FONT_ADSTYLE_INDEX, get_adstyle_property (p));
if ((ft_library || FT_Init_FreeType (&ft_library) == 0)
&& FT_New_Face (ft_library, file, index, &ft_face) == 0)
&& FT_New_Face (ft_library, file, idx, &ft_face) == 0)
{
BDF_PropertyRec rec;
......@@ -394,14 +394,14 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for)
? ! cache_data->ft_face : ! cache_data->fc_charset)
{
char *filename = SSDATA (XCAR (key));
int index = XINT (XCDR (key));
int idx = XINT (XCDR (key));
if (cache_for == FTFONT_CACHE_FOR_FACE)
{
if (! ft_library
&& FT_Init_FreeType (&ft_library) != 0)
return Qnil;
if (FT_New_Face (ft_library, filename, index, &cache_data->ft_face)
if (FT_New_Face (ft_library, filename, idx, &cache_data->ft_face)
!= 0)
return Qnil;
}
......@@ -413,7 +413,7 @@ ftfont_lookup_cache (Lisp_Object key, enum ftfont_cache_for cache_for)
FcCharSet *charset = NULL;
pat = FcPatternBuild (0, FC_FILE, FcTypeString, (FcChar8 *) filename,
FC_INDEX, FcTypeInteger, index, NULL);
FC_INDEX, FcTypeInteger, idx, NULL);
if (! pat)
goto finish;
objset = FcObjectSetBuild (FC_CHARSET, FC_STYLE, NULL);
......@@ -1159,7 +1159,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
FT_Face ft_face;
FT_Size ft_size;
FT_UInt size;
Lisp_Object val, filename, index, cache, font_object;
Lisp_Object val, filename, idx, cache, font_object;
int scalable;
int spacing;
char name[256];
......@@ -1174,7 +1174,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
if (NILP (cache))
return Qnil;
filename = XCAR (val);
index = XCDR (val);
idx = XCDR (val);
val = XCDR (cache);
cache_data = XSAVE_VALUE (XCDR (cache))->pointer;
ft_face = cache_data->ft_face;
......@@ -1216,7 +1216,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size)
font = XFONT_OBJECT (font_object);
ftfont_info = (struct ftfont_info *) font;
ftfont_info->ft_size = ft_face->size;
ftfont_info->index = XINT (index);
ftfont_info->index = XINT (idx);
#ifdef HAVE_LIBOTF
ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT;
ftfont_info->otf = NULL;
......@@ -1461,7 +1461,8 @@ ftfont_get_bitmap (struct font *font, unsigned int code, struct font_bitmap *bit
}
static int
ftfont_anchor_point (struct font *font, unsigned int code, int index, int *x, int *y)
ftfont_anchor_point (struct font *font, unsigned int code, int idx,
int *x, int *y)
{
struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
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
return -1;
if (ft_face->glyph->format != FT_GLYPH_FORMAT_OUTLINE)
return -1;
if (index >= ft_face->glyph->outline.n_points)
if (idx >= ft_face->glyph->outline.n_points)
return -1;
*x = ft_face->glyph->outline.points[index].x;
*y = ft_face->glyph->outline.points[index].y;
*x = ft_face->glyph->outline.points[idx].x;
*y = ft_face->glyph->outline.points[idx].y;
return 0;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment