Repository navigation
Conversation
Visual regressionNo visual differences at ios: no capture |
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:
On Android, a
Textin a right-to-left layout is laid out as a left-to-right paragraph when it has no strong character outside of Unicode isolates, for example'Anna – Bob'from a message formatter. It is aligned to the right but readsAnna – Bobinstead ofBob – Anna.TextLayoutManagerbuilt theStaticLayout(and checkedBoringLayout) with the defaultFIRSTSTRONG_LTRheuristic, so text without a usable strong character always got a left-to-right paragraph. Now the whole text's first strong character decides, falling back to the layout direction when there is none, like aTextViewwithTEXT_DIRECTION_FIRST_STRONGin an RTL view. Paragraphs without a strong character (digits, emoji) follow that direction too, so they keep the same alignment as the rest of the text. Text with a strong character outside its isolates still takes its direction from that character. In an RTL layout this also means neutral-only text such as1 – 2reads right to left, as it does in a nativeTextView.Fixes #60449
Changelog:
[ANDROID] [FIXED] - Text in a right-to-left layout without a leading strong character is laid out right to left
Test Plan:
Added
TextLayoutManagerTextDirectionTest, which checks the paragraph direction of layouts for isolated-only, neutral-only and LTR-first (multi-line) text with RTL and LTR layout direction. The isolated and neutral RTL cases fail without the change. I didn't run the issue's reproducer on a device.