-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #433 from SixLabors/js/fix-line-break
Do not insert mandatory break when line is broken by wrapping.
- Loading branch information
Showing
2 changed files
with
54 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Six Labors Split License. | ||
|
||
using System.Numerics; | ||
|
||
namespace SixLabors.Fonts.Tests.Issues; | ||
|
||
public class Issues_431 | ||
{ | ||
[Fact] | ||
public void ShouldNotInsertExtraLineBreaks() | ||
{ | ||
if (SystemFonts.TryGet("Arial", out FontFamily family)) | ||
{ | ||
Font font = family.CreateFont(60); | ||
const string text = "- Lorem ipsullll\ndolor sit amet\n-consectetur elit"; | ||
|
||
TextOptions options = new(font) | ||
{ | ||
Origin = new Vector2(50, 20), | ||
WrappingLength = 400, | ||
}; | ||
|
||
int lineCount = TextMeasurer.CountLines(text, options); | ||
Assert.Equal(4, lineCount); | ||
|
||
IReadOnlyList<GlyphLayout> layout = TextLayout.GenerateLayout(text, options); | ||
Assert.Equal(46, layout.Count); | ||
} | ||
} | ||
} |