Commit 2d006394 authored by Behdad Esfahbod's avatar Behdad Esfahbod

[varfonts] Do not set postscriptname for varfont pattern

parent be735d6a
...@@ -1207,8 +1207,6 @@ FcFreeTypeQueryFace (const FT_Face face, ...@@ -1207,8 +1207,6 @@ FcFreeTypeQueryFace (const FT_Face face,
FcChar8 *style = 0; FcChar8 *style = 0;
int st; int st;
char psname[256];
const char *tmp;
FcBool symbol = FcFalse; FcBool symbol = FcFalse;
...@@ -1595,52 +1593,57 @@ FcFreeTypeQueryFace (const FT_Face face, ...@@ -1595,52 +1593,57 @@ FcFreeTypeQueryFace (const FT_Face face,
} }
/* Add the PostScript name into the cache */ /* Add the PostScript name into the cache */
tmp = FT_Get_Postscript_Name (face); if (!variable)
if (!tmp)
{ {
unsigned int i; char psname[256];
FcChar8 *family, *familylang = NULL; const char *tmp;
size_t len; tmp = FT_Get_Postscript_Name (face);
int n = 0; if (!tmp)
/* Workaround when FT_Get_Postscript_Name didn't give any name.
* try to find out the English family name and convert.
*/
while (FcPatternObjectGetString (pat, FC_FAMILYLANG_OBJECT, n, &familylang) == FcResultMatch)
{ {
if (FcStrCmp (familylang, (const FcChar8 *)"en") == 0) unsigned int i;
break; FcChar8 *family, *familylang = NULL;
n++; size_t len;
familylang = NULL; int n = 0;
}
if (!familylang)
n = 0;
if (FcPatternObjectGetString (pat, FC_FAMILY_OBJECT, n, &family) != FcResultMatch) /* Workaround when FT_Get_Postscript_Name didn't give any name.
goto bail1; * try to find out the English family name and convert.
len = strlen ((const char *)family); */
/* the literal name in PostScript Language is limited to 127 characters though, while (FcPatternObjectGetString (pat, FC_FAMILYLANG_OBJECT, n, &familylang) == FcResultMatch)
* It is the architectural limit. so assuming 255 characters may works enough. {
*/ if (FcStrCmp (familylang, (const FcChar8 *)"en") == 0)
for (i = 0; i < len && i < 255; i++) break;
{ n++;
/* those characters are not allowed to be the literal name in PostScript */ familylang = NULL;
static const char exclusive_chars[] = "\x04()/<>[]{}\t\f\r\n "; }
if (!familylang)
n = 0;
if (strchr(exclusive_chars, family[i]) != NULL) if (FcPatternObjectGetString (pat, FC_FAMILY_OBJECT, n, &family) != FcResultMatch)
psname[i] = '-'; goto bail1;
else len = strlen ((const char *)family);
psname[i] = family[i]; /* the literal name in PostScript Language is limited to 127 characters though,
* It is the architectural limit. so assuming 255 characters may works enough.
*/
for (i = 0; i < len && i < 255; i++)
{
/* those characters are not allowed to be the literal name in PostScript */
static const char exclusive_chars[] = "\x04()/<>[]{}\t\f\r\n ";
if (strchr(exclusive_chars, family[i]) != NULL)
psname[i] = '-';
else
psname[i] = family[i];
}
psname[i] = 0;
} }
psname[i] = 0; else
} {
else strncpy (psname, tmp, 255);
{ psname[255] = 0;
strncpy (psname, tmp, 255); }
psname[255] = 0; if (!FcPatternAddString (pat, FC_POSTSCRIPT_NAME, (const FcChar8 *)psname))
goto bail1;
} }
if (!FcPatternAddString (pat, FC_POSTSCRIPT_NAME, (const FcChar8 *)psname))
goto bail1;
if (file && *file && !FcPatternAddString (pat, FC_FILE, file)) if (file && *file && !FcPatternAddString (pat, FC_FILE, file))
goto bail1; goto bail1;
......
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