-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Do not use ideographic baseline for RenderPargraph baseline #35493
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
Conversation
justinmc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Very thorough explanation of the problem!
|
|
||
| await tester.tap(find.byKey(targetKey)); | ||
| await tester.pump(); | ||
| await tester.pump(const Duration(seconds: 1)); // finish the menu animation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does pumpAndSettle not work here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either way I would think you can get rid of the previous empty pump().
| Offset bottomLeft = tester.getBottomLeft(find.text('hello, world')); | ||
| Offset bottomRight = tester.getBottomRight(find.text('hello, world')); | ||
|
|
||
| expect(topLeft, Offset(392.0, 298.3999996185303)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Watch out for this failing in Cirrus. Sometimes I have to fuzzy match things like this, but hopefully it just works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may have to disable this test on mac/windows, as those platforms read fonts slightly differently. I'll see how cirrus handles it before doing that though!
|
|
||
| await tester.tap(find.byKey(targetKey)); | ||
| await tester.pump(); | ||
| await tester.pump(const Duration(seconds: 1)); // finish the menu animation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See previous comment about pumpAndSettle.
| expect(topRight, const Offset(477.0, 346.3999996185303)); | ||
| expect(bottomLeft, const Offset(392.0, 363.3999996185303)); | ||
| expect(bottomRight, const Offset(477.0, 363.3999996185303)); | ||
| }, skip: !isLinux); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any way we can make the tests pass on all platforms?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not easily, since each platform reads the fonts differently depending on if it is using Coretext or OpenType.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also the reason why, we only run libtxt unit tests on linux.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add at least a comment describing that?
* commit 'a0c47e2216a2b50b70c478001cf5652f31a783af': (187 commits) Do not use ideographic baseline for RenderPargraph baseline (flutter#35493) Add type to StreamChannel in generated test code. (flutter#35367) Fix RenderFittedBox when child.size.isEmpty (flutter#35487) add APK build time benchmarks (flutter#35481) fix Selection handles position is off (flutter#34665) Move usage flutter create tests into memory filesystem. (flutter#35160) Include tags in SemanticsNode debug properties (flutter#35491) Re-apply 'Add currentSystemFrameTimeStamp to SchedulerBinding' (flutter#35492) CupertinoTextField vertical alignment (flutter#34723) Mark update-packages as non-experimental (flutter#35467) fix default artifacts to exclude ios and android (flutter#35303) Roll engine ffba2f6..7d3e722 (59 commits) (flutter#35489) Update macrobenchmarks README and app name (flutter#35477) mark windows and macos chrome dev mode as flaky (flutter#35495) Use the new service protocol message names (flutter#35482) Manual roll of engine 45b66b7...ffba2f6 (flutter#35464) more ui-as-code (flutter#35393) update reassemble doc (flutter#35164) New parameter for RawGestureDetector to customize semantics mapping (flutter#33936) Add --target support for Windows and Linux (flutter#34660) ...
Description
#25782 Has found that using the ideographic baseline for CJK results in improper vertical centering of text. The root cause of this is that the ideographic baseline implementation in LibTxt is currently only an approximation (an existing TODO specifies fixing this), and should not be used for sensitive purposes.
Here, we override the baseline parameter and always use TextBaseline.alphabtic since it produces a much more accurate and reasonable baseline for most CJK fonts.
The long term solution is to fully support other baselines and provide accurate values for them.
Related Issues
#25782
Tests
Verify that the position of the text is as expected in a popupmenu.
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?