#444 handle invalid tounicode map objects in tt fonts

This commit is contained in:
Eliot Jones 2022-05-02 16:17:05 -04:00
parent 03692cf42f
commit 4e490d63be

View File

@ -106,6 +106,8 @@
CMap toUnicodeCMap = null;
if (dictionary.TryGet(NameToken.ToUnicode, out var toUnicodeObj))
{
try
{
var toUnicode = DirectObjectFinder.Get<StreamToken>(toUnicodeObj, pdfScanner);
@ -116,6 +118,11 @@
toUnicodeCMap = CMapCache.Parse(new ByteArrayInputBytes(decodedUnicodeCMap));
}
}
catch (Exception ex)
{
log.Error("Failed to decode ToUnicode CMap for a TrueType font in file due to an exception.", ex);
}
}
Encoding encoding = encodingReader.Read(dictionary, descriptor);