{"record":{"id":"c70ad59c6cd6b7f4","repo":"zed-industries/zed","slug":"dwrite-e-unsupportedoperation","errorCode":"DWRITE_E_UNSUPPORTEDOPERATION","errorMessage":"Failed to cast font face","messagePattern":"Failed to cast font face","errorType":"error_code","errorClass":"windows::core::Error","httpStatus":null,"severity":"error","filePath":"crates/gpui_windows/src/direct_write.rs","lineNumber":1494,"sourceCode":"        _measuringmode: DWRITE_MEASURING_MODE,\n        glyphrun: *const DWRITE_GLYPH_RUN,\n        glyphrundescription: *const DWRITE_GLYPH_RUN_DESCRIPTION,\n        _clientdrawingeffect: windows::core::Ref<windows::core::IUnknown>,\n    ) -> windows::core::Result<()> {\n        let glyphrun = unsafe { &*glyphrun };\n        let glyph_count = glyphrun.glyphCount as usize;\n        if glyph_count == 0 {\n            return Ok(());\n        }\n        let desc = unsafe { &*glyphrundescription };\n        let context = unsafe { &mut *(clientdrawingcontext.cast::<RendererContext>().cast_mut()) };\n        let Some(font_face) = glyphrun.fontFace.as_ref() else {\n            return Ok(());\n        };\n        // This `cast()` action here should never fail since we are running on Win10+, and\n        // `IDWriteFontFace3` requires Win10\n        let Ok(font_face) = &font_face.cast::<IDWriteFontFace3>() else {\n            return Err(Error::new(\n                DWRITE_E_UNSUPPORTEDOPERATION,\n                \"Failed to cast font face\",\n            ));\n        };\n\n        let font_face_key = font_face.cast::<IUnknown>().unwrap().as_raw().addr();\n        let font_id = context\n            .text_system\n            .font_info_cache\n            .get(&font_face_key)\n            .copied()\n            // in some circumstances, we might be getting served a FontFace that we did not create ourselves\n            // so create a new font from it and cache it accordingly. The usual culprit here seems to be Segoe UI Symbol\n            .map_or_else(\n                || {\n                    let font = font_face_to_font(font_face, &self.locale)\n                        .ok_or_else(|| Error::new(DWRITE_E_NOFONT, \"Failed to create font\"))?;\n                    let font_id = match context.text_system.font_to_font_id.get(&font) {","sourceCodeStart":1476,"sourceCodeEnd":1512,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/gpui_windows/src/direct_write.rs#L1476-L1512","documentation":"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.","triggerScenarios":"Thrown at crates/gpui_windows/src/direct_write.rs:1494 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Let the caller fall back to a simpler rendering path on unsupported-operation","Ensure the font face was created via an API that yields IDWriteFontFace3 (older/custom font sources may only provide earlier interfaces)"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f4178619acd0d47ea1f76a2025c42962c6d6638c","analyzedAt":"2026-08-20T19:29:52.058Z","contentChangedAt":"2026-08-20T19:29:52.058Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}