Skip to content

Commit

Permalink
gpui: Fix TextStyle default font_family crash on Windows, use `Segoe …
Browse files Browse the repository at this point in the history
…UI` for Windows (zed-industries#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
```
  • Loading branch information
huacnlee authored Jul 10, 2024
1 parent 1887a6d commit 15662f1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions crates/gpui/src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
},
Expand Down
1 change: 1 addition & 0 deletions crates/gpui/src/text_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 15662f1

Please sign in to comment.