cosmic-term icon indicating copy to clipboard operation
cosmic-term copied to clipboard

Arabic Font Rendering Issue

Open Majoramari opened this issue 1 year ago • 4 comments

Thanks for supporting RTL. You are one of the few terminals that support RTL, but I have encountered an issue that I don't know how to solve. The AR font looks awful, and I'm not sure how to fix it exactly. You can see the difference in the following image:

Image

Majoramari avatar Feb 26 '25 04:02 Majoramari

Make sure you have a monospace font with Arabic support installed. DejaVu Sans Mono is a common one. Kawkab Mono is one which is specifically tailored to Arabic.

MoSal avatar Feb 26 '25 11:02 MoSal

Make sure you have a monospace font with Arabic support installed. DejaVu Sans Mono is a common choice, while Kawkab Mono is specifically tailored for Arabic.

Thanks for your reply! I have both of them installed.

Here's a comparison with Konsole. While it's not perfect, it's somewhat better and easier to read.

Image

Majoramari avatar Feb 28 '25 03:02 Majoramari

Actually there appears to be a bug in font selection that may have not been there in the past. The font fallback process is still kicking in even if the selected/configured font supports all required glyphs. So maybe there is a "bad" mono font with Arabic support that is being used, even if a "good" font is explicitly selected.

In any case, you can run cosmic-term like this:

RUST_LOG=cosmic_text=trace cosmic-term

And look for lines like:

[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'IBM Plex Mono'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'Inconsolata'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'Roboto Mono'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrains Mono NL'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'Fira Mono'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'Fira Code'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'Source Code Pro'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'PowerlineSymbols'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'IBM Plex Mono'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'Unifont-JP'

The last font in that sequence would be the one selected as fallback, and thus could be the "bad" one.

MoSal avatar Feb 28 '25 09:02 MoSal

Actually there appears to be a bug in font selection that may have not been there in the past. The font fallback process is still kicking in even if the selected/configured font supports all required glyphs. So maybe there is a "bad" mono font with Arabic support that is being used, even if a "good" font is explicitly selected.

In any case, you can run cosmic-term like this:

RUST_LOG=cosmic_text=trace cosmic-term

And look for lines like:

[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'IBM Plex Mono'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'Inconsolata'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'Roboto Mono'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrains Mono NL'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'Fira Mono'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'Fira Code'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'Source Code Pro'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'PowerlineSymbols'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'IBM Plex Mono'
[2025-02-28T08:36:50Z TRACE cosmic_text::shape] Evaluating fallback with font 'Unifont-JP'

The last font in that sequence would be the one selected as fallback, and thus could be the "bad" one.

Well I tried the command you send me and I got this (I got longer output but I just pasted the fallbacks to not bloat the issue):

[2025-03-27T20:47:19Z TRACE cosmic_text::shape]       Run []: '\U0001f54c'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMonoNL Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMono Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'DejaVu Sans Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Kawkab Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Source Code Pro'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'ComicCode Nerd Font'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Cousine'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Nimbus Mono PS'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Liberation Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMonoNL Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMono Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Kawkab Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Source Code Pro'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'ComicCodeLigatures Nerd Font'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'ComicCode Nerd Font'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMonoNL Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMono Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Source Code Pro'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'ComicCodeLigatures Nerd Font'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'ComicCode Nerd Font'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMonoNL Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMono Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Source Code Pro'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'SourceCodeVF'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'ComicCodeLigatures Nerd Font'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'ComicCode Nerd Font'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMonoNL Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMono Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Source Code Pro'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'ComicCodeLigatures Nerd Font'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'ComicCode Nerd Font'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMonoNL Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMono Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'ComicCodeLigatures Nerd Font'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'ComicCode Nerd Font'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'FreeMono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Hack'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMonoNL Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMono Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'DejaVu Sans Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Kawkab Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Source Code Pro'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'ComicCodeLigatures Nerd Font'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'ComicCode Nerd Font'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Cousine'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Nimbus Mono PS'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Liberation Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMonoNL Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'JetBrainsMono Nerd Font Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Source Code Pro'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Noto Sans'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'DejaVu Sans'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'FreeSans'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Noto Sans Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'DejaVu Sans Mono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'FreeMono'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Noto Sans Symbols'
[2025-03-27T20:47:19Z DEBUG cosmic_text::font::fallback] failed to find family 'Noto Sans Symbols2'
[2025-03-27T20:47:19Z TRACE cosmic_text::shape] Evaluating fallback with font 'Noto Color Emoji'

Majoramari avatar Mar 27 '25 20:03 Majoramari