Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix text sizes being too small #2069

Merged
merged 5 commits into from Sep 21, 2022
Merged

Fix text sizes being too small #2069

merged 5 commits into from Sep 21, 2022

Conversation

emilk
Copy link
Owner

@emilk emilk commented Sep 21, 2022

⚠️ This is a breaking change!

Closes #2068

Before this PR, the default font, Ubuntu-Light, was ~11% smaller than it should have been, and the default monospace font, Hack, was ~14% smaller. This means that setting the font size 12 in egui would yield smaller text than using that font size in any other app. Ooops!

The change is that this PR now takes into account the ttf properties units_per_em and height_unscaled.

If your egui application has specified you own font sizes or text styles you will see the text in your application grow
larger, unless you go in and compensate by dividing all font sizes by ~1.21 for Ubuntu-Light/Proportional and ~1.16 for Hack/Monospace, and with something else if you are using a custom font! This effects any use of FontId, RichText::size, etc.

This PR changes the default Style::text_styles to compensate, so the default egui style should look the same before and after this PR.

Closes #2068

Before this PR, the default font, Ubuntu-Light, was ~11% smaller
than it should have been, and the default monospace font, Hack,
was ~14% smaller. This means that setting the font size `12` in egui
would yield smaller text than using that font size in any other app.
Ooops!

The change is that this PR now takes into account the ttf properties
`units_per_em` and `height_unscaled`.

If your egui application has specified you own font sizes or text styles
you will see the text in your application grow
larger, unless you go in and compensate by dividing all font sizes by
~1.21 for Ubuntu-Light/Proportional and ~1.16 for Hack/Monospace,
and with something else if you are using a custom font!
This effects any use of `FontId`, `RichText::size`, etc.

This PR changes the default `Style::text_styles` to compensate,
so the default egui style should look the same before and after this PR.
@emilk emilk merged commit 29fa633 into master Sep 21, 2022
@emilk emilk deleted the fix-font-scale branch September 21, 2022 19:31
emilk added a commit to rerun-io/rerun that referenced this pull request Sep 24, 2022
Includes recent improvements to text rendering:
* emilk/egui#2071
* emilk/egui#2070
* emilk/egui#2069
emilk added a commit to rerun-io/rerun that referenced this pull request Sep 24, 2022
Includes recent improvements to text rendering:
* emilk/egui#2071
* emilk/egui#2070
* emilk/egui#2069
nozwock added a commit to nozwock/rusty-autoclicker that referenced this pull request Dec 31, 2022
MrTanoshii pushed a commit to MrTanoshii/rusty-autoclicker that referenced this pull request Dec 31, 2022
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.

Text size is smaller than it should be
1 participant