Exemplo n.º 1
0
        public static void RenderText(RendererOptions font, string text)
        {
            GlyphBuilder builder  = new GlyphBuilder();
            TextRenderer renderer = new TextRenderer(builder);

            Primitives.SizeF size = TextMeasurer.Measure(text, font);
            renderer.RenderText(text, font);

            builder.Paths
            .SaveImage((int)size.Width + 20, (int)size.Height + 20, font.Font.Name, text + ".png");
        }
Exemplo n.º 2
0
        public void ThrowsMeasureingWhitespace()
        {
            // wendy one returns wrong points for 'o'
            Font font = new FontCollection().Install(TestFonts.WendyOneFile).CreateFont(12);

            var r = new GlyphRenderer();

            Primitives.SizeF size = TextMeasurer.MeasureBounds("          ", new RendererOptions(new Font(font, 30), 72)).Size;

            Assert.Equal(60, size.Width, 1);
            Assert.Equal(31.6, size.Height, 1);
        }