Ejemplo n.º 1
0
        /// <summary>
        /// Renders the text.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="options">The style.</param>
        public void RenderText(string text, RendererOptions options)
        {
            ImmutableArray <GlyphLayout> glyphsToRender = this.layoutEngine.GenerateLayout(text, options);

            var dpi = new Vector2(options.DpiX, options.DpiY);

            RectangleF rect = TextMeasurer.GetBounds(glyphsToRender, dpi);

            this.renderer.BeginText(rect);

            foreach (GlyphLayout g in glyphsToRender.Where(x => !x.IsWhiteSpace))
            {
                g.Glyph.RenderTo(this.renderer, g.Location, options.DpiX, options.DpiY, g.LineHeight);
            }

            this.renderer.EndText();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Renders the text.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="options">The style.</param>
        public void RenderText(ReadOnlySpan <char> text, TextOptions options)
        {
            IReadOnlyList <GlyphLayout> glyphsToRender = this.layoutEngine.GenerateLayout(text, options);
            FontRectangle rect = TextMeasurer.GetBounds(glyphsToRender, options.Dpi);

            this.renderer.BeginText(rect);

            foreach (GlyphLayout g in glyphsToRender)
            {
                if (g.IsWhiteSpace())
                {
                    continue;
                }

                g.Glyph.RenderTo(this.renderer, g.Location, options);
            }

            this.renderer.EndText();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Renders the text.
        /// </summary>
        /// <param name="text">The text.</param>
        /// <param name="options">The style.</param>
        public void RenderText(ReadOnlySpan <char> text, RendererOptions options)
        {
            IReadOnlyList <GlyphLayout> glyphsToRender = this.layoutEngine.GenerateLayout(text, options);

            Vector2 dpi = new Vector2(options.DpiX, options.DpiY);

            RectangleF rect = TextMeasurer.GetBounds(glyphsToRender, dpi);

            this.renderer.BeginText(rect);

            foreach (GlyphLayout g in glyphsToRender)
            {
                if (g.IsWhiteSpace)
                {
                    continue;
                }

                g.Glyph.RenderTo(this.renderer, g.Location, options.DpiX, options.DpiY, g.LineHeight);
            }

            this.renderer.EndText();
        }