handle 0 length gylph in true type font

This commit is contained in:
Eliot Jones
2020-01-06 14:12:46 +00:00
parent 80845863a8
commit 09c72a2fb2

View File

@@ -121,6 +121,13 @@
private static Glyph ReadSimpleGlyph(TrueTypeDataBytes data, short contourCount, PdfRectangle bounds) private static Glyph ReadSimpleGlyph(TrueTypeDataBytes data, short contourCount, PdfRectangle bounds)
{ {
if (contourCount == 0)
{
return new Glyph(true, EmptyArray<byte>.Instance, EmptyArray<ushort>.Instance,
EmptyArray<GlyphPoint>.Instance,
new PdfRectangle(0, 0, 0, 0));
}
var endPointsOfContours = data.ReadUnsignedShortArray(contourCount); var endPointsOfContours = data.ReadUnsignedShortArray(contourCount);
var instructionLength = data.ReadUnsignedShort(); var instructionLength = data.ReadUnsignedShort();