Skip to content

Commit 759bacf

Browse files
authored
gpui_macos: Warn when falling back to NoopTextSystem (zed-industries#59247)
# Objective Without the `font-kit` feature, `MacPlatform` silently substitutes `gpui::NoopTextSystem`, which accepts fonts and resolves font ids but rasterizes every glyph to an empty bitmap. I hit this with the `component_preview` example zed-industries#59241. ## Solution Log a warning at startup in `MacPlatform::new()` when falling back to `NoopTextSystem`. Skipped in headless mode, where no text is expected to render and the fallback is a reasonable configuration. ## Testing Checked as part of zed-industries#59241 ## Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content adheres to Zed's UI standards ([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) and [icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md) guidelines) ## Showcase It just render as like without any error: <img width="1312" height="945" alt="cp_pr1_before" src="https://github.com/user-attachments/assets/f5faf3c0-9523-4c5f-9756-e65cbaf3456f" /> --- Release Notes: - N/A or Added/Fixed/Improved ...
1 parent cb77216 commit 759bacf

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

crates/gpui_macos/src/platform.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,14 @@ impl MacPlatform {
194194
let text_system = Arc::new(crate::MacTextSystem::new());
195195

196196
#[cfg(not(feature = "font-kit"))]
197-
let text_system = Arc::new(gpui::NoopTextSystem::new());
197+
let text_system = {
198+
if !headless {
199+
log::warn!(
200+
"gpui_macos was compiled without the `font-kit` feature, so no text will be rendered."
201+
);
202+
}
203+
Arc::new(gpui::NoopTextSystem::new())
204+
};
198205

199206
let keyboard_layout = MacKeyboardLayout::new();
200207
let keyboard_mapper = Rc::new(MacKeyboardMapper::new(keyboard_layout.id()));

0 commit comments

Comments
 (0)