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.

Implement `all_font_families` for the LinuxTextSystem (#8331)

Maharshi Basua5eab29662e8
diff --git a/crates/gpui/src/platform/linux/text_system.rs b/crates/gpui/src/platform/linux/text_system.rs
index 8fd1be323b0..70caa7175b0 100644
--- a/crates/gpui/src/platform/linux/text_system.rs
+++ b/crates/gpui/src/platform/linux/text_system.rs
@@ -9,6 +9,8 @@ use cosmic_text::{
fontdb::Query, Attrs, AttrsList, BufferLine, CacheKey, Family, Font as CosmicTextFont,
FontSystem, SwashCache,
};
+
+use itertools::Itertools;
use parking_lot::{RwLock, RwLockUpgradableReadGuard};
use pathfinder_geometry::{
rect::{RectF, RectI},
@@ -71,9 +73,14 @@ impl PlatformTextSystem for LinuxTextSystem {
.collect()
}
- // todo(linux)
fn all_font_families(&self) -> Vec<String> {
- Vec::new()
+ self.0
+ .read()
+ .font_system
+ .db()
+ .faces()
+ .filter_map(|face| Some(face.families.get(0)?.0.clone()))
+ .collect_vec()
}
fn font_id(&self, font: &Font) -> Result<FontId> {