-
-
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.
- Loading branch information
1 parent
476c5f3
commit 7c23ae8
Showing
5 changed files
with
38 additions
and
1 deletion.
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
Binary file not shown.
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,29 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Six Labors Split License. | ||
|
||
namespace SixLabors.Fonts.Tests.Issues; | ||
public class Issues_367 | ||
{ | ||
[Fact] | ||
public void ShouldMatchBrowserBreak() | ||
{ | ||
Font font = new FontCollection().Add(TestFonts.CourierPrimeFile).CreateFont(12); | ||
|
||
TextOptions options = new(font) | ||
{ | ||
Dpi = 96f // 1in = 96px | ||
}; | ||
|
||
const float wrappingLengthInInches = 3.875f; | ||
options.WrappingLength = wrappingLengthInInches * options.Dpi; | ||
|
||
const string text = "Leer, but lonesome has fussin' change a faith. Themself seen and four trample."; | ||
int lineCount = TextMeasurer.CountLines(text, options); | ||
|
||
Assert.Equal(3, lineCount); | ||
|
||
FontRectangle advance = TextMeasurer.MeasureAdvance(text, options); | ||
Assert.Equal(365, advance.Width); | ||
Assert.Equal(48, advance.Height); | ||
} | ||
} |
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