Skip to content
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

Fixed indented lines in diff flow direction text #17364

Conversation

dme-compunet
Copy link
Contributor

What does the pull request do?

Fixed a bug in text layout causing indented lines in text with reverse flow directions due to incorrect positioning of whitespace characters.

What is the current behavior?

No wrap text:
no-wrapped-text-before

Wrapped text:
wrapped-text-before

What is the updated/expected behavior with this PR?

No wrap text:
no-wrapped-text-after

Wrapped text:
wrapped-text-after

How was the solution implemented (if it's not obvious)?

For no-wrap text:
The default text for a text-run without content is currently 'a', an explicit LTR character. This fix replaces it with a neutral character, enabling the bidi algorithm to consider the direction of preceding RTL characters.

For wrapped text:
In wrapped text, the issue occurs because CoalesceLevels is called only once before performing text wrapping. After this fix, bidi text will be processed again for each line.

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Fixes #17175

@Gillibald
Copy link
Contributor

Gillibald commented Oct 27, 2024

Wrapping text should not change the bidi layout. Your changes just do that. So the first bidi layout is wrong or something else is causing this and needs to be fixed. Text seems to be wrapped at the wrong position.

@dme-compunet
Copy link
Contributor Author

dme-compunet commented Oct 27, 2024

Imagine you have the following text: aaa bbb in RTL paragraph,
If it is a single line then the bidi levels should be like this:

a a a   b b b  
0 0 0 0 0 0 0 1

But after it is broken into two lines, bidi levels should be like this:

a a a   
0 0 0 1
b b b   
0 0 0 1

Is there something wrong in my understanding?

@dme-compunet
Copy link
Contributor Author

Sorry, you are right, the bidi levels should remain the same,
so if I understand correctly the problem is that this white-space should be set as a trailing-whitespace?

@dme-compunet
Copy link
Contributor Author

Is commit Set bidi-netural char for default text okay, or does it also need to be thrown away?

@Gillibald
Copy link
Contributor

I think that default text is being used for InlineUIContainer and embedded constrols are always LTR

@dme-compunet
Copy link
Contributor Author

This is also used for TextEndOfParagraph and causes the preceding whitespaces to be LTR as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Indented lines in wrapped RTL text
2 participants