-
-
Notifications
You must be signed in to change notification settings - Fork 71
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 #303 from SixLabors/js/issue-302
Fix out of range exception in typographic utils.
- Loading branch information
Showing
7 changed files
with
90 additions
and
18 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
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,35 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
using System; | ||
using Xunit; | ||
|
||
namespace SixLabors.Fonts.Tests.Issues | ||
{ | ||
public class Issues_298 | ||
{ | ||
[Fact] | ||
public void DoesNotThrowOutOfBounds() | ||
{ | ||
const string content = "Please enter the text"; | ||
|
||
FontCollection fontFamilies = new(); | ||
|
||
FontFamily fontFamily = fontFamilies.Add(TestFonts.Issues.Issue298File); | ||
|
||
Font font = fontFamily.CreateFont(16, FontStyle.Regular); | ||
|
||
TextOptions renderOptions = new(font) | ||
{ | ||
Dpi = 96, | ||
WrappingLength = 0f, | ||
VerticalAlignment = VerticalAlignment.Top, | ||
HorizontalAlignment = HorizontalAlignment.Left, | ||
KerningMode = KerningMode.Auto | ||
}; | ||
|
||
FontRectangle bounds = TextMeasurer.Measure(content.AsSpan(), renderOptions); | ||
Assert.NotEqual(default, bounds); | ||
} | ||
} | ||
} |
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,23 @@ | ||
// Copyright (c) Six Labors. | ||
// Licensed under the Apache License, Version 2.0. | ||
|
||
using Xunit; | ||
|
||
namespace SixLabors.Fonts.Tests.Issues | ||
{ | ||
public class Issues_302 | ||
{ | ||
#if OS_WINDOWS | ||
[Fact] | ||
public void DoesNotThrowOutOfBounds() | ||
{ | ||
const string content = "فِيلْمٌ"; | ||
FontFamily fontFamily = SystemFonts.Get("Arial"); | ||
Font font = fontFamily.CreateFont(16, FontStyle.Regular); | ||
TextOptions renderOptions = new(font); | ||
|
||
Assert.True(TextMeasurer.TryMeasureCharacterBounds(content, renderOptions, out GlyphBounds[] _)); | ||
} | ||
#endif | ||
} | ||
} |
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