private static ByteSegment[] LoadIndexData(FontSource p) { var count = p.ReadUShort(); if (count <= 0) { return(null); } var offSize = p.ReadByte(); var offsets = new uint[count + 1]; for (var i = 0; i < offsets.Length; i++) { offsets[i] = p.ReadUInt(offSize); } var segments = new ByteSegment[count]; for (var i = 0; i < offsets.Length - 1; i++) { segments[i] = new ByteSegment(p.Offset + offsets[i] - 1, offsets[i + 1] - offsets[i]); } p.Offset += offsets[offsets.Length - 1] - 1; return(segments); }
public static OffsetTable Load(FontSource data) { var sfntVersion = data.ReadUInt(); var numTables = data.ReadUShort(); // Skip search range // Skip entry selector // Skip range shift data.Offset += 6; return(new OffsetTable(numTables, sfntVersion)); }
public static TableRecord Load(FontSource data) { var tag = data.ReadTag().Trim(); // Skip check sum data.Offset += 4; var offset = data.ReadUInt(); // Skip length data.Offset += 4; return(new TableRecord(tag, offset)); }
public static EncodingRecord Load(FontSource source, uint tableOffset) { var platformID = source.ReadUShort(); var encodingID = source.ReadUShort(); var encodingRecordOffset = source.ReadUInt(); var offset = source.Offset; source.Offset = tableOffset + encodingRecordOffset; var subTableFormat = source.ReadUShort(); source.Offset = offset; return(new EncodingRecord(platformID, encodingID, encodingRecordOffset, subTableFormat)); }