WIP

Antonio Scandurra created

Change summary

crates/gpui2/src/app.rs         | 4 ++++
crates/gpui2/src/text_system.rs | 4 ++++
crates/zed2/src/main.rs         | 3 +--
3 files changed, 9 insertions(+), 2 deletions(-)

Detailed changes

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>;

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 {

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();
 }