eframe_template icon indicating copy to clipboard operation
eframe_template copied to clipboard

Custom font not applying

Open pmillspaugh opened this issue 1 year ago • 2 comments

Hi there,

I am trying out eframe/egui for the first time (thanks for all the docs and examples!).

I'm following the custom font example to add a custom font to my own eframe app, but my custom font is not applying. I'm guessing that I'm making a simple mistake. PR here, and here's the code I added to the new fn in my app struct impl in app.rs:

let mut fonts = egui::FontDefinitions::default();

fonts.font_data.insert(
    "EBGaramond".to_owned(),
    egui::FontData::from_static(include_bytes!("../assets/EBGaramond-Regular.ttf"))
);

fonts.families.entry(egui::FontFamily::Proportional).or_default().insert(0,"EBGaramond".to_owned());
fonts.families.entry(egui::FontFamily::Monospace).or_default().insert(0,"EBGaramond".to_owned());

cc.egui_ctx.set_fonts(fonts);

I also tried removing the default_fonts feature in Cargo.toml to break fonts altogether, but my app still built and ran.

Thank you.

pmillspaugh avatar Jun 06 '24 20:06 pmillspaugh

You can check out the section from one of my apps here, hope it helps: https://github.com/markusdd/rusty_meter/blob/054149fa6114bda3b2e91a5261d3e70baf3692c1/src/app.rs#L320

markusdd avatar Jul 11 '24 20:07 markusdd

Thanks, @markusdd! Still no luck with the approach you took unfortunately, but I'll report back here if I can find the issue.

pmillspaugh avatar Jul 12 '24 12:07 pmillspaugh