示例#1
0
        protected override void BeforeImageApply()
        {
            base.BeforeImageApply();

            // do everything at the image level as we are delegating the processing down to other processors
            var style = new RendererOptions(this.Font, this.Options.TextOptions.DpiX, this.Options.TextOptions.DpiY, this.Location)
            {
                ApplyKerning         = this.Options.TextOptions.ApplyKerning,
                TabWidth             = this.Options.TextOptions.TabWidth,
                WrappingWidth        = this.Options.TextOptions.WrapTextWidth,
                HorizontalAlignment  = this.Options.TextOptions.HorizontalAlignment,
                VerticalAlignment    = this.Options.TextOptions.VerticalAlignment,
                LineSpacing          = this.Options.TextOptions.LineSpacing,
                FallbackFontFamilies = this.Options.TextOptions.FallbackFonts,
                ColorFontSupport     = this.definition.Options.TextOptions.RenderColorFonts ? ColorFontSupport.MicrosoftColrFormat : ColorFontSupport.None,
            };

            this.textRenderer = new CachingGlyphRenderer(
                this.Configuration.MemoryAllocator,
                this.Text.Length,
                this.Pen,
                this.Brush != null)
            {
                Options = this.Options
            };

            var renderer = new TextRenderer(this.textRenderer);

            renderer.RenderText(this.Text, style);
        }
示例#2
0
        protected override void BeforeImageApply(Image <TPixel> source, Rectangle sourceRectangle)
        {
            base.BeforeImageApply(source, sourceRectangle);

            // do everythign at the image level as we are deligating the processing down to other processors
            var style = new RendererOptions(this.Font, this.Options.DpiX, this.Options.DpiY, this.Location)
            {
                ApplyKerning        = this.Options.ApplyKerning,
                TabWidth            = this.Options.TabWidth,
                WrappingWidth       = this.Options.WrapTextWidth,
                HorizontalAlignment = this.Options.HorizontalAlignment,
                VerticalAlignment   = this.Options.VerticalAlignment
            };

            this.textRenderer         = new CachingGlyphRenderer(source.GetMemoryAllocator(), this.Text.Length, this.Pen, this.Brush != null);
            this.textRenderer.Options = (GraphicsOptions)this.Options;
            TextRenderer.RenderTextTo(this.textRenderer, this.Text, style);
        }
        protected override void BeforeImageApply()
        {
            base.BeforeImageApply();

            // do everything at the image level as we are delegating the processing down to other processors
            var style = new RendererOptions(this.Font, this.Options.DpiX, this.Options.DpiY, this.Location)
            {
                ApplyKerning        = this.Options.ApplyKerning,
                TabWidth            = this.Options.TabWidth,
                WrappingWidth       = this.Options.WrapTextWidth,
                HorizontalAlignment = this.Options.HorizontalAlignment,
                VerticalAlignment   = this.Options.VerticalAlignment
            };

            this.textRenderer         = new CachingGlyphRenderer(this.Configuration.MemoryAllocator, this.Text.Length, this.Pen, this.Brush != null);
            this.textRenderer.Options = (GraphicsOptions)this.Options;
            var renderer = new TextRenderer(this.textRenderer);

            renderer.RenderText(this.Text, style);
        }
示例#4
0
 protected override void AfterImageApply(Image <TPixel> source, Rectangle sourceRectangle)
 {
     base.AfterImageApply(source, sourceRectangle);
     this.textRenderer?.Dispose();
     this.textRenderer = null;
 }
 protected override void AfterImageApply()
 {
     base.AfterImageApply();
     this.textRenderer?.Dispose();
     this.textRenderer = null;
 }