egui_font_loader
A simple library to simplify egui font loading
Installation
Add egui_font_loader to your Cargo.toml dependencies:
[]
= "0.34.1"
Dependency version conflict (Hacky solution)
It may happen that you want to use egui_font_loader with a egui version that clashes and for which there are no egui_font_loader version published. It's pretty safe to modify the Cargo.lock to force egui_font_loader to resolve to another egui version.
[[]]
= "egui_font_loader"
= "0.34.1"
= "registry+https://github.com/rust-lang/crates.io-index"
= "1b605b1e1794d96262ddffc1320e237985cf9de56c37238d506d00f6cd9bdbd4"
= [
"egui",
"thiserror 2.0.18",
]
How to load fonts
Important! It's advised to load the font only once and avoid doing it in the update function.
Fonts need to be found locally.
Single font
To load a single font known at compile time, it's suggested to use the load_font macro
load_font!;
The DesiredFontName can be anything, just keep it in mind to load it later on.
Multiple fonts at once
use LoaderFontData;
use load_fonts;
let fonts = vec!;
load_fonts.unwrap;
How to use the loaded font
// Some code
ui.heading;
// Some other code
How to load only once the desired fonts
In the main.rs
run_native
In myapp.rs