-
-
Notifications
You must be signed in to change notification settings - Fork 809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
text: Fix layout measurements #18332
Merged
Merged
Conversation
This file contains 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
kjarosh
added
text
Issues relating to text rendering/input
A-core
Area: Core player, where no other category fits
T-fix
Type: Bug fix (in something that's supposed to work already)
labels
Oct 20, 2024
kjarosh
force-pushed
the
text-layout-measurements
branch
2 times, most recently
from
October 20, 2024 21:12
9019b83
to
a2326d8
Compare
kjarosh
force-pushed
the
text-layout-measurements
branch
2 times, most recently
from
October 20, 2024 21:34
b0d251c
to
a0e448e
Compare
After this PR I was able to make epsilons smaller in 7 tests, and remove approximations altogether in 5 tests 🎉 |
kjarosh
force-pushed
the
text-layout-measurements
branch
from
October 21, 2024 09:39
25f8ce6
to
2b84813
Compare
Dinnerbone
approved these changes
Oct 21, 2024
This effectively changes nothing, as text exterior bounds are used only for size measurement, but it makes their debug boxes render in a proper position.
These two methods were doing almost the same thing, no need to duplicate code.
This patch fixes various measurements made during laying out text. 1. After laying out a line, the cursor should be advanced by the value of `ascent + descent + leading`, not `font_size + font_leading + leading`. 2. Font leading is ignored. 3. Proper line bounds (not interior bounds) are now used for calculating exterior text bounds. Additionally, it updates the following tests, as their output now is more similar to the output produced by the Flash Player: 1. avm2/away3d_advanced_shallow_water_demo 2. visual/definefont4 3. visual/fonts/device-font 4. visual/shumway_acid_tests/acid 5. visual/shumway_acid_tests/acid_text
This test verifies how the test height is calculated in relation to leading.
This test verifies how FP renders text when the font has leading and it's a device font.
This test verifies how FP renders text when the font has leading and it's an embedded font.
This test verifies how FP renders text when the font has leading, dependeing on different DefineFont tags used.
Some of epsilons now can be smaller!
Ruffle now produces the exact same output as FP in these tests!
kjarosh
force-pushed
the
text-layout-measurements
branch
from
October 22, 2024 07:48
2b84813
to
6246e35
Compare
This was referenced Oct 23, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-core
Area: Core player, where no other category fits
newsworthy
T-fix
Type: Bug fix (in something that's supposed to work already)
text
Issues relating to text rendering/input
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.
This patch fixes various measurements made during laying out text.
After laying out a line, the cursor should be advanced by the value of
ascent + descent + leading
, notfont_size + font_leading + leading
.Font leading is ignored.
Proper line bounds (not interior bounds) are now used for calculating exterior text bounds.
Additionally, it updates the following tests, as their output now is more similar to the output produced by the Flash Player:
avm2/away3d_advanced_shallow_water_demo
visual/definefont4
visual/fonts/device-font
visual/shumway_acid_tests/acid
visual/shumway_acid_tests/acid_text
In general, this PR should make a lot of text look so much better, especially multiline text fields.