From f3ad75439678846be36f7ed7dbd7bee890677d92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=B0=8F=E7=99=BD?= <364772080@qq.com> Date: Fri, 26 Jul 2024 02:53:22 +0800 Subject: [PATCH] linux: Fix wrong names reported by `all_font_names` (#14865) The names suggested by `buffer_font_family` are reported by `all_font_names`. Therefore, `all_font_names` should report family names rather than postscript names. close #14854 Release Notes: - N/A --- crates/gpui/src/platform/linux/text_system.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/gpui/src/platform/linux/text_system.rs b/crates/gpui/src/platform/linux/text_system.rs index dc7bf6ca5f..b32f826e2d 100644 --- a/crates/gpui/src/platform/linux/text_system.rs +++ b/crates/gpui/src/platform/linux/text_system.rs @@ -64,13 +64,17 @@ impl PlatformTextSystem for CosmicTextSystem { } fn all_font_names(&self) -> Vec { - self.0 + let mut result = self + .0 .read() .font_system .db() .faces() - .map(|face| face.post_script_name.clone()) - .collect() + .filter_map(|face| face.families.first().map(|family| family.0.clone())) + .collect_vec(); + result.sort(); + result.dedup(); + result } fn all_font_families(&self) -> Vec {