Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,8 @@ private static Type2CharStrings.CommandSequence ParseSingle(
}
}

values.TrimExcess();

return new Type2CharStrings.CommandSequence(values, commandIdentifiers);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ private CompactFontFormatIsoAdobeCharset()
gidToStringIdAndNameMap[gid++] = pair;
}

#if NET
gidToStringIdAndNameMap.TrimExcess();
#endif

glyphIdToStringIdAndName = gidToStringIdAndNameMap;
}

Expand Down
10 changes: 7 additions & 3 deletions src/UglyToad.PdfPig/PdfFonts/Cmap/CharacterMapBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,15 @@ public void AddBaseFontCharacter(ReadOnlySpan<byte> bytes, string value)

public CMap Build()
{
#if NET
BaseFontCharacterMap?.TrimExcess();
#endif

return new CMap(GetCidSystemInfo(), Type, WMode, Name, Version,
BaseFontCharacterMap ?? new Dictionary<int, string>(),
CodespaceRanges ?? new CodespaceRange[0],
CidRanges ?? new CidRange[0],
CidCharacterMappings ?? new CidCharacterMapping[0]);
CodespaceRanges ?? Array.Empty<CodespaceRange>(),
CidRanges ?? Array.Empty<CidRange>(),
CidCharacterMappings ?? Array.Empty<CidCharacterMapping>());
}

private CharacterIdentifierSystemInfo GetCidSystemInfo()
Expand Down
Loading