Repository navigation
Keep the measured pixel size of text nodes when rounding to the pixel grid - #2040
Merged
cortinico merged 1 commit intoOct 15, 2026
Merged
Conversation
… grid When a text node's scaled size is a whole number of pixels, use that pixel count as its rounded size instead of the difference of its two rounded edges. The 0.0001 snap tolerance could snap one edge to a pixel and floor the other, which made the node one pixel smaller than its measured size and truncated its text.
intergalacticspacehighway
marked this pull request as ready for review
October 15, 2026 05:48
cortinico
approved these changes
Oct 15, 2026
cortinico
left a comment
Contributor
There was a problem hiding this comment.
LGTM 👍 thanks for adding the regression tests
stleamist
added a commit
to stleamist/FlexLayout
that referenced
this pull request
Oct 19, 2026
Pin Swift Package Manager to Yoga main commit 52f6d0bd3824296b8e852cb4fcdf3b9821ab2aa5, which includes react/yoga#2040. Support both float and YGValue gap getters while retaining CocoaPods compatibility with Yoga 3.2.1. Mark the version-specific overloads maybe_unused for warning-as-error builds and cover point gap getters and layout with tests. Select a simulator available with CI's Xcode 16.4 via an overridable device name.
stleamist
added a commit
to stleamist/FlexLayout
that referenced
this pull request
Oct 19, 2026
Pin Swift Package Manager to Yoga main commit 52f6d0bd3824296b8e852cb4fcdf3b9821ab2aa5, which includes react/yoga#2040. Support both float and YGValue gap getters while retaining CocoaPods compatibility with Yoga 3.2.1. Mark the version-specific overloads maybe_unused for warning-as-error builds and cover point gap getters and layout with tests. Select a simulator available with CI's Xcode 16.4 via an overridable device name.
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.
Fixes #1975
Fixes #749
Thanks @stleamist for the analysis and the reproduction in #1975.
Issue
The issue happens when a text node's rounded layout size is smaller than its measured size.
Example:
absoluteNodeLeft = 490.999923px
nodeWidth = 163.999968px
absoluteNodeRight = 490.999923px + 163.999968px = 654.999891px
The layout dimension width is set with the code below:
absoluteNodeRight(654.999891) is outside the0.0001threshold of655, so it gets floored to654.absoluteNodeLeft(490.999923) is within the0.0001threshold of491, so it gets rounded to491.The size becomes 654 - 491 =
163. The measured size was164, so the text gets truncated.Solution
When a text node's size is a whole number of pixels, set the layout dimension to
round(scaledNodeWidth) / pointScaleFactor(in points).Fix tested in the original repro #1975 (comment)
Unrelated
Fixed the
scaledNodeWithvariable name typo.