gpui: Rewrite Windows PlatformTextSystem for better performance (#48087)

The current setup is quite a mess, allocates a ton of unnecessary heap
data when rendering text or querying font info and not really caching
things well, this PR changes that.

Release Notes:

- N/A *or* Added/Fixed/Improved ...
This commit is contained in:
Lukas Wirth authored and GitHub committed 2026-02-01 13:32:22 +01:00
1 parent 597ad7ae9f
commit 2426cad644
3 files changed
+363 -429

No files matched your search

+9
View File
@@ -38,6 +38,15 @@
},
},
},
"lsp": {
"rust-analyzer": {
"initialization_options": {
"procMacro": {
"processes": 4,
},
},
},
},
"file_types": {
"Dockerfile": ["Dockerfile*[!dockerignore]"],
"JSONC": ["**/assets/**/*.json", "renovate.json"],
File diff suppressed because it is too large. Load diff
+16
View File
@@ -943,3 +943,19 @@ pub(crate) fn font_name_with_fallbacks<'a>(name: &'a str, system: &'a str) -> &'
_ => name,
}
}
#[allow(unused)]
pub(crate) fn font_name_with_fallbacks_shared<'a>(
name: &'a SharedString,
system: &'a SharedString,
) -> &'a SharedString {
// Note: the "Zed Plex" fonts were deprecated as we are not allowed to use "Plex"
// in a derived font name. They are essentially indistinguishable from IBM Plex/Lilex,
// and so retained here for backward compatibility.
match name.as_str() {
".SystemUIFont" => system,
".ZedSans" | "Zed Plex Sans" => const { &SharedString::new_static("IBM Plex Sans") },
".ZedMono" | "Zed Plex Mono" => const { &SharedString::new_static("Lilex") },
_ => name,
}
}