public Glyph(PointS[] points, GlyphFlag[] flags, byte[] instructions, ushort[] endPtsOfContours, BoundsS bounds) { Points = points; Flags = flags; Instructions = instructions; EndPtsOfContours = endPtsOfContours; Bounds = bounds; }
private Glyph ReadSimpleGlyph(BinaryReader reader, int numberOfContours, short xMin, short yMin, short xMax, short yMax) { var endPtsOfContours = new ushort[numberOfContours]; for(int i = 0; i < numberOfContours; i++) { endPtsOfContours[i] = reader.ReadUInt16(); } var instructionLength = reader.ReadUInt16(); var instructions = reader.ReadBytes(instructionLength); var numberOfPoints = endPtsOfContours.Last() + 1; var flags = ReadGlyphFlags(reader, numberOfPoints); var xCoordinates = ReadGlyphCoordinates(reader, numberOfPoints, flags, GlyphFlag.XByte, GlyphFlag.XSignOrSame); var yCoordinates = ReadGlyphCoordinates(reader, numberOfPoints, flags, GlyphFlag.YByte, GlyphFlag.YSignOrSame); var points = new PointS[numberOfPoints]; for(int i = 0; i < numberOfPoints; i++) { points[i] = new PointS(xCoordinates[i], yCoordinates[i]); } var bounds = new BoundsS(xMin, xMax, yMin, yMax); return new Glyph(points, flags, instructions, endPtsOfContours, bounds); }