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.

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@916fc2b8cb (2026-08-20). Data as JSON: /api/errors/5dfe323a9436d70e. Report an issue: GitHub.

Appendix: source

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

    fn DrawGlyphRun(
        &self,
        clientdrawingcontext: *const ::core::ffi::c_void,
        _baselineoriginx: f32,
        _baselineoriginy: f32,
        _measuringmode: DWRITE_MEASURING_MODE,
        glyphrun: *const DWRITE_GLYPH_RUN,
        glyphrundescription: *const DWRITE_GLYPH_RUN_DESCRIPTION,
        _clientdrawingeffect: windows::core::Ref<windows::core::IUnknown>,
    ) -> windows::core::Result<()> {
        let glyphrun = unsafe { &*glyphrun };
        let glyph_count = glyphrun.glyphCount as usize;
        if glyph_count == 0 {
            return Ok(());
        }
        let desc = unsafe { &*glyphrundescription };
        let context = unsafe { &mut *(clientdrawingcontext.cast::<RendererContext>().cast_mut()) };
        let Some(font_face) = glyphrun.fontFace.as_ref() else {
            return Ok(());
        };
        // This `cast()` action here should never fail since we are running on Win10+, and
        // `IDWriteFontFace3` requires Win10
        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

View on GitHub (pinned to 916fc2b8cb)