Prerequisites
ImageSharp.Drawing version
3.0.0
Other ImageSharp packages and versions
4.0.0
Environment (Operating system, version and so on)
Windows 11
.NET Framework version
.NET 10.0
Description
When rendering a text that contains underline and tracking, the underline is not well rendered. It applies the underline on every glyph but not on the actual tracking between the glyphs.
ImageSharp:

Chrome with css:

Steps to Reproduce
usingSixLabors.Fonts;usingSixLabors.ImageSharp;usingSixLabors.ImageSharp.Drawing.Processing;usingSixLabors.ImageSharp.PixelFormats;usingSixLabors.ImageSharp.Processing;varfontCollection=newFontCollection();fontCollection.AddSystemFonts();varfontFamily=fontCollection.Get("Arial");varfont=fontFamily.CreateFont(24);vartext="Hello World!";vartextOptions=newRichTextOptions(font){Tracking=2,TextRuns=newList<RichTextRun>{new(){Start=0,End=text.Length,TextDecorations=TextDecorations.Underline},},};varimg=newImage<Rgba32>(800,200);img.Mutate(ctx =>{ctx.BackgroundColor(Color.White);ctx.Paint(c =>{c.DrawText(textOptions,text,Brushes.Solid(Color.Black),null);});});img.Save("render.png");In web browser (Chrome):
<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><title>ImageSharp Tracking Underline Repro</title><style>
.tracking {
letter-spacing:2em;
font-family: Arial, Helvetica, sans-serif;
text-decoration: underline;
}
</style></head><body><pclass="tracking">Hello World !</p></body></html>Images
No response
Prerequisites
DEBUGandRELEASEmodeImageSharp.Drawing version
3.0.0
Other ImageSharp packages and versions
4.0.0
Environment (Operating system, version and so on)
Windows 11
.NET Framework version
.NET 10.0
Description
When rendering a text that contains underline and tracking, the underline is not well rendered. It applies the underline on every glyph but not on the actual tracking between the glyphs.
ImageSharp:

Chrome with css:

Steps to Reproduce
In web browser (Chrome):
Images
No response