Trim excess in long lived font collections
Some checks failed
Build, test and publish draft / build (push) Has been cancelled
Build and test [MacOS] / build (push) Has been cancelled
Run Common Crawl Tests / build (0000-0001) (push) Has been cancelled
Run Common Crawl Tests / build (0002-0003) (push) Has been cancelled
Run Common Crawl Tests / build (0004-0005) (push) Has been cancelled
Run Common Crawl Tests / build (0006-0007) (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled

This commit is contained in:
BobLd
2025-10-14 10:08:50 +01:00
parent cf0c33b1e0
commit 2216ade1f2
3 changed files with 13 additions and 3 deletions

View File

@@ -770,6 +770,8 @@ namespace UglyToad.PdfPig.Fonts.CompactFontFormat.CharStrings
}
}
values.TrimExcess();
return new Type2CharStrings.CommandSequence(values, commandIdentifiers);
}

View File

@@ -257,6 +257,10 @@
gidToStringIdAndNameMap[gid++] = pair;
}
#if NET
gidToStringIdAndNameMap.TrimExcess();
#endif
glyphIdToStringIdAndName = gidToStringIdAndNameMap;
}

View File

@@ -81,11 +81,15 @@ namespace UglyToad.PdfPig.PdfFonts.Cmap
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()