pop-os / cosmic-text

Pure Rust multi-line text handling
https://pop-os.github.io/cosmic-text/cosmic_text/
Apache License 2.0
1.57k stars 95 forks source link

Potential weirdness with non-text characters #237

Open leviport opened 6 months ago

leviport commented 6 months ago

I've seen a few instances of spacing and alignment weirdness in cosmic-term and cosmic-edit with non-text characters. The easiest way to show this is in typeracer in the screenshot below, where you can see the border has gaps at the corners of the text boxes. Comparing it to kgx or another terminal, the text boxes don't have gaps.

screenshot-2024-02-23-16-32-47

I've also seen instances of btop get messed up alignment because of the bullet point character it prints in its usage meters, but I don't have a screenshot of this at this time.

jackpot51 commented 6 months ago

I believe the btop issue is due to incorrect width calculation of braille fonts. @MoSal do you have ideas on this?

MoSal commented 6 months ago

Gave typeracer a test (it's this one btw).

cosmic-text is falling back to "Nimbus Mono PS" for some glyphs, and "JetBrains Mono" for others.

Changing font settings to "JetBrains Mono" makes the issue go away.

The Nimbus font comes from the gsfonts package which is required by graphviz and libwmf (a dependency of gimp).

Maybe at some point, setting a first fallback choice should be implemented and exposed as a user setting, hoping it wouldn't prove to be a slippery slope (users requesting 2nd, 3rd, 4th,... fallback choices).

MoSal commented 6 months ago

As for Braille chars, I didn't try it, but according to pop-os/cosmic-term#66, to guarantee correct rendering, a Monospace font with braille support is required (Iosevka was mentioned), and making sure font-weight is set to a value supported by such a font.

Morriarthy commented 3 months ago

screenshot-2024-05-21-16-35-40 The screenshot shows kitty and the cosmic terminal both running btop. - Is it known that for example btop looks a little messed up when compared to kitty?