notecrumbs

a nostr opengraph server build on nostrdb and egui
git clone git://jb55.com/notecrumbs
Log | Files | Refs | README | LICENSE

fonts.rs (638B)


      1 // TODO: figure out the custom font situation
      2 
      3 pub fn setup_fonts(font_data: &egui::FontData, ctx: &egui::Context) {
      4     let mut fonts = egui::FontDefinitions::default();
      5 
      6     // Install my own font (maybe supporting non-latin characters).
      7     // .ttf and .otf files supported.
      8     fonts
      9         .font_data
     10         .insert("my_font".to_owned(), font_data.clone());
     11 
     12     // Put my font first (highest priority) for proportional text:
     13     fonts
     14         .families
     15         .entry(egui::FontFamily::Proportional)
     16         .or_default()
     17         .insert(0, "my_font".to_owned());
     18 
     19     // Tell egui to use these fonts:
     20     ctx.set_fonts(fonts);
     21 }