zed-industries/zed · error · windows::core::Error

DWRITE_E_NOFONT

DWRITE_E_NOFONT

Error message

Failed to create font

What it means

The renderer encountered a font face it did not create itself (cache miss), and creating a new font from the face's font info failed. Glyph rendering for this run cannot proceed with full font metadata.

Source

Thrown at crates/gpui_windows/src/direct_write.rs:1511

        let Ok(font_face) = &font_face.cast::<IDWriteFontFace3>() else {
            return Err(Error::new(
                DWRITE_E_UNSUPPORTEDOPERATION,
                "Failed to cast font face",
            ));
        };

        let font_face_key = font_face.cast::<IUnknown>().unwrap().as_raw().addr();
        let font_id = context
            .text_system
            .font_info_cache
            .get(&font_face_key)
            .copied()
            // in some circumstances, we might be getting served a FontFace that we did not create ourselves
            // so create a new font from it and cache it accordingly. The usual culprit here seems to be Segoe UI Symbol
            .map_or_else(
                || {
                    let font = font_face_to_font(font_face, &self.locale)
                        .ok_or_else(|| Error::new(DWRITE_E_NOFONT, "Failed to create font"))?;
                    let font_id = match context.text_system.font_to_font_id.get(&font) {
                        Some(&font_id) => font_id,
                        None => context
                            .text_system
                            .select_and_cache_font(context.components, &font)
                            .ok_or_else(|| Error::new(DWRITE_E_NOFONT, "Failed to create font"))?,
                    };
                    context
                        .text_system
                        .font_info_cache
                        .insert(font_face_key, font_id);
                    windows::core::Result::Ok(font_id)
                },
                Ok,
            )?;

        let color_font = unsafe { font_face.IsColorFont().as_bool() };

View on GitHub (pinned to f4178619ac)

Solutions

  1. Fall back to rendering the glyph run with default font metrics when font creation fails
  2. Prune stale font_info_cache entries so fresh lookups are attempted
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/gpui_windows/src/direct_write.rs:1511 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@f4178619ac (2026-08-20). Data as JSON: /api/errors/5dfe323a9436d70e. Report an issue: GitHub.