Beispiel #1
0
        internal static List<CharacterMap> From(TableEntry table)
        {
            var input = table.GetDataReader();

            var version = input.ReadUInt16(); // 0
            var tableCount = input.ReadUInt16();

            var entries = new List<CMapEntry>(tableCount);
            for (int i = 0; i < tableCount; i++)
            {
                var platformId = input.ReadUInt16();
                var encodingId = input.ReadUInt16();
                var offset = input.ReadUInt32();
                entries.Add(new CMapEntry(platformId, encodingId, offset));
            }

            var result = new List<CharacterMap>(tableCount);
            foreach (var entry in entries)
            {
                var subtable = table.GetDataReader();
                subtable.BaseStream.Seek(entry.Offset, SeekOrigin.Current);
                result.Add(ReadCharacterMap(entry, subtable));
            }

            return result;
        }
Beispiel #2
0
        internal static List<Glyph> From(TableEntry table, GlyphLocations locations)
        {
            var glyphCount = locations.GlyphCount;

            var glyphs = new List<Glyph>(glyphCount);
            for (int i = 0; i < glyphCount; i++)
            {
                var input = table.GetDataReader();
                input.BaseStream.Seek(locations.Offsets[i], SeekOrigin.Current);

                var length = locations.Offsets[i + 1] - locations.Offsets[i];
                if (length > 0)
                {
                    var contoursCount = input.ReadInt16();
                    var bounds = BoundsReader.ReadFrom(input);
                    if (contoursCount >= 0)
                    {
                        glyphs.Add(ReadSimpleGlyph(input, contoursCount, bounds));
                    }
                    else
                    {
                        glyphs.Add(ReadCompositeGlyph(input, -contoursCount, bounds));
                    }
                }
                else
                {
                    glyphs.Add(Glyph.Empty);
                }
            }
            return glyphs;
        }
        public GlyphLocations(TableEntry table, int glyphCount, bool wideLocations)
        {
            var input = table.GetDataReader();
            _offsets = new uint[glyphCount + 1];

            if (wideLocations)
            {
                for (int i = 0; i < glyphCount + 1; i++)
                {
                    _offsets[i] = input.ReadUInt32();
                }
            }
            else
            {
                for (int i = 0; i < glyphCount + 1; i++)
                {
                    _offsets[i] = (uint)(input.ReadUInt16() * 2);
                }
            }
        }
Beispiel #4
0
        public GlyphLocations(TableEntry table, int glyphCount, bool wideLocations)
        {
            var input = table.GetDataReader();

            _offsets = new uint[glyphCount + 1];

            if (wideLocations)
            {
                for (int i = 0; i < glyphCount + 1; i++)
                {
                    _offsets[i] = input.ReadUInt32();
                }
            }
            else
            {
                for (int i = 0; i < glyphCount + 1; i++)
                {
                    _offsets[i] = (uint)(input.ReadUInt16() * 2);
                }
            }
        }
Beispiel #5
0
        public static HorizontalMetrics From(TableEntry table, UInt16 count, UInt16 numGlyphs)
        {
            var input            = table.GetDataReader();
            var advanceWidths    = new List <ushort>(numGlyphs);
            var leftSideBearings = new List <short>(numGlyphs);

            for (int i = 0; i < count; i++)
            {
                advanceWidths.Add(input.ReadUInt16());
                leftSideBearings.Add(input.ReadInt16());
            }

            var advanceWidth = advanceWidths[advanceWidths.Count - 1];

            for (int i = 0; i < numGlyphs - count; i++)
            {
                advanceWidths.Add(advanceWidth);
                leftSideBearings.Add(input.ReadInt16());
            }

            return(new HorizontalMetrics(advanceWidths.ToArray(), leftSideBearings.ToArray()));
        }
 public static HorizontalMetrics From(TableEntry table, UInt16 count, UInt16 numGlyphs)
 {
     return new HorizontalMetrics(table.GetDataReader(), count, numGlyphs);
 }
 public static HorizontalHeader From(TableEntry table)
 {
     return new HorizontalHeader(table.GetDataReader());
 }
Beispiel #8
0
        public static MetricsTable From(TableEntry table)
        {
            var input = table.GetDataReader();

            return(new MetricsTable(input));
        }
Beispiel #9
0
 internal static MaxProfile From(TableEntry table)
 {
     return(new MaxProfile(table.GetDataReader()));
 }
Beispiel #10
0
 public static HorizontalHeader From(TableEntry table)
 {
     return(new HorizontalHeader(table.GetDataReader()));
 }
Beispiel #11
0
 internal static Head From(TableEntry table)
 {
     return new Head(table.GetDataReader());
 }
Beispiel #12
0
 internal static Head From(TableEntry table)
 {
     return(new Head(table.GetDataReader()));
 }
Beispiel #13
0
 internal static MaxProfile From(TableEntry table)
 {
     return new MaxProfile(table.GetDataReader());
 }