Skip to content

Text size is smaller than it should be #2068

Closed
@emilk

Description

@emilk

Here is Ubuntu-Light (the default egui font) in the official Mac Font Book app (upper) and in egui (lower):

Screen Shot 2022-09-21 at 16 02 57

The text in egui is obviously much smaller, even though both should be size 12.


Repro:

use eframe::egui;

fn main() {
    let options = eframe::NativeOptions::default();
    eframe::run_native(
        "Font test",
        options,
        Box::new(|_cc| Box::new(MyApp::default())),
    );
}

#[derive(Default)]
struct MyApp {}

impl eframe::App for MyApp {
    fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
        egui::CentralPanel::default().show(ctx, |ui| {
            for size in [12, 16, 24] {
                ui.horizontal(|ui| {
                    ui.monospace(format!("{size}px"));
                    ui.label(
                        egui::RichText::from(
                            "The quick brown fox jumps over the lazy dog and runs away.",
                        )
                        .size(size as f32)
                        .color(egui::Color32::WHITE),
                    )
                });
            }
        });
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething is brokentextProblems related to text

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions