Пример #1
0
        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);
        }
Пример #2
0
        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));
        }
Пример #3
0
        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));
        }
Пример #4
0
        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));
        }