mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-07-15 14:57:08 +08:00
#444 handle invalid tounicode map objects in tt fonts
This commit is contained in:
parent
03692cf42f
commit
4e490d63be
@ -107,13 +107,20 @@
|
|||||||
CMap toUnicodeCMap = null;
|
CMap toUnicodeCMap = null;
|
||||||
if (dictionary.TryGet(NameToken.ToUnicode, out var toUnicodeObj))
|
if (dictionary.TryGet(NameToken.ToUnicode, out var toUnicodeObj))
|
||||||
{
|
{
|
||||||
var toUnicode = DirectObjectFinder.Get<StreamToken>(toUnicodeObj, pdfScanner);
|
try
|
||||||
|
|
||||||
var decodedUnicodeCMap = toUnicode.Decode(filterProvider, pdfScanner);
|
|
||||||
|
|
||||||
if (decodedUnicodeCMap != null)
|
|
||||||
{
|
{
|
||||||
toUnicodeCMap = CMapCache.Parse(new ByteArrayInputBytes(decodedUnicodeCMap));
|
var toUnicode = DirectObjectFinder.Get<StreamToken>(toUnicodeObj, pdfScanner);
|
||||||
|
|
||||||
|
var decodedUnicodeCMap = toUnicode.Decode(filterProvider, pdfScanner);
|
||||||
|
|
||||||
|
if (decodedUnicodeCMap != null)
|
||||||
|
{
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user