workflow_egui/fonts.rs
1use egui::{FontData, FontDefinitions, FontFamily};
2
3pub trait RegisterStaticFont {
4 fn add_static(&mut self, family: FontFamily, name: &str, bytes: &'static [u8]);
5}
6
7impl RegisterStaticFont for FontDefinitions {
8 fn add_static(&mut self, family: FontFamily, name: &str, bytes: &'static [u8]) {
9 self.font_data
10 .insert(name.to_owned(), FontData::from_static(bytes));
11
12 self.families
13 .entry(family)
14 .or_default()
15 .push(name.to_owned());
16 }
17}