public static CFFTopDict Read(BinaryReaderFont reader, int length) { CFFTopDict value = new CFFTopDict(); long start = reader.Position; List <double> list = new List <double>(); byte key0 = 0; byte key1 = 0; while ((reader.Position - start) < length) { byte n = reader.PeekByte(); if (n <= 21) { key0 = reader.ReadByte(); if (key0 == 12) { key1 = reader.ReadByte(); } //Console.WriteLine("key0: " + key0); //if (key1 != 0) { // Console.WriteLine("key1: " + key1); //} value.SetValue(list, key0, key1); key1 = 0; list.Clear(); } else { list.Add(reader.ReadCFFNumber()); } } return(value); }
protected void ReadTopDict(BinaryReaderFont reader) { CFFIndex index = CFFIndex.Read(reader); //Console.WriteLine("topDict: {0}", index); int[] offset = index.ReadAllOffsets(reader); int length = offset[1] - offset[0]; topDict = CFFTopDict.Read(reader, length); }
public static CFFTable Read(BinaryReaderFont reader) { long position = reader.Position; CFFTable value = new CFFTable(); value.position = reader.Position; value.filePath = reader.FilePath; value.major = reader.ReadByte(); value.minor = reader.ReadByte(); value.hdrSize = reader.ReadByte(); value.offSize = reader.ReadByte(); reader.Position = position + value.hdrSize; value.ReadName(reader); value.ReadTopDict(reader); value.ReadString(reader); value.ReadGlobalSubr(reader); CFFTopDict topDict = value.topDict; //if (topDict.CharStrings > 0) { // reader.Position = position + topDict.CharStrings; // value.ReadCharStrings(reader); //} if (topDict.FDSelect > 0) { reader.Position = position + topDict.FDSelect; value.fdSelect = CFFFDSelect.Read(reader); } if (topDict.charset > 0) { reader.Position = position + topDict.charset; //value.charsets = CFFCharset.Read(reader, value.CharStringsIndex.count); } if (topDict.Private.values[0] > 0) { reader.Position = position + (int)topDict.Private.values[1]; value.ReadPrivate(reader); } //Console.WriteLine("Charset: " + value.charsets); //Console.WriteLine("Docode: {0}", CFFCharString.Decode(value.charStrings[0])); //index = CFFIndex.Read(reader); //Console.WriteLine("index ::4 " + index); return(value); }