Retry to decode strings in the name table as UTF-16BE in some cases.
Fixes https://gitlab.freedesktop.org/fontconfig/fontconfig/-/issues/376
This commit is contained in:
parent
81a26a6b62
commit
34883cb414
|
@ -699,6 +699,7 @@ FcSfntNameTranscode (FT_SfntName *sname)
|
|||
iconv_t cd;
|
||||
#endif
|
||||
FcChar8 *utf8;
|
||||
FcBool redecoded = FcFalse;
|
||||
|
||||
for (i = 0; i < NUM_FC_FT_ENCODING; i++)
|
||||
if (fcFtEncoding[i].platform_id == sname->platform_id &&
|
||||
|
@ -709,6 +710,7 @@ FcSfntNameTranscode (FT_SfntName *sname)
|
|||
return 0;
|
||||
fromcode = fcFtEncoding[i].fromcode;
|
||||
|
||||
retry:
|
||||
/*
|
||||
* Many names encoded for TT_PLATFORM_MACINTOSH are broken
|
||||
* in various ways. Kludge around them.
|
||||
|
@ -858,6 +860,13 @@ FcSfntNameTranscode (FT_SfntName *sname)
|
|||
{
|
||||
iconv_close (cd);
|
||||
free (utf8);
|
||||
if (!redecoded)
|
||||
{
|
||||
/* Regard the encoding as UTF-16BE and try again. */
|
||||
redecoded = FcTrue;
|
||||
fromcode = "UTF-16BE";
|
||||
goto retry;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -865,6 +874,14 @@ FcSfntNameTranscode (FT_SfntName *sname)
|
|||
*outbuf = '\0';
|
||||
goto done;
|
||||
}
|
||||
#else
|
||||
if (!redecoded)
|
||||
{
|
||||
/* Regard the encoding as UTF-16BE and try again. */
|
||||
redecoded = FcTrue;
|
||||
fromcode = "UTF-16BE";
|
||||
goto retry;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
done:
|
||||
|
|
Loading…
Reference in New Issue