iced icon indicating copy to clipboard operation
iced copied to clipboard

Support for non-Latin languages

Open koutheir opened this issue 1 year ago • 7 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues.

Is this issue related to iced?

  • [X] My hardware is compatible and my graphics drivers are up-to-date.

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

koutheir avatar Oct 04 '22 01:10 koutheir

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).

ids1024 avatar Oct 04 '22 01:10 ids1024

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

koutheir avatar Oct 04 '22 01:10 koutheir

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

adals avatar Oct 08 '22 19:10 adals

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.

koutheir avatar Oct 08 '22 19:10 koutheir

@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.

mmstick avatar Oct 09 '22 01:10 mmstick

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.

ids1024 avatar Oct 09 '22 02:10 ids1024

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.

koutheir avatar Oct 09 '22 04:10 koutheir