Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have verified that I am running the latest version of Fonts
- I have verified if the problem exist in both
DEBUG
andRELEASE
mode - I have searched open and closed issues to ensure it has not already been reported
Fonts version
2.0.9
Other Six Labors packages and versions
SixLabors.ImageSharp 3.1.6, SixLabors.ImageSharp.Drawing 2.1.5
Environment (Operating system, version and so on)
Windows 10
.NET Framework version
.NET 9
Description
After fixes to line wrapping 2.0.8 and 2.0.9, I've noticed a regression in a particular test of mine (see steps to reproduce for the program). This works as expected with 2.0.7.
Steps to Reproduce
using System.Numerics;
using SixLabors.ImageSharp;
using SixLabors.ImageSharp.Drawing.Processing;
using SixLabors.ImageSharp.PixelFormats;
using SixLabors.ImageSharp.Processing;
using SixLabors.Fonts;
namespace TextRunTest;
internal class Program {
static void Main(string[] args) {
Console.WriteLine("Rendering test images...");
test3();
Console.WriteLine("Done.");
}
private static void test3() {
var fontManager = new FontManager();
Image imgTest1 = new Image<Rgba32>(1100, 500, Color.White);
imgTest1.Mutate(x =>
x.DrawText(
new RichTextOptions(fontManager.GetFont("Arial", 80, FontStyle.Regular)) {
Origin = new Vector2(50, 20),
WrappingLength = 800,
},
"What connects the following: x",
Color.Black
)
);
imgTest1.SaveAsPng("c:/development/diff/testImg1.png");
// ^ correct in 2.0.9
Image imgTest2 = new Image<Rgba32>(1100, 500, Color.White);
imgTest2.Mutate(x =>
x.DrawText(
new RichTextOptions(fontManager.GetFont("Arial", 80, FontStyle.Regular)) {
Origin = new Vector2(50, 20),
WrappingLength = 800,
},
"What connects the following:\nx",
Color.Black
)
);
imgTest2.SaveAsPng("c:/development/diff/testImg2.png");
// ^ incorrect in 2.0.9; does not wrap "following:"
}
}