Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure only trailing whitespace is trimmed. #407

Merged
merged 1 commit into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/SixLabors.Fonts/TextLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
25 changes: 25 additions & 0 deletions tests/SixLabors.Fonts.Tests/Issues/Issues_400.cs
Original file line number Diff line number Diff line change
@@ -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
}
}
1 change: 1 addition & 0 deletions tests/SixLabors.Fonts.Tests/SixLabors.Fonts.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<DebugSymbols>True</DebugSymbols>
<Platforms>AnyCPU;x64;x86</Platforms>
<LangVersion>11</LangVersion>
</PropertyGroup>

<PropertyGroup>
Expand Down
Loading