public override MieFontKerningPairBase Read(BinaryReader br)
        {
            var kerningPair = new MieFontKerningPairType2();

            kerningPair.FirstGlyph = br.ReadInt32();
            kerningPair.FirstGlyphAjustments.Read(br);
            kerningPair.SecondGlyph = br.ReadInt32();
            kerningPair.SecondGlyphAdjustments.Read(br);

            kerningPair.XOffset = br.ReadSingle();

            return(kerningPair);
        }
Beispiel #2
0
        public static MieFontKerningTable Read(BinaryReader br, MieFont.NFormatType type)
        {
            var kerningTable = new MieFontKerningTable();

            var count = br.ReadInt32();

            for (var i = 0; i < count; i++)
            {
                switch (type)
                {
                case MieFont.NFormatType.Unknown:
                    throw new NotImplementedException();

                case MieFont.NFormatType.Type1:
                    throw new NotImplementedException();

                case MieFont.NFormatType.Type2:
                    var kerningPair2 = new MieFontKerningPairType2();
                    kerningPair2.Read(br);
                    kerningTable.Items.Add(kerningPair2);

                    break;

                case MieFont.NFormatType.Type3:
                    throw new NotImplementedException();

                case MieFont.NFormatType.Type4:
                    throw new NotImplementedException();

                case MieFont.NFormatType.Type5:
                    throw new NotImplementedException();

                case MieFont.NFormatType.PoE2:
                    var kerningPair1 = new MieFontKerningPairType1();
                    kerningPair1.Read(br);
                    kerningTable.Items.Add(kerningPair1);

                    break;

                default:
                    throw new Exception($"Unknown Format type({type})");
                }
            }

            return(kerningTable);
        }