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.

WIP

Antonio Scandurra3740c9d852a6
diff --git a/crates/gpui2/src/app.rs b/crates/gpui2/src/app.rs
index b1ede0ff2d9..d3118323abc 100644
--- a/crates/gpui2/src/app.rs
+++ b/crates/gpui2/src/app.rs
@@ -95,6 +95,10 @@ impl App {
pub fn executor(&self) -> Executor {
self.0.lock().executor.clone()
}
+
+ pub fn text_system(&self) -> Arc<TextSystem> {
+ self.0.lock().text_system.clone()
+ }
}
type Handler = Box<dyn Fn(&mut AppContext) -> bool + Send + Sync + 'static>;
diff --git a/crates/gpui2/src/text_system.rs b/crates/gpui2/src/text_system.rs
index 3b16bb506c1..7c96b1a180c 100644
--- a/crates/gpui2/src/text_system.rs
+++ b/crates/gpui2/src/text_system.rs
@@ -55,6 +55,10 @@ impl TextSystem {
}
}
+ pub fn add_fonts(&self, fonts: &[Arc<Vec<u8>>]) -> Result<()> {
+ self.platform_text_system.add_fonts(fonts)
+ }
+
pub fn font_id(&self, font: &Font) -> Result<FontId> {
let font_id = self.font_ids_by_font.read().get(font).copied();
if let Some(font_id) = font_id {
diff --git a/crates/zed2/src/main.rs b/crates/zed2/src/main.rs
index 9580ad480c1..f30e4873ebb 100644
--- a/crates/zed2/src/main.rs
+++ b/crates/zed2/src/main.rs
@@ -652,8 +652,7 @@ fn load_embedded_fonts(app: &App) {
});
}
}));
- app.platform()
- .fonts()
+ app.text_system()
.add_fonts(&embedded_fonts.into_inner())
.unwrap();
}