Ejemplo n.º 1
0
        public void LoadSingleGlyphWithUInt8Offset_unsignd_byte()
        {
            var writer = new BigEndianBinaryWriter();

            writer.WriteUInt16(0);                 // 8bit unsigned
            writer.WriteUInt16(1);                 // glyph id

            writer.WriteUInt8(sbyte.MaxValue + 1); // dx
            writer.WriteUInt8(sbyte.MaxValue + 2); // dy
            writer.GetReader();

            var bounds = new Bounds(0, 0, 100, 100);
            var glyph  = CompositeGlyphLoader.LoadCompositeGlyph(writer.GetReader(), in bounds);

            var tbl = new GlyphTable(new[]
            {
                new SimpleGlyphLoader(bounds), // padding
                new SimpleGlyphLoader(new short[] { 20 }, new short[] { 21 }, new[] { true }, new ushort[] { 1 }, bounds)
            });

            GlyphVector finalGlyph = glyph.CreateGlyph(tbl);

            Vector2 point = Assert.Single(finalGlyph.ControlPoints);

            Assert.Equal(new Vector2(sbyte.MaxValue + 1 + 20, sbyte.MaxValue + 2 + 21), point);
        }