emilk/egui · error

No font data found for {font_name:?}

Error message

No font data found for {font_name:?}

What it means

Error "No font data found for {font_name:?}" thrown in emilk/egui.

Source

Thrown at crates/epaint/src/text/fonts.rs:1033

    /// Return a shaping buffer for reuse.
    pub fn return_shape_buffer(&mut self, buffer: harfrust::UnicodeBuffer) {
        self.shape_buffer = Some(buffer);
    }

    /// Get the right font implementation from [`FontFamily`].
    pub fn font(&mut self, family: &FontFamily) -> Font<'_> {
        let cached_family = self.family_cache.entry(family.clone()).or_insert_with(|| {
            let fonts = &self.definitions.families.get(family);
            let fonts =
                fonts.unwrap_or_else(|| panic!("FontFamily::{family:?} is not bound to any fonts"));

            let fonts: Vec<FontFaceKey> = fonts
                .iter()
                .map(|font_name| {
                    *self
                        .fonts_by_name
                        .get(font_name)
                        .unwrap_or_else(|| panic!("No font data found for {font_name:?}"))
                })
                .collect();

            CachedFamily::new(fonts, &mut self.fonts_by_id)
        });
        Font {
            fonts_by_id: &mut self.fonts_by_id,
            cached_family,
            atlas: &mut self.atlas,
        }
    }
}

// ----------------------------------------------------------------------------

struct CachedGalley {
    /// When it was last used
    last_used: u32,

View on GitHub (pinned to b9a0723d88)

Solutions

  1. Register the font under that name in FontDefinitions::font_data before referencing it in a family list.
  2. Fix a typo: the name in families must exactly match the key used in font_data.

Example fix

fonts.font_data.insert("MyFont".to_owned(), FontData::from_static(MY_FONT_BYTES).into());

When it happens

Trigger: Thrown at crates/epaint/src/text/fonts.rs:1033 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of emilk/egui@b9a0723d88 (2026-08-19). Data as JSON: /api/errors/130cf0b44a9c0b88. Report an issue: GitHub.