diff --git a/src/SixLabors.Fonts/TextLayout.cs b/src/SixLabors.Fonts/TextLayout.cs index 06889fc7..4985f184 100644 --- a/src/SixLabors.Fonts/TextLayout.cs +++ b/src/SixLabors.Fonts/TextLayout.cs @@ -1396,7 +1396,7 @@ private void TrimTrailingWhitespaceAndRecalculateMetrics() index--; } - if (index < this.data.Count) + if (index < this.data.Count && index != 0) { this.data.RemoveRange(index, this.data.Count - index); } diff --git a/tests/SixLabors.Fonts.Tests/Issues/Issues_400.cs b/tests/SixLabors.Fonts.Tests/Issues/Issues_400.cs new file mode 100644 index 00000000..12f61e8e --- /dev/null +++ b/tests/SixLabors.Fonts.Tests/Issues/Issues_400.cs @@ -0,0 +1,25 @@ +// Copyright (c) Six Labors. +// Licensed under the Six Labors Split License. + +namespace SixLabors.Fonts.Tests.Issues; +public class Issues_400 +{ + [Fact] + public void RenderingTextIncludesAllGlyphs() + { +#if OS_WINDOWS + + TextOptions options = new(new Font(SystemFonts.Get("Arial"), 16 * 2)) + { + WrappingLength = 1900 + }; + + const string content = """ + NEWS_CATEGORY=EWF&NEWS_HASH=4b298ff9277ef9fdf515356be95ea3caf57cd36&OFFSET=0&SEARCH_VALUE=CA88105E1088&ID_NEWS + """; + + int lineCount = TextMeasurer.CountLines(content, options); + Assert.Equal(2, lineCount); +#endif + } +} diff --git a/tests/SixLabors.Fonts.Tests/SixLabors.Fonts.Tests.csproj b/tests/SixLabors.Fonts.Tests/SixLabors.Fonts.Tests.csproj index 0b0d6afa..2014f031 100644 --- a/tests/SixLabors.Fonts.Tests/SixLabors.Fonts.Tests.csproj +++ b/tests/SixLabors.Fonts.Tests/SixLabors.Fonts.Tests.csproj @@ -3,6 +3,7 @@ True AnyCPU;x64;x86 + 11