Skip to content

Fix Vertical Layout with Custom LineSpacing#500

Merged
JimBobSquarePants merged 2 commits intomainfrom
js/linemetrics
Mar 2, 2026
Merged

Fix Vertical Layout with Custom LineSpacing#500
JimBobSquarePants merged 2 commits intomainfrom
js/linemetrics

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

This pull request updates the vertical text layout logic in TextLayout.cs to improve glyph alignment and positioning, particularly when handling line heights and spacing. The changes focus on using unscaled line heights for more accurate centering and resetting horizontal positions more reliably at grapheme boundaries.

Glyph alignment and centering improvements:

  • Changed centering calculations in both LayoutLineVertical and LayoutLineVerticalMixed to use unscaledLineHeight instead of scaledMaxLineHeight, resulting in more consistent glyph alignment across different font metrics. [1] [2] [3] [4]

Position reset and state management:

  • Introduced lineOriginX to reliably reset boxLocation.X and penLocation.X at grapheme boundaries, ensuring horizontal positions are correctly restored for each new line or grapheme. [1] [2]

@codecov
Copy link

codecov bot commented Mar 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83%. Comparing base (80a0d61) to head (cf8b302).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #500   +/-   ##
=====================================
  Coverage     83%     83%           
=====================================
  Files        274     274           
  Lines      19184   19184           
  Branches    2719    2719           
=====================================
  Hits       16081   16081           
  Misses      2426    2426           
  Partials     677     677           
Flag Coverage Δ
unittests 83% <100%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@JimBobSquarePants JimBobSquarePants merged commit 8d3c065 into main Mar 2, 2026
10 checks passed
@JimBobSquarePants JimBobSquarePants deleted the js/linemetrics branch March 2, 2026 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant