fix off-by-one error in format 4 cmap subtable for truetype #91

This commit is contained in:
Eliot Jones
2019-12-05 12:21:58 +00:00
parent 928347bcce
commit 2ea71ce3bb

View File

@@ -35,8 +35,11 @@ namespace UglyToad.PdfPig.Fonts.TrueType.Tables.CMapSubTables
Segments = segments ?? throw new ArgumentNullException(nameof(segments)); Segments = segments ?? throw new ArgumentNullException(nameof(segments));
GlyphIds = glyphIds ?? throw new ArgumentNullException(nameof(glyphIds)); GlyphIds = glyphIds ?? throw new ArgumentNullException(nameof(glyphIds));
if (Segments.Count > 0)
{
FirstCharacterCode = Segments[0].StartCode; FirstCharacterCode = Segments[0].StartCode;
LastCharacterCode = Segments[Segments.Count - 2].EndCode; LastCharacterCode = Segments[Segments.Count - 1].EndCode;
}
} }
public int CharacterCodeToGlyphIndex(int characterCode) public int CharacterCodeToGlyphIndex(int characterCode)