Replace default UI font Ubuntu-Light with Inter-Regular#8129
Open
gcailly wants to merge 7 commits into
Open
Conversation
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.
|
Preview available at https://egui-pr-preview.github.io/pr/8129-default-font-inter View snapshot changes at kitdiff |
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.
…inistic" This reverts commit 34c6be3.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Swaps the default proportional typeface in
epaint_default_fontsfrom Ubuntu-Light to Inter-Regular, addressing #7892.Motivation
What changed
Fonts
crates/epaint_default_fonts/fonts/Inter-Regular.ttf(412 KB, static TTF from Inter 4.1 release)crates/epaint_default_fonts/fonts/Inter-OFL.txtUbuntu-Light.ttfandUFL.txtCode
UBUNTU_LIGHTtoINTER_REGULARinepaint_default_fonts/src/lib.rsepaint/src/text/fonts.rs(proportional + monospace fallback)ignore_characterinepaint/src/text/font.rsegui_demo_lib/src/demo/font_book.rsLicensing and packaging
epaint_default_fonts/Cargo.toml: SPDX expression now(MIT OR Apache-2.0) AND OFL-1.1deny.toml: dropUbuntu-font-1.0from the allow listTests and assets
UPDATE_SNAPSHOTS=trueegui_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 changesegui_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 fontScope 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 previousHack -> 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-featurescargo clippy --all-featurescargo fmt --allcargo test --workspace --all-features(with regenerated snapshots)egui_demo_appMade with assistance from Claude Code.