Skip to content

Fonts: find the cell, serif, mono, Thai and Hebrew faces in Fedora's package folders (#1694) - #1705

Merged
aiongg merged 1 commit into
storytold:mainfrom
tydude001:fix/1694-fedora-font-folders
Oct 22, 2026
Merged

aiongg merged 1 commit into
storytold:mainfrom
tydude001:fix/1694-fedora-font-folders

Conversation

@tydude001

Copy link
Copy Markdown
Contributor

Part of #1694 (problem 1, except CJK).

On Fedora the cell font roles in crates/ui-egui/src/theme.rs find no face. Fedora keeps each family in its own
package folder (google-carlito-fonts/, liberation-sans-fonts/…), and the roles only list the Debian/Ubuntu/Arch
folders. Every cell then falls back to egui's built-in proportional font, which has one weight and no italic, so bold
and italic cells draw as regular text. Serif and monospace cells use the built-in faces, and Thai and Hebrew are boxes.
The UI roles already have Fedora's folders (#54, #298). This adds them to the other roles, each after the existing
Linux entries for the same font:

  • cell, cell-bold, cell-italic, cell-bold-italic: google-carlito-fonts/Carlito-*.ttf, liberation-sans-fonts/,
    dejavu-sans-fonts/.
  • serif: liberation-serif-fonts/LiberationSerif-Regular.ttf, dejavu-serif-fonts/DejaVuSerif.ttf.
  • mono: dejavu-sans-mono-fonts/DejaVuSansMono.ttf. Fedora installs DejaVu Sans Mono only on request, so two
    fallbacks follow: Liberation Mono (<dir>/liberation/ and liberation-mono-fonts/), which comes with LibreOffice
    (a default group in Workstation and KDE), and last Fedora's default monospace, the variable
    google-noto-vf/NotoSansMono[wght].ttf.
  • Thai and Hebrew: google-noto-vf/NotoSansThai[wght].ttf and NotoSansHebrew[wght].ttf.

The Noto variable fonts all default to wght 400 (Regular; read from their fvar), so they need no FontTweak.

One change outside Fedora: the generic <dir>/liberation/LiberationMono-Regular.ttf entry also matches other layouts.
A system with Liberation Mono there but no DejaVu Sans Mono at a listed path now draws mono cells in Liberation Mono
instead of egui's built-in mono. Wherever an existing entry already matched, nothing changes.

Left for separate PRs:

How tested:

  • New test theme::tests::fedora_package_folders_are_searched_after_the_other_linux_layouts checks that each role lists
    Fedora's file for its face, after the existing Linux entries for the same font, and that the mono fallbacks come
    after DejaVu Sans Mono. It fails on main ("cell: Fedora's google-carlito-fonts/Carlito-Regular.ttf is not a
    candidate") and passes with this change.
  • The desktop app built from this branch, on Linux (headless sway). The font layouts were bind-mounted over
    /usr/share/fonts, with a sheet in Calibri, Arial, Times New Roman, Courier New and Cambria, regular, bold, italic and
    bold italic, plus Thai, Hebrew and CJK text:
    • Fedora 44's folders (Carlito from Fedora 44's google-carlito-fonts): on main, a bold Calibri cell has the
      same number of dark pixels as the regular one (126 and 126). With this change it has 144 and 239, and italic is
      slanted. Serif cells use Liberation Serif, mono cells Liberation Mono, and Thai and Hebrew draw.
    • The same files under Debian's folder names: pixel-identical to main except Courier New, which moves from the
      built-in mono to Liberation Mono, because that layout has no DejaVu Sans Mono.
    • Fedora's folders without LibreOffice's fonts: mono cells use Noto Sans Mono, and Thai and Hebrew draw.
  • cargo xtask ci: all 8 steps pass (fmt, clippy, test, assets, layers, wasm, parity, keytips); 1610 tests, 0 failed.

🤖 Generated with Claude Code

…package folders (storytold#1694)

Fedora keeps each font family in its own package folder, and the cell, serif, mono, Thai and
Hebrew candidates only listed the Debian/Ubuntu/Arch folders, so no cell face was found there and
bold and italic cells drew as regular text in the built-in font. Add Fedora's folders after the
existing Linux entries for each font, as storytold#54 did for the UI fonts, and let mono fall back to
Liberation Mono and then Fedora's default Noto Sans Mono, since DejaVu Sans Mono is optional there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MichaelMuClaude

Copy link
Copy Markdown

Independent verification, since this has been open a few days with no review — this matches the exact pattern I've been looking at today in pdfcraft (Hebrew/Thai system-font fallback bugs, storytold/pdfcraft#1624 and #792).

Applied cleanly on current main (51 lines, no conflicts). On Linux:

  • cargo test -p gridcraft-ui-egui --lib fedora_package_folders_are_searched_after_the_other_linux_layouts: pass — confirms every Fedora path (Carlito, Liberation Sans/Serif/Mono, Noto Sans Thai/Hebrew/Mono) is present and ordered strictly after the existing Debian/Ubuntu/Arch candidates for the same font, so nothing changes where an earlier entry already matches.
  • cargo clippy -p gridcraft-ui-egui --all-targets -- -D warnings: clean
  • cargo fmt --check: clean

I don't have a Fedora box to confirm the actual /usr/share/fonts/.../*.ttf paths exist with those exact names at runtime, but the logic itself (list ordering, candidate construction) is well covered by the new test and change is purely additive to existing candidate lists — low risk of regressing non-Fedora layouts. Looks ready to merge from here.

@aiongg
aiongg merged commit eaf9a3f into storytold:main Oct 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants