{"record":{"id":"4e94d863020620c8","repo":"zed-industries/zed","slug":"could-not-load-an-embedded-font","errorCode":null,"errorMessage":"Could not load an embedded font.","messagePattern":"Could not load an embedded font\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/gpui_macos/src/text_system.rs","lineNumber":265,"sourceCode":"        let Some(number) = value.downcast_into::<CFNumber>() else {\n            return true;\n        };\n        // Only an explicit value of `0` means that font smoothing is disabled.\n        number.to_i64() != Some(0)\n    })\n}\n\nimpl MacTextSystemState {\n    fn add_fonts(&mut self, fonts: Vec<Cow<'static, [u8]>>) -> Result<()> {\n        let fonts = fonts\n            .into_iter()\n            .map(|bytes| match bytes {\n                Cow::Borrowed(embedded_font) => {\n                    let data_provider = unsafe {\n                        core_graphics::data_provider::CGDataProvider::from_slice(embedded_font)\n                    };\n                    let font = core_graphics::font::CGFont::from_data_provider(data_provider)\n                        .map_err(|()| anyhow!(\"Could not load an embedded font.\"))?;\n                    let font = font_kit::loaders::core_text::Font::from_core_graphics_font(font);\n                    Ok(Handle::from_native(&font))\n                }\n                Cow::Owned(bytes) => Ok(Handle::from_memory(Arc::new(bytes), 0)),\n            })\n            .collect::<Result<Vec<_>>>()?;\n        self.memory_source.add_fonts(fonts.into_iter())?;\n        Ok(())\n    }\n\n    fn load_family(\n        &mut self,\n        name: &str,\n        features: &FontFeatures,\n        fallbacks: Option<&FontFallbacks>,\n    ) -> Result<SmallVec<[FontId; 4]>> {\n        let name = gpui::font_name_with_fallbacks(name, \".AppleSystemUIFont\");\n","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/zed-industries/zed/blob/f4178619acd0d47ea1f76a2025c42962c6d6638c/crates/gpui_macos/src/text_system.rs#L247-L283","documentation":"Guard in MacTextSystemState::add_fonts: registering one of the embedded (bundled) font data providers with CoreText failed. It fires at text-system startup when a built-in font buffer cannot be loaded — corrupted embedded font data or a CoreText registration error — so text rendering cannot be initialized.","triggerScenarios":"Thrown at crates/gpui_macos/src/text_system.rs:265 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify embedded font bytes are valid TTF/OTF (they can be truncated by build/packaging steps)","Check the CGDataProvider construction path for the failing font and log which one it is","Treat as fatal: a text system without its bundled fonts cannot render, so abort startup with the error"],"exampleFix":null,"handlingStrategy":"try-catch","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"}