Let pattern FC_FONT_VARIATIONS override standard axis variations

Ie. flip the merge order.
This commit is contained in:
Behdad Esfahbod 2017-12-19 15:51:16 -05:00
parent 650b051a25
commit 6d1d44d5ec
1 changed files with 11 additions and 9 deletions

View File

@ -540,12 +540,7 @@ FcFontRenderPrepare (FcConfig *config,
FcPatternObjectGetBool (font, FC_VARIABLE_OBJECT, 0, &variable); FcPatternObjectGetBool (font, FC_VARIABLE_OBJECT, 0, &variable);
assert (variable != FcDontCare); assert (variable != FcDontCare);
if (variable) if (variable)
{
FcChar8 *vars = NULL;
FcStrBufInit (&variations, NULL, 0); FcStrBufInit (&variations, NULL, 0);
if (FcPatternObjectGetString (pat, FC_FONT_VARIATIONS_OBJECT, 0, &vars) == FcResultMatch)
FcStrBufString (&variations, vars);
}
new = FcPatternCreate (); new = FcPatternCreate ();
if (!new) if (!new)
@ -739,9 +734,16 @@ FcFontRenderPrepare (FcConfig *config,
} }
} }
if (variable) if (variable && variations.len)
{ {
FcChar8 *vars = NULL;
if (FcPatternObjectGetString (new, FC_FONT_VARIATIONS_OBJECT, 0, &vars) == FcResultMatch)
{
FcStrBufChar (&variations, ',');
FcStrBufString (&variations, vars);
FcPatternObjectDel (new, FC_FONT_VARIATIONS_OBJECT); FcPatternObjectDel (new, FC_FONT_VARIATIONS_OBJECT);
}
FcPatternObjectAddString (new, FC_FONT_VARIATIONS_OBJECT, FcStrBufDoneStatic (&variations)); FcPatternObjectAddString (new, FC_FONT_VARIATIONS_OBJECT, FcStrBufDoneStatic (&variations));
FcStrBufDestroy (&variations); FcStrBufDestroy (&variations);
} }