public int[] ReadAllOffsets(BinaryReaderFont reader) { if (count == 0) { return(new int[0]); } switch (offSize) { case 1: return(Array.ConvertAll( reader.ReadBytes(count + 1), new Converter <byte, int>((a) => { return a; }) )); case 2: return(Array.ConvertAll( reader.ReadUInt16Array(count + 1), new Converter <ushort, int>((a) => { return a; }) )); case 3: return(reader.ReadUInt24Array(count + 1)); case 4: return(reader.ReadInt32Array(count + 1)); } return(new int[0]); }
public static new CmapSubtable2 Read(BinaryReaderFont reader) { CmapSubtable2 value = new CmapSubtable2 { format = reader.ReadUInt16(), length = reader.ReadUInt16(), language = reader.ReadUInt16() }; value.subHeaderKeys = reader.ReadUInt16Array(256); return(value); }
public static new CmapSubtable6 Read(BinaryReaderFont reader) { CmapSubtable6 value = new CmapSubtable6 { format = reader.ReadUInt16(), length = reader.ReadUInt16(), language = reader.ReadUInt16(), firstCode = reader.ReadUInt16(), entryCount = reader.ReadUInt16() }; value.glyphIdArray = reader.ReadUInt16Array(value.entryCount); return(value); }
public static new CmapSubtable10 Read(BinaryReaderFont reader) { CmapSubtable10 value = new CmapSubtable10(); value.format = reader.ReadUInt16(); value.reserved = reader.ReadUInt16(); value.length = reader.ReadUInt32(); value.language = reader.ReadUInt32(); value.startCharCode = reader.ReadUInt32(); value.numChars = reader.ReadUInt32(); value.glyphs = reader.ReadUInt16Array((int)value.numChars); return(value); }
public static BaseValues Read(BinaryReaderFont reader) { BaseValues value = new BaseValues { defaultBaselineIndex = reader.ReadUInt16(), baseCoordCount = reader.ReadUInt16() }; if (value.baseCoordCount != 0) { value.baseCoords = reader.ReadUInt16Array( value.baseCoordCount ); } return(value); }
public static new SimpleGlyph Read(BinaryReaderFont reader, Glyph glyph) { SimpleGlyph value = new SimpleGlyph { endPtsOfContours = reader.ReadUInt16Array(glyph.numberOfContours), instructionLength = reader.ReadUInt16() }; if (value.instructionLength > 0) { value.instructions = reader.ReadBytes(value.instructionLength); } int length = value.endPtsOfContours.Length; int count = value.endPtsOfContours[length - 1] + 1; value.ReadFlags(reader, count); value.ReadXCoordinates(reader, count); value.ReadYCoordinates(reader, count); //Console.WriteLine("Glyph count: " + count); //Console.WriteLine("Glyph count2: " + value.flags.Length); return(value); }
public static PostTable Read(BinaryReaderFont reader, TableRecord record) { PostTable value = new PostTable { version = reader.ReadFixed(), italicAngle = reader.ReadFixed(), underlinePosition = reader.ReadFWORD(), underlineThickness = reader.ReadFWORD(), isFixedPitch = reader.ReadUInt32(), minMemType42 = reader.ReadUInt32(), maxMemType42 = reader.ReadUInt32(), minMemType1 = reader.ReadUInt32(), maxMemType1 = reader.ReadUInt32(), }; if (value.version == 0x20000) { value.numGlyphs = reader.ReadUInt16(); value.glyphNameIndex = reader.ReadUInt16Array(value.numGlyphs); int remain = (int)record.length - 34; remain -= value.numGlyphs * 2; List <string> names = new List <string>(); while (remain > 0) { byte nameLength = reader.ReadByte(); if (nameLength == 0) { break; } string name = reader.ReadString(nameLength); remain -= nameLength + 1; names.Add(name); } value.names = names.ToArray(); } return(value); }