mirror of
https://github.com/UglyToad/PdfPig.git
synced 2025-10-14 19:05:01 +08:00
handle null name in tounicode cmap, handle indirect reference in widths array for cid font and handle empty data for private dictionary in compact font format
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using Util;
|
||||
|
||||
/// <summary>
|
||||
/// Provides access to the raw bytes of this Compact Font Format file with utility methods for reading data types from it.
|
||||
@@ -112,6 +113,11 @@
|
||||
|
||||
public CompactFontFormatData SnapshotPortion(int startLocation, int length)
|
||||
{
|
||||
if (length == 0)
|
||||
{
|
||||
return new CompactFontFormatData(EmptyArray<byte>.Instance);
|
||||
}
|
||||
|
||||
if (startLocation > dataBytes.Count - 1 || startLocation + length > dataBytes.Count)
|
||||
{
|
||||
throw new ArgumentException($"Attempted to create a snapshot of an invalid portion of the data. Length was {dataBytes.Count}, requested start: {startLocation} and requested length: {length}.");
|
||||
|
@@ -31,7 +31,7 @@
|
||||
if (CanMapToUnicode)
|
||||
{
|
||||
IsUsingIdentityAsUnicodeMap =
|
||||
cMap.Name.StartsWith("Identity-", StringComparison.InvariantCultureIgnoreCase);
|
||||
cMap.Name?.StartsWith("Identity-", StringComparison.InvariantCultureIgnoreCase) == true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -151,7 +151,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
private static IReadOnlyDictionary<int, decimal> ReadWidths(DictionaryToken dict)
|
||||
private IReadOnlyDictionary<int, decimal> ReadWidths(DictionaryToken dict)
|
||||
{
|
||||
var widths = new Dictionary<int, decimal>();
|
||||
|
||||
@@ -166,7 +166,7 @@
|
||||
{
|
||||
var firstCode = (NumericToken)widthArray.Data[counter++];
|
||||
var next = widthArray.Data[counter++];
|
||||
if (next is ArrayToken array)
|
||||
if (DirectObjectFinder.TryGet(next, pdfScanner, out ArrayToken array))
|
||||
{
|
||||
int startRange = firstCode.Int;
|
||||
int arraySize = array.Data.Count;
|
||||
|
Reference in New Issue
Block a user