From 15662f105e74064b50b4c2c86f5dcd2bf7a2e087 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Thu, 11 Jul 2024 03:40:42 +0800 Subject: [PATCH] gpui: Fix TextStyle default font_family crash on Windows, use `Segoe UI` for Windows (#14040) Release Notes: - Fixed default font_family crash on Windows, use `Segoe UI`. ## Crash error message ``` thread 'main' panicked at crates\gpui\src\text_system.rs:150:9: failed to resolve font 'Helvetica' or any of the fallbacks: Zed Plex Mono, Helvetica, Cantarell, Ubuntu, Noto Sans, DejaVu Sans ``` --- crates/gpui/src/style.rs | 2 ++ crates/gpui/src/text_system.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/crates/gpui/src/style.rs b/crates/gpui/src/style.rs index 0ca021f2b2b725bf027d68269724c1dab2736b29..8f1ebc8a618c7fb55322335b3da5285aa2659a2f 100644 --- a/crates/gpui/src/style.rs +++ b/crates/gpui/src/style.rs @@ -212,6 +212,8 @@ impl Default for TextStyle { // todo(linux) make this configurable or choose better default font_family: if cfg!(target_os = "linux") { "FreeMono".into() + } else if cfg!(target_os = "windows") { + "Segoe UI".into() } else { "Helvetica".into() }, diff --git a/crates/gpui/src/text_system.rs b/crates/gpui/src/text_system.rs index b884e2ef934f182e1c2775046bbdc7b2ffe3e6ed..d9afea43f3b956ae641ba789ff459ec891b7f68f 100644 --- a/crates/gpui/src/text_system.rs +++ b/crates/gpui/src/text_system.rs @@ -66,6 +66,7 @@ impl TextSystem { // We should allow GPUI users to provide their own fallback font stack. font("Zed Plex Mono"), font("Helvetica"), + font("Segoe UI"), // Windows font("Cantarell"), // Gnome font("Ubuntu"), // Gnome (Ubuntu) font("Noto Sans"), // KDE