-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Description
Is there an existing issue for this?
- I have searched the existing issues.
Is this issue related to iced?
- My hardware is compatible and my graphics drivers are up-to-date.
What happened?
Thanks to #1830, regular Text widgets can handle complex scripts, including left-to-right (LTR), right-to-left (RTL), and mixed LTR/RTL. But this is only partially true for the TextInput widget, such that complex scripts will be displayed properly only if the content of the text input starts with an LTR (alphabet) character. In other words, the content of text input is only displayed when the content should be aligned LTR.
The screen capture below demonstrates the issue using the Todos example of the library, but this issue is reproducible with any TextInput instance. The video covers LTR, RTL, LTR->RTL, and RTL->LTR.
iced_rtl_issue.mov
What is the expected behavior?
Ultimately, if the user input starts with an RTL (alphabet) character, the entire content should be displayed RTL and be right-aligned. However, since TextInput does not yet have horizontal text alignment support, a first step would be to just make the text show up, even if left-aligned.
I don't have enough knowledge of text rendering or the internals of this library to pinpoint where the issue stems from and how to fix it. But I did try a couple of basic modifications to this function call:
- Changed the hard-coded
Alignment::LefttoAlignment::Right - Changed
bounds.xto a value expected byAlignment::Right
I also tried rendering with different values of offset with renderer.with_translation(...). None of my attempts so far has made the missing text appear.
I would be happy to look into fixing the issue if someone can point me to the potential location of the issue in the codebase.
Version
master
Operative System
macOS
Do you have any log output?
No response