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

DWRITE_E_UNSUPPORTEDOPERATION

DWRITE_E_UNSUPPORTEDOPERATION

Error message

Failed to cast font face

What it means

In the DirectWrite glyph-run renderer, the cached font face could not be cast to IDWriteFontFace3. The renderer returns DWRITE_E_UNSUPPORTEDOPERATION so callers can take a fallback path for this glyph run.

Solutions

  1. Let the caller fall back to a simpler rendering path on unsupported-operation
  2. Ensure the font face was created via an API that yields IDWriteFontFace3 (older/custom font sources may only provide earlier interfaces)
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/gpui_windows/src/direct_write.rs:1494 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/c70ad59c6cd6b7f4. Report an issue: GitHub.

Appendix: source

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

                dx: 0.0,
                dy: 0.0,
            };
        }
        Ok(())
    }

    fn GetPixelsPerDip(
        &self,
        _clientdrawingcontext: *const ::core::ffi::c_void,
    ) -> windows::core::Result<f32> {
        Ok(1.0)
    }
}

#[allow(non_snake_case)]
impl IDWriteTextRenderer_Impl for TextRenderer_Impl {
    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(());
        };

View on GitHub (pinned to 916fc2b8cb)