示例#1
0
        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);
        }