Move whitespace-trimming code to apply to all name-table strings

If it's good, it's good for everything!
This commit is contained in:
Behdad Esfahbod 2017-09-27 16:49:24 -04:00
parent 869dfe0bdc
commit a74109a114
1 changed files with 11 additions and 12 deletions

View File

@ -1476,18 +1476,6 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
case TT_NAME_ID_FONT_SUBFAMILY:
if (variable)
break;
if (utf8)
{
pp = utf8;
while (*pp == ' ')
pp++;
len = strlen ((const char *) pp);
memmove (utf8, pp, len + 1);
pp = utf8 + len - 1;
while (*pp == ' ')
pp--;
*(pp + 1) = 0;
}
if (FcDebug () & FC_DBG_SCANV)
printf ("found style (n %2d p %d e %d l 0x%04x) %s\n",
sname.name_id, sname.platform_id,
@ -1508,6 +1496,17 @@ FcFreeTypeQueryFaceInternal (const FT_Face face,
}
if (elt)
{
/* Trim surrounding whitespace. */
pp = utf8;
while (*pp == ' ')
pp++;
len = strlen ((const char *) pp);
memmove (utf8, pp, len + 1);
pp = utf8 + len - 1;
while (*pp == ' ')
pp--;
*(pp + 1) = 0;
if (FcStringInPatternElement (pat, elt, utf8))
{
free (utf8);