Skip to content

Replace default UI font Ubuntu-Light with Inter-Regular#8129

Open
gcailly wants to merge 7 commits into
emilk:mainfrom
gcailly:default-font-inter
Open

Replace default UI font Ubuntu-Light with Inter-Regular#8129
gcailly wants to merge 7 commits into
emilk:mainfrom
gcailly:default-font-inter

Conversation

@gcailly
Copy link
Copy Markdown
Contributor

@gcailly gcailly commented Apr 23, 2026

Summary

Swaps the default proportional typeface in epaint_default_fonts from Ubuntu-Light to Inter-Regular, addressing #7892.

Motivation

  • UI-first design: Inter is designed for on-screen interfaces, with a tall x-height aiding readability of mixed-case text at small sizes.
  • Licensing cleanup: drops Ubuntu Font License 1.0 in favor of SIL OFL 1.1, which is already used for Hack and NotoEmoji in this crate and is simpler for downstream redistribution.
  • Community interest: ubuntu font in epaint_default_fonts not fully free #7892 established that a switch was acceptable in principle.

What changed

Fonts

  • Add crates/epaint_default_fonts/fonts/Inter-Regular.ttf (412 KB, static TTF from Inter 4.1 release)
  • Add crates/epaint_default_fonts/fonts/Inter-OFL.txt
  • Remove Ubuntu-Light.ttf and UFL.txt

Code

  • Rename constant UBUNTU_LIGHT to INTER_REGULAR in epaint_default_fonts/src/lib.rs
  • Update fallback chains in epaint/src/text/fonts.rs (proportional + monospace fallback)
  • Remove Ubuntu-specific PUA codepoints (U+E0FF, U+EFFD, U+F0FF, U+F200) from ignore_character in epaint/src/text/font.rs
  • Remove 46 Ubuntu PUA match arms from egui_demo_lib/src/demo/font_book.rs

Licensing and packaging

  • epaint_default_fonts/Cargo.toml: SPDX expression now (MIT OR Apache-2.0) AND OFL-1.1
  • deny.toml: drop Ubuntu-font-1.0 from the allow list

Tests and assets

  • Regenerate 87 snapshot PNGs via UPDATE_SNAPSHOTS=true
  • egui_kittest/tests/tests.rs::test_scroll_down: replace the fixed 2-scroll sequence with a bounded loop (for _ in 0..10 { button.scroll_down(); }) so the test tolerates small line-height changes
  • egui_kittest/tests/tests.rs::test_masking: render the non-deterministic timestamp with the monospace family. Inter-Regular has proportional figures by default, so the total label width would otherwise depend on which digits the current timestamp contains and oscillate by 1 px between runs. Ubuntu-Light's default figures were effectively tabular, which hid the issue. Using the monospace family keeps the test's original intent (masking a value that changes every run) while making the layout deterministic.

Docs and demo pages

  • README.md, web_demo/index.html, web_demo/multiple_apps.html: text updates referencing the new font

Scope note

Default sizes in egui/src/style.rs (default_text_styles) are intentionally unchanged. Inter renders slightly smaller than Ubuntu-Light at the same em size, but a size adjustment is left to a separate PR to keep this one focused on the font swap.

Monospace fallback

The monospace fallback chain remains Hack -> Inter -> NotoEmoji -> emoji-icon, mirroring the previous Hack -> Ubuntu-Light -> ... structure. Inter covers roughly the same extended Latin range as Ubuntu-Light, so the fallback keeps its role of filling glyphs missing from Hack.

Test plan

  • cargo build --all-features
  • cargo clippy --all-features
  • cargo fmt --all
  • cargo test --workspace --all-features (with regenerated snapshots)
  • Visual check in egui_demo_app

Made with assistance from Claude Code.

Swaps the default proportional typeface in epaint_default_fonts from
Ubuntu-Light to Inter-Regular, addresses issue emilk#7892.

Motivation:
- Inter is designed for UI on screens, with a tall x-height aiding
  readability of mixed-case text at small sizes.
- Licensing cleanup: drops the Ubuntu Font License (Ubuntu-font-1.0)
  in favor of SIL OFL 1.1, which is already used elsewhere in the
  ecosystem and is simpler for downstream redistribution.

Changes:
- Add fonts/Inter-Regular.ttf (412 KB, static) + Inter-OFL.txt
- Remove fonts/Ubuntu-Light.ttf + UFL.txt
- Rename constant UBUNTU_LIGHT to INTER_REGULAR
- Update fallback chains in epaint/src/text/fonts.rs
- Remove Ubuntu-specific PUA codepoints (E0FF, EFFD, F0FF, F200) from
  ignore_character in font.rs
- Remove 46 Ubuntu PUA match arms from demo font_book.rs
- Cargo.toml license: add AND OFL-1.1 to SPDX expression
- deny.toml: drop Ubuntu-font-1.0 from allow list
- Regenerate 87 snapshot PNGs (via UPDATE_SNAPSHOTS=true)
- test_scroll_down: replace fixed 2-scroll sequence with bounded
  loop (for _ in 0..10) to be robust to line-height changes

Note: default font sizes in style.rs are intentionally not changed
here. Inter renders slightly smaller than Ubuntu-Light at equal em
size; a size adjustment will be proposed separately.

Made with assistance from Claude Code.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 23, 2026

Preview available at https://egui-pr-preview.github.io/pr/8129-default-font-inter
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

View snapshot changes at kitdiff

gcailly added 6 commits April 23, 2026 14:54
The test previously embedded SystemTime::now().as_millis() in the
label it renders, making the rendered width oscillate by 1 px between
runs depending on the last digit. Using a constant value makes the
snapshot stable.
The test deliberately uses a non-deterministic timestamp in a label and
verifies that masking hides it. However, the label's rendered width
depends on which digits the timestamp happens to contain when the font
has proportional figures (e.g. a "1" is narrower than an "8"). That made
the image dimensions oscillate by 1 px between runs.

Ubuntu-Light's default figures were effectively tabular, so the flake
was invisible; Inter-Regular has proportional figures by default, which
exposed the latent issue.

Rendering the timestamp with the monospace family (Hack) keeps all
digits at the same advance width, so the layout becomes deterministic
while preserving the test's original intent of masking a value that
changes every run.
These text-rendering tests were not regenerated in the initial snapshot
pass because they live in a workspace member I overlooked. Pulled from
the latest CI artefact.
@gcailly gcailly marked this pull request as ready for review April 23, 2026 14:30
@gcailly gcailly requested a review from lucasmerlin as a code owner April 23, 2026 14:30
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.

1 participant