Closed lanwin closed 2 months ago
Yes I have:
at System.ThrowHelper.ThrowArgumentOutOfRange_IndexMustBeLessException()
at System.Collections.Generic.List`1.get_Item(Int32 index)
at SixLabors.Fonts.TextLayout.TextLine.BidiReOrder()
at SixLabors.Fonts.TextLayout.BreakLines(ReadOnlySpan`1 text, TextOptions options, BidiRun[] bidiRuns, Dictionary`2 bidiMap, GlyphPositioningCollection positionings, LayoutMode layoutMode)
at SixLabors.Fonts.TextLayout.ProcessText(ReadOnlySpan`1 text, TextOptions options)
at SixLabors.Fonts.TextLayout.GenerateLayout(ReadOnlySpan`1 text, TextOptions options)
at SixLabors.Fonts.TextRenderer.RenderText(ReadOnlySpan`1 text, TextOptions options)
at SixLabors.Fonts.TextRenderer.RenderText(String text, TextOptions options)
at SixLabors.ImageSharp.Drawing.TextBuilder.GenerateGlyphs(String text, TextOptions textOptions)
As the Stacktrace points to an issue at the Fonts layer I've moved the issue over here to the Fonts repo.
Finally got some time to look at this and the issue is obvious enough. We were incorrectly stripping the data from the entire leading line worth of whitespace. PR opened.
Prerequisites
DEBUG
andRELEASE
modeImageSharp version
3.1.4
Other ImageSharp packages and versions
Fonts 2.0.3, Drawing 2.1.3
Environment (Operating system, version and so on)
Windows 11
.NET Framework version
NET7
Description
I found a text that lets TextBuilder.GenerateGlyphs crash with an ArgumentOutOfRangeException. I stripped down the text to only contain the problematic part.
It seems this is a BUG cause I would not expect GenerateGlyphs to fail with any exception.
Steps to Reproduce
Images
No response