示例#1
0
        public void TestGlyphBoundsWithM()
        {
            string       america  = "America";
            TestMathFont font     = new TestMathFont(10);
            var          provider = new TestGlyphBoundsProvider();
            var          glyphRun = new AttributedGlyphRun <TestMathFont, TGlyph>
            {
                Font         = font,
                KernedGlyphs = america.Select(c => new KernedGlyph <char>(c)).ToList(),
            };
            var width = provider.GetTypographicWidth(font, glyphRun);

            Assertions.ApproximatelyEqual(width, 40, 0.01);
        }
示例#2
0
        public void TestGlyphBoundsWithoutM()
        {
            string            hello = "Hello";
            MathFont <TGlyph> font  = new MathFont <TGlyph>(10);
            var provider            = new TestGlyphBoundsProvider();
            var glyphRun            = new AttributedGlyphRun <MathFont <TGlyph>, TGlyph>
            {
                Font         = font,
                KernedGlyphs = hello.ToCharArray().Select(c => new KernedGlyph <char>(c)).ToArray(),
            };
            var width = provider.GetTypographicWidth(font, glyphRun);

            Assertions.ApproximatelyEqual(width, 25, 0.01);
        }