public static GlyphVariationData Read(BinaryReaderFont reader) { return(new GlyphVariationData { tupleVariationCount = reader.ReadUInt16(), dataOffset = reader.ReadUInt16() }); }
public static TupleVariationHeader Read(BinaryReaderFont reader) { return(new TupleVariationHeader { variationDataSize = reader.ReadUInt16(), tupleIndex = reader.ReadUInt16() }); }
public static CmapTable Read(BinaryReaderFont reader) { long start = reader.Position; CmapTable value = new CmapTable { version = reader.ReadUInt16(), numTables = reader.ReadUInt16() }; ushort numTables = value.numTables; //value.encodingRecords = EncodingRecord.ReadArray(reader, numTables); value.encodingRecords = new EncodingRecord[numTables]; value.subtables = new CmapSubtable[numTables]; long position = reader.Position; for (int i = 0; i < numTables; i++) { reader.Position = position; EncodingRecord record = EncodingRecord.Read(reader); value.encodingRecords[i] = record; position = reader.Position; reader.Position = start + record.offset; //reader.Position = start + value.encodingRecords[i].offset; value.subtables[i] = CmapSubtable.Read(reader); } //Console.WriteLine("position: {0:X}", (reader.Position - start)); return(value); }
public static Strike Read(BinaryReaderFont reader, uint numGlyphs) { Strike value = new Strike(); value.position = reader.Position; value.numGlyphs = numGlyphs; value.filePath = reader.FilePath; value.ppem = reader.ReadUInt16(); value.ppi = reader.ReadUInt16(); value.glyphDataOffsets = reader.ReadUInt32Array((int)numGlyphs + 1); /* * value.glyphData = new GlyphData[numGlyphs]; * uint[] glyphDataOffsets = value.glyphDataOffsets; * int length = value.glyphDataOffsets.Length - 1; * for (int i = 0; i < length; i++) { * uint offset = glyphDataOffsets[i]; * uint glyphLength = glyphDataOffsets[i + 1] - offset; * reader.Position = position + offset; * GlyphData glyphData = GlyphData.Read(reader, glyphLength); * value.glyphData[i] = glyphData; * } */ return(value); }
public static LayerRecord Read(BinaryReaderFont reader) { return(new LayerRecord { gID = reader.ReadUInt16(), paletteIndex = reader.ReadUInt16() }); }
public static GaspRange Read(BinaryReaderFont reader) { return(new GaspRange { rangeMaxPPEM = reader.ReadUInt16(), rangeGaspBehavior = reader.ReadUInt16() }); }
public static MarkGlyphSets Read(BinaryReaderFont reader) { return(new MarkGlyphSets { markGlyphSetTableFormat = reader.ReadUInt16(), markGlyphSetCount = reader.ReadUInt16() }); }
public static CFFRange2 Read(BinaryReaderFont reader) { return(new CFFRange2 { first = reader.ReadUInt16(), nLeft = reader.ReadUInt16() }); }
public static Feature Read(BinaryReaderFont reader) { return(new Feature { featureParams = reader.ReadUInt16(), lookupIndexCount = reader.ReadUInt16() }); }
public static KernTable Read(BinaryReaderFont reader) { return(new KernTable { version = reader.ReadUInt16(), nTables = reader.ReadUInt16() }); }
public static MarkRecord Read(BinaryReaderFont reader) { return(new MarkRecord { markClass = reader.ReadUInt16(), markAnchorOffset = reader.ReadUInt16() }); }
public void GetOffest(int glyphId, out uint offset0, out uint offset1) { if (glyphId < 0 || glyphId >= numGlyphs + 1) { offset0 = 0; offset1 = 0; return; } if (File.Exists(filePath) == false) { offset0 = 0; offset1 = 0; return; } using (Stream stream = File.OpenRead(filePath)) using (BinaryReaderFont reader = new BinaryReaderFont(stream)) { if (indexToLocFormat == 0) { reader.Position = position + glyphId * 2; offset0 = (uint)(reader.ReadUInt16() * 2); offset1 = (uint)(reader.ReadUInt16() * 2); return; } reader.Position = position + glyphId * 4; offset0 = reader.ReadUInt32(); offset1 = reader.ReadUInt32(); } }
public static GlyphIdOffsetPair Read(BinaryReaderFont reader) { return(new GlyphIdOffsetPair { glyphID = reader.ReadUInt16(), offset = reader.ReadUInt16() }); }
public static LTSHTable Read(BinaryReaderFont reader) { return(new LTSHTable { version = reader.ReadUInt16(), numGlyphs = reader.ReadUInt16() }); }
public static BaseScript Read(BinaryReaderFont reader) { long position = reader.Position; BaseScript value = new BaseScript { baseValuesOffset = reader.ReadUInt16(), defaultMinMaxOffset = reader.ReadUInt16(), baseLangSysCount = reader.ReadUInt16(), }; if (value.baseLangSysCount != 0) { value.baseLangSysRecords = BaseLangSysRecord.ReadArray( reader, value.baseLangSysCount ); } if (value.baseValuesOffset != 0) { reader.Position = position + value.baseValuesOffset; value.baseValues = BaseValues.Read(reader); } if (value.defaultMinMaxOffset != 0) { reader.Position = position + value.defaultMinMaxOffset; value.defaultMinMax = MinMax.Read(reader); } return(value); }
public static AttachList Read(BinaryReaderFont reader) { return(new AttachList { coverageOffset = reader.ReadUInt16(), glyphCount = reader.ReadUInt16() }); }
public static VariationRegionList Read(BinaryReaderFont reader) { return(new VariationRegionList { axisCount = reader.ReadUInt16(), regionCount = reader.ReadUInt16() }); }
public static CoverageFormat2 Read(BinaryReaderFont reader) { return(new CoverageFormat2 { coverageFormat = reader.ReadUInt16(), rangeCount = reader.ReadUInt16() }); }
//public VariationStore itemVarStore; public static BASETable Read(BinaryReaderFont reader) { long position = reader.Position; BASETable value = new BASETable { majorVersion = reader.ReadUInt16(), minorVersion = reader.ReadUInt16(), horizAxisOffset = reader.ReadUInt16(), vertAxisOffset = reader.ReadUInt16() }; if (value.majorVersion == 1 && value.minorVersion == 1) { value.itemVarStoreOffset = reader.ReadUInt32(); } if (value.horizAxisOffset != 0) { reader.Position = position + value.horizAxisOffset; value.horizAxis = AxisTable.Read(reader); } if (value.vertAxisOffset != 0) { reader.Position = position + value.vertAxisOffset; value.vertAxis = AxisTable.Read(reader); } if (value.itemVarStoreOffset != 0) { reader.Position = position + value.itemVarStoreOffset; //value.itemVarStore = } return(value); }
public static NameTable Read(BinaryReaderFont reader) { NameTable value = new NameTable { format = reader.ReadUInt16(), count = reader.ReadUInt16(), stringOffset = reader.ReadUInt16(), }; value.nameRecord = NameRecord.ReadArray(reader, value.count); if (value.format >= 1) { value.langTagCount = reader.ReadUInt16(); value.langTagRecord = LangTagRecord.ReadArray(reader, value.langTagCount); } long start = reader.Position; for (int i = 0; i < value.count; i++) { NameRecord record = value.nameRecord[i]; reader.Position = start + record.offset; record.text = reader.ReadString(record.length, GetEncoding(record)); } if (value.format >= 1) { for (int i = 0; i < value.langTagCount; i++) { LangTagRecord record = value.langTagRecord[i]; reader.Position = start + record.offset; record.text = reader.ReadString(record.length, Encoding.BigEndianUnicode); } } return(value); }
public static Script Read(BinaryReaderFont reader) { return(new Script { defaultLangSys = reader.ReadUInt16(), langSysCount = reader.ReadUInt16() }); }
public static CoverageFormat1 Read(BinaryReaderFont reader) { return(new CoverageFormat1 { coverageFormat = reader.ReadUInt16(), glyphCount = reader.ReadUInt16() }); }
public static ClassDefFormat2 Read(BinaryReaderFont reader) { return(new ClassDefFormat2 { classFormat = reader.ReadUInt16(), classRangeCount = reader.ReadUInt16() }); }
public static OffsetTable Read(BinaryReaderFont reader) { OffsetTable value = new OffsetTable(); value.sfntVersion = reader.ReadUInt32(); if (value.sfntVersion != Version1 && value.sfntVersion != VersionOTTO) { throw new Exception( string.Format("Parse error: sfntVersion is not valid. 0x{0:X8}", value.sfntVersion) ); } value.numTables = reader.ReadUInt16(); value.searchRange = reader.ReadUInt16(); if (MaximumPowerOf2(value.numTables) * 16 != value.searchRange) { throw new Exception( string.Format("Parse error: searchRange is not valid. {0}", value.searchRange) ); } value.entrySelector = reader.ReadUInt16(); if ((ushort)Math.Log(MaximumPowerOf2(value.numTables), 2) != value.entrySelector) { throw new Exception( string.Format("Parse error: entrySelector is not valid. {0}", value.entrySelector) ); } value.rangeShift = reader.ReadUInt16(); if (value.numTables * 16 - value.searchRange != value.rangeShift) { /*throw new Exception( * string.Format("Parse error: rangeShift is not valid. {0}", value.rangeShift) * );*/ } return(value); }
public static Lookup Read(BinaryReaderFont reader) { return(new Lookup { lookupType = reader.ReadUInt16(), lookupFlag = reader.ReadUInt16(), subTableCount = reader.ReadUInt16() }); }
public static Device Read(BinaryReaderFont reader) { return(new Device { startSize = reader.ReadUInt16(), endSize = reader.ReadUInt16(), deltaFormat = reader.ReadUInt16() }); }
public static JSTFTable Read(BinaryReaderFont reader) { return(new JSTFTable { majorVersion = reader.ReadUInt16(), minorVersion = reader.ReadUInt16(), jstfScriptCount = reader.ReadUInt16() }); }
public static LangSys Read(BinaryReaderFont reader) { return(new LangSys { lookupOrder = reader.ReadUInt16(), requiredFeatureIndex = reader.ReadUInt16(), featureIndexCount = reader.ReadUInt16() }); }
public static ClassRangeRecord Read(BinaryReaderFont reader) { return(new ClassRangeRecord { startGlyphID = reader.ReadUInt16(), endGlyphID = reader.ReadUInt16(), @class = reader.ReadUInt16() }); }
public static FeatMinMaxRecord Read(BinaryReaderFont reader) { return(new FeatMinMaxRecord { featureTableTag = reader.ReadTag(), minCoord = reader.ReadUInt16(), maxCoord = reader.ReadUInt16() }); }