slint-ui / slint

Slint is a declarative GUI toolkit to build native user interfaces for Rust, C++, or JavaScript apps.
https://slint.dev
Other
17.56k stars 604 forks source link

CJK glyphs are not rendered in WASM builds #2563

Open GoldsteinE opened 1 year ago

GoldsteinE commented 1 year ago

Our wasm demos can't render chinese or other high unicode because the DejaVu font shipped in the embedded wasm binary does not provide CJK coverage.

reproducer

Original description

For example, 𨭎 is rendered as two separately-selectable rectangles in the WASM demo. That’s not purely a font problem: font can’t make one symbol to be selectable as two.

tronical commented 1 year ago

I haven't tried to reproduce but I completely believe it. Afaics text_input_byte_offset_for_position in the femtovg renderer operates on glyph boundaries instead of graphemes.

GoldsteinE commented 1 year ago

Why it’s two glyphs for one codepoint though?

tronical commented 1 year ago

In principle the font's gsub could do that (as decomposition). I wonder, how do you reproduce this? What input method are you using?

Could it be that your input method ends up inserting two code points by chance?

GoldsteinE commented 1 year ago

Is it not reproducible for you? I’m doing xdotool type '𨭎' while focused on a text field, so no input method should affect this.

tronical commented 1 year ago

Sadly I can't. (thanks for the tip about xdotool - TIL :). I've tried via xdotool and loading the gallery in chrome as browser (since you said "WASM demo" in the description), but that doesn't render the glyph due to lack of coverage by the dejavu font.

I tried running the gallery demo locally (so not in the browser) - on Linux with X11 - and entering "𨭎" (with xdotool or via copy & paste) produces one glyph and I can only select either the entire glyph or nothing.

I wonder what I'm missing :)

GoldsteinE commented 1 year ago

Copy & paste isn’t working for me at all for some reason. I’m wondering whether we’re talking about the same demo.

I’m looking at this page:

https://slint-ui.com/releases/1.0.0/demos/gallery/

^C / ^V isn’t working for me, neither does right mouse click. xdotool produces two rectangles.

GoldsteinE commented 1 year ago

Oh, it’s interesting: it’s one rectangle in Chromium, but two rectangles in Firefox.