Skip to content

Conversation

@JimBobSquarePants
Copy link
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Fix #448 and #450

Copy link

Copilot AI left a 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);
}
Copy link

Copilot AI Apr 22, 2025

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.

Suggested change
}

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI left a 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;

@JimBobSquarePants JimBobSquarePants merged commit 95e5d75 into main Apr 22, 2025
8 checks passed
@JimBobSquarePants JimBobSquarePants deleted the js/additional-linebreak-fixes branch April 22, 2025 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

3 participants