mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-11-28 09:28:25 +08:00
#444 handle invalid tounicode map objects in tt fonts
This commit is contained in:
@@ -106,6 +106,8 @@
|
|||||||
|
|
||||||
CMap toUnicodeCMap = null;
|
CMap toUnicodeCMap = null;
|
||||||
if (dictionary.TryGet(NameToken.ToUnicode, out var toUnicodeObj))
|
if (dictionary.TryGet(NameToken.ToUnicode, out var toUnicodeObj))
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var toUnicode = DirectObjectFinder.Get<StreamToken>(toUnicodeObj, pdfScanner);
|
var toUnicode = DirectObjectFinder.Get<StreamToken>(toUnicodeObj, pdfScanner);
|
||||||
|
|
||||||
@@ -116,6 +118,11 @@
|
|||||||
toUnicodeCMap = CMapCache.Parse(new ByteArrayInputBytes(decodedUnicodeCMap));
|
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);
|
Encoding encoding = encodingReader.Read(dictionary, descriptor);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user