Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

gpui_wgpu: Fix fallback fonts disappearing from the font database on Linux (#65269)

Smit Barmased6358b2d3cd0
diff --git a/crates/gpui_wgpu/src/cosmic_text_system.rs b/crates/gpui_wgpu/src/cosmic_text_system.rs
index 0e4e3b11f23..b7c38bb10cc 100644
--- a/crates/gpui_wgpu/src/cosmic_text_system.rs
+++ b/crates/gpui_wgpu/src/cosmic_text_system.rs
@@ -418,10 +418,17 @@ impl CosmicTextSystemState {
"Segoe Fluent Icons",
];
+ // This only decides whether a face can be a primary font. The
+ // editor measures layout with the width of 'm' and would panic
+ // without it.
+ //
+ // Don't remove the face from the font database. Arabic, Devanagari
+ // and emoji fonts often have no Latin glyphs, and they are exactly
+ // what cosmic-text falls back to when the primary font lacks a
+ // glyph.
if font.as_swash().charmap().map('m') == 0
&& !allowed_bad_font_names.contains(&postscript_name.as_str())
{
- self.font_system.db_mut().remove_face(font.id());
continue;
};