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

Load fonts dynamically #64

Closed
Erxl opened this issue Dec 13, 2020 · 4 comments
Closed

Load fonts dynamically #64

Erxl opened this issue Dec 13, 2020 · 4 comments

Comments

@Erxl
Copy link

Erxl commented Dec 13, 2020

I'm looking for a way to load fonts dynamically, but I don't know how to implement it

@emilk
Copy link
Owner

emilk commented Dec 13, 2020

egui::FontDefinitions let's you specify your own TTF data and give to Egui. Use Context::set_fonts to set the new fonts.

Please tell me a bit more about your use case! Is your goal to load fonts for egui_web via a fetch?


EDIT: I simplified how to specify your own fonts in b7d1584

@emilk emilk closed this as completed Jan 3, 2021
@spacedragon
Copy link

spacedragon commented Apr 24, 2021

pub type FontData = std::borrow::Cow<'static, [u8]>;

@emilk

if FontData is 'static, can I load font data from the operating system runtime?

@emilk
Copy link
Owner

emilk commented Apr 24, 2021

Yes, with std::borrow::Cow::Owned

@spacedragon
Copy link

Thanks, I should go learn Cow first.

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

No branches or pull requests

3 participants