-
-
Notifications
You must be signed in to change notification settings - Fork 74
Fix #448 and #450 #454
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
Fix #448 and #450 #454
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes issues #448 and #450 by updating the line break logic and adding test coverage for numeric text and specific issues.
- Added new tests in NumericTests, Issues_450, and Issues_448 to validate line break handling.
- Updated LB25 handling and URL break prevention in the LineBreakEnumerator and TextLayout logic.
Reviewed Changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
File | Description |
---|---|
tests/SixLabors.Fonts.Tests/Unicode/LineBreakEnumeratorTests.cs | Added NumericTests for improved line break validation. |
tests/SixLabors.Fonts.Tests/Issues/Issues_450.cs | Added test case covering behavior outlined in issue #450. |
tests/SixLabors.Fonts.Tests/Issues/Issues_448.cs | Added test case for issue #448. |
src/SixLabors.Fonts/Unicode/LineBreakEnumerator.cs | Adjusted LB25 handling to improve numeric cases in line breaking. |
src/SixLabors.Fonts/TextLayout.cs | Updated text layout logic to prevent breaking URLs. |
Files not reviewed (2)
- tests/Images/ReferenceOutput/Issue_448__WrappingLength_150_.png: Language not supported
- tests/Images/ReferenceOutput/Issue_450__WrappingLength_960_.png: Language not supported
List<LineBreak> breaks2 = new(); | ||
foreach (LineBreak lineBreak in new LineBreakEnumerator(text2.AsSpan())) | ||
breaks2.Add(lineBreak); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears there is an extra closing bracket in the NumericTests method that does not correspond to an opening block. Consider removing this bracket to ensure correct test structure.
} |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes bugs reported in issues #448 and #450 by adding new tests and refining the line break logic.
- Added NumericTests to validate line break positions.
- Introduced dedicated test classes for issues 448 and 450.
- Updated LineBreakEnumerator and TextLayout to handle specific cases such as URL-related solidus handling.
Reviewed Changes
Copilot reviewed 5 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tests/SixLabors.Fonts.Tests/Unicode/LineBreakEnumeratorTests.cs | Added NumericTests to validate line break positions. |
tests/SixLabors.Fonts.Tests/Issues/Issues_450.cs | Introduced a test for issue #450. |
tests/SixLabors.Fonts.Tests/Issues/Issues_448.cs | Introduced a test for issue #448. |
src/SixLabors.Fonts/Unicode/LineBreakEnumerator.cs | Refactored LB25 logic with a switch-case for finer control. |
src/SixLabors.Fonts/TextLayout.cs | Added a URL handling check before adding line breaks. |
Files not reviewed (2)
- tests/Images/ReferenceOutput/Issue_448__WrappingLength_150_.png: Language not supported
- tests/Images/ReferenceOutput/Issue_450__WrappingLength_960_.png: Language not supported
Comments suppressed due to low confidence (2)
src/SixLabors.Fonts/Unicode/LineBreakEnumerator.cs:350
- [nitpick] Consider renaming 'lb25ex' to a more descriptive name (e.g. 'applyLb25Exception') so its purpose in the LB25 rule handling is clearer.
if (this.lb25ex)
src/SixLabors.Fonts/TextLayout.cs:1192
- [nitpick] The variable 'i' could be renamed to a more descriptive identifier such as 'position' to improve code clarity.
int i = current.PositionMeasure;
Prerequisites
Description
Fix #448 and #450