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.
Source
Thrown at crates/gpui_windows/src/direct_write.rs:1494
_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
.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) {View on GitHub (pinned to f4178619ac)
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)
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@f4178619ac (2026-08-20).
Data as JSON: /api/errors/c70ad59c6cd6b7f4.
Report an issue: GitHub.