[varfonts] Skip named-instance that is equivalent to base font
This commit is contained in:
parent
8183194ae3
commit
be735d6a68
|
@ -2104,7 +2104,34 @@ FcFreeTypeQueryAll(const FcChar8 *file,
|
|||
num_faces = face->num_faces;
|
||||
num_instances = face->style_flags >> 16;
|
||||
pat = FcFreeTypeQueryFace (face, (const FcChar8 *) file, id, blanks);
|
||||
FT_Done_Face (face);
|
||||
|
||||
if (pat)
|
||||
{
|
||||
/* Skip named-instance that coincides with base instance. */
|
||||
if (!index_set && instance_num && instance_num != 0x8000)
|
||||
{
|
||||
unsigned int i;
|
||||
FT_MM_Var *mm_var = NULL;
|
||||
FT_Fixed *coords = NULL;
|
||||
|
||||
if (FT_Get_MM_Var (face, &mm_var) ||
|
||||
!(coords = (FT_Fixed *) calloc (mm_var->num_axis, sizeof (FT_Fixed))) ||
|
||||
FT_Get_Var_Blend_Coordinates (face, mm_var->num_axis, coords))
|
||||
{
|
||||
goto skip;
|
||||
}
|
||||
|
||||
for (i = 0; i < mm_var->num_axis; i++)
|
||||
if (coords[i])
|
||||
goto good;
|
||||
|
||||
skip:
|
||||
free (coords);
|
||||
FcPatternDestroy (pat);
|
||||
pat = NULL;
|
||||
good:
|
||||
;
|
||||
}
|
||||
|
||||
if (pat)
|
||||
{
|
||||
|
@ -2112,9 +2139,13 @@ FcFreeTypeQueryAll(const FcChar8 *file,
|
|||
if (!set || ! FcFontSetAdd (set, pat))
|
||||
FcPatternDestroy (pat);
|
||||
}
|
||||
}
|
||||
else if (instance_num != 0x8000)
|
||||
err = 1;
|
||||
|
||||
FT_Done_Face (face);
|
||||
face = NULL;
|
||||
|
||||
if (!set_instance_num && instance_num < num_instances)
|
||||
instance_num++;
|
||||
else if (!set_instance_num && instance_num == num_instances)
|
||||
|
|
Loading…
Reference in New Issue