Repository navigation
fix(engine-render): include italic overhang in measured text width - #7782
Open
ceedot-rock wants to merge 2 commits into
Open
ceedot-rock wants to merge 2 commits into
ceedot-rock wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #7782 +/- ##
==========================================
+ Coverage 81.08% 81.15% +0.06%
==========================================
Files 3059 3059
Lines 198216 198342 +126
Branches 50799 51091 +292
==========================================
+ Hits 160719 160955 +236
+ Misses 37437 37327 -110
Partials 60 60 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Author
|
Bump — one-line fix: italic overhang was missing from measured text width. Happy to add a test if you'd like one. |
Italic glyphs slant past their advance width, so the ink extends beyond measureText().width on the right. Right-aligned (or centered) text positioned by the advance width had its overhang clipped by the cell boundary, hiding part of the value. FontCache.getMeasureText now captures actualBoundingBoxLeft/Right and extends the measured width to the ink's right edge for italic fonts, so alignment accounts for the overhang. Existing measure-cache tests updated for the new fields; regression test added. Fixes dream-num#7658
… cache The italic-overhang fix added actualBoundingBoxLeft/Right to IMeasureTextCache; the docs package's font-loader spec mock was still building the old shape and failed typecheck. Adds the two fields to the mock (right edge = advance width, matching the test's upright glyph).
ceedot-rock
force-pushed
the
fix/italic-overhang-clipping
branch
from
October 4, 2026 15:24
1dd96b7 to
751ffc0
Compare
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Right-aligned (or centered) italic cell text had its rightmost glyphs clipped by the cell boundary (e.g. Tahoma italic).
Root cause
Canvas
measureText().widthreturns the advance width, which doesn't include the italic overhang — slanted glyphs extend past it on the right. The document layout positioned lines by the advance width, so the overhang ink spilled past the clip edge.Changes
FontCache.getMeasureTextnow capturesactualBoundingBoxLeft/actualBoundingBoxRightin the measure cache (IMeasureTextCacheextended).max(width, actualBoundingBoxRight)), so alignment accounts for the overhang. Non-italic measurement is unchanged.Testing
font-cache.spec.ts: italic width extends to the ink edge, upright width unchanged.tsc --noEmitonengine-render: clean.Fixes #7658
Slid Phi Labs accepts donations to keep the lab independent.