diff --git a/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj b/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj index 259ae4b0f..8ba0cbdd0 100644 --- a/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj +++ b/src/ImageSharp.Drawing/ImageSharp.Drawing.csproj @@ -39,7 +39,7 @@ All - + diff --git a/src/ImageSharp.Drawing/Text/DrawText.cs b/src/ImageSharp.Drawing/Text/DrawText.cs index 1f5f4cdb1..eba11b5c5 100644 --- a/src/ImageSharp.Drawing/Text/DrawText.cs +++ b/src/ImageSharp.Drawing/Text/DrawText.cs @@ -177,13 +177,14 @@ namespace ImageSharp dpi = new Vector2((float)source.MetaData.HorizontalResolution, (float)source.MetaData.VerticalResolution); } - FontSpan style = new FontSpan(font) + FontSpan style = new FontSpan(font, dpi) { ApplyKerning = options.ApplyKerning, - TabWidth = options.TabWidth + TabWidth = options.TabWidth, + WrappingWidth = options.WrapTextWidth }; - renderer.RenderText(text, style, dpi); + renderer.RenderText(text, style); System.Collections.Generic.IEnumerable shapesToDraw = glyphBuilder.Paths; diff --git a/src/ImageSharp.Drawing/Text/TextGraphicsOptions.cs b/src/ImageSharp.Drawing/Text/TextGraphicsOptions.cs index b58a40b34..6b09f2395 100644 --- a/src/ImageSharp.Drawing/Text/TextGraphicsOptions.cs +++ b/src/ImageSharp.Drawing/Text/TextGraphicsOptions.cs @@ -41,6 +41,11 @@ namespace ImageSharp.Drawing /// public bool UseImageResolution; + /// + /// If greater than zero determine the width at which text should wrap. + /// + public float WrapTextWidth; + /// /// Initializes a new instance of the struct. /// @@ -52,6 +57,7 @@ namespace ImageSharp.Drawing this.TabWidth = 4; this.AntialiasSubpixelDepth = 16; this.UseImageResolution = false; + this.WrapTextWidth = 0; } ///