iced-rs / iced

A cross-platform GUI library for Rust, inspired by Elm
https://iced.rs
MIT License
24.4k stars 1.14k forks source link

Support for non-Latin languages #1454

Open koutheir opened 2 years ago

koutheir commented 2 years ago

Is there an existing issue for this?

Is this issue related to iced?

What happened?

Running the tour package, and typing Arabic text on the Text input page, displays squared interrogation point characters.

$ cargo run --package tour

Screenshot

What is the expected behavior?

Arabic text should be displayed correctly.

Version

master

Operative System

Linux

Do you have any log output?

No response

ids1024 commented 2 years ago

I believe with the default_system_font feature enabled, this should at least be able to find a font with the appropriate characters?

Though Arabic text still won't be right without RTL support (https://github.com/iced-rs/iced/issues/250) and text shaping (https://github.com/iced-rs/iced/issues/33).

koutheir commented 2 years ago

I added default_system_font to the iced features in iced/examples/tour/Cargo.toml:

[dependencies]
iced = { path = "../..", features = ["image", "debug", "default_system_font"] }
env_logger = "0.8"

and then run:

$ cargo run --package tour

But no Arabic characters are displayed properly.

Screenshot

adals commented 1 year ago

I added default_system_font to the iced features in iced/examples/tour/Cargo.toml:

Screen Shot 2022-10-08 at 9 59 36 PM

i think that your problem is lacking a font that contains the relevant glyphs.

but RTL is still not supported yet

koutheir commented 1 year ago

i think that your problem is lacking a font that contains the relevant glyphs.

I disagree, as I routinely write Arabic text in other applications (libreoffice, kate, etc.) and I don't have any font issues.

mmstick commented 1 year ago

@koutheir Check this out! https://github.com/pop-os/libcosmic/pull/12 Please try out Arabic in the text example and help locate bugs in the rendering.

ids1024 commented 1 year ago

i think that your problem is lacking a font that contains the relevant glyphs.

I think Iced isn't implementing fallback font behavior, which is normally used to find a font for a different writing system. So that's why it doesn't find a font with the right gylphs.

Luckily this (as well as text shaping and RTL) is being prototyped in libcosmic as mentioned, and hopefully will be integrated into Iced soon.

koutheir commented 1 year ago

Check this out! https://github.com/pop-os/libcosmic/pull/12 Please try out Arabic in the text example and help locate bugs in the rendering.

Running the following command panics:

$ cargo run --package cosmic
<...>
     Running `target/debug/cosmic`
icon 'go-previous-symbolic' size 24 not found
icon 'window-minimize-symbolic' size 16 not found
icon 'window-maximize-symbolic' size 16 not found
icon 'window-close-symbolic' size 16 not found
icon 'network-wireless' size 20 not found
icon 'preferences-desktop' size 20 not found
icon 'system-software-update' size 20 not found
thread 'main' panicked at 'Downcast on stateless state', /home/koutheir/.cargo/git/checkouts/iced-14fbad96f5d3e3c7/7461b82/native/src/widget/tree.rs:172:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Running the following command works:

$ cargo run --package text

The Arabic letters are rendered correctly, and selecting them with the mouse and moving between the characters works as I expect.

However, using the Right and Left keyboard keys works logically, instead of visually, i.e., the Left key moves to the right, and vice versa, and that feels weird. I don't know if that's intended or it is an issue.

lost22git commented 1 year ago

same profblem, any update?

13r0ck commented 1 year ago

@lost22git yep! See the advanced-text branch. https://github.com/iced-rs/iced/tree/advanced-text