Add Regular style when no meta data available to guess a style
This makes sure that fullname can be constructed at least even if a style is missing and "Regular" is omitted for fullname so this change won't affect in that case. Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/259
This commit is contained in:
parent
dbd67ccc63
commit
5a291467a7
|
@ -1625,13 +1625,26 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
|
||||||
++nfamily;
|
++nfamily;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!variable && !nstyle && face->style_name &&
|
if (!variable && !nstyle)
|
||||||
|
{
|
||||||
|
const FcChar8 *style_regular = (const FcChar8 *) "Regular";
|
||||||
|
const FcChar8 *ss;
|
||||||
|
|
||||||
|
if (face->style_name &&
|
||||||
FcStrCmpIgnoreBlanksAndCase ((FcChar8 *) face->style_name, (FcChar8 *) "") != 0)
|
FcStrCmpIgnoreBlanksAndCase ((FcChar8 *) face->style_name, (FcChar8 *) "") != 0)
|
||||||
{
|
{
|
||||||
if (FcDebug () & FC_DBG_SCANV)
|
if (FcDebug () & FC_DBG_SCANV)
|
||||||
printf ("using FreeType style \"%s\"\n", face->style_name);
|
printf ("using FreeType style \"%s\"\n", face->style_name);
|
||||||
|
|
||||||
if (!FcPatternObjectAddString (pat, FC_STYLE_OBJECT, (FcChar8 *) face->style_name))
|
ss = (const FcChar8 *) face->style_name;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (FcDebug () & FC_DBG_SCANV)
|
||||||
|
printf ("applying default style Regular\n");
|
||||||
|
ss = style_regular;
|
||||||
|
}
|
||||||
|
if (!FcPatternObjectAddString (pat, FC_STYLE_OBJECT, ss))
|
||||||
goto bail1;
|
goto bail1;
|
||||||
if (!FcPatternObjectAddString (pat, FC_STYLELANG_OBJECT, (FcChar8 *) "en"))
|
if (!FcPatternObjectAddString (pat, FC_STYLELANG_OBJECT, (FcChar8 *) "en"))
|
||||||
goto bail1;
|
goto bail1;
|
||||||
|
|
Loading…
Reference in New Issue