Repository navigation
Fix actualBoundingBox metrics being clamped to the text origin - #2631
Open
florianaltendorfer wants to merge 1 commit into
Open
florianaltendorfer wants to merge 1 commit into
florianaltendorfer wants to merge 1 commit into
Conversation
florianaltendorfer
force-pushed
the
bounty-2620
branch
from
November 13, 2026 01:48
05db2a6 to
ac24959
Compare
florianaltendorfer
force-pushed
the
bounty-2620
branch
from
November 14, 2026 01:00
ac24959 to
92642e4
Compare
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.
Closes #2620.
On master (4.0.0-rc3) the sign of
actualBoundingBoxLeftfrom the report is already correct, butMeasureTextstarted the ink box min/max at 0, so the box always included the pen origin. Ink that starts right of the origin (W,aaaa,-) gaveactualBoundingBoxLeft0 instead of a negative value, and the same clamp applied to right, ascent and descent (-reported descent 0 instead of a negative value). The box now starts from the first glyph that has ink, using thefirstflag that was already declared there, and glyphs without ink such as spaces are skipped so a leading space doesn't put the origin back in the box.Tested with a new case in
test/canvas.test.js(fails before, passes after), the existing measureText tests, and by comparing measureText against the ink scanned from fillText output for the strings in the issue with left and right alignment.