From 786d95b8c82e3281298df311c4be8e6b688e95f8 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 17 Mar 2023 15:12:02 +0100 Subject: [PATCH] Avoid storing `fonts::Features` in `TextStyle` We were only using it for debugging purposes and that was causing the `Theme` struct to become too big to hold on the stack. Co-Authored-By: Julia Risley --- crates/editor/src/editor.rs | 1 - crates/gpui/src/fonts.rs | 4 ---- crates/terminal_view/src/terminal_element.rs | 1 - crates/theme_testbench/src/theme_testbench.rs | 1 - 4 files changed, 7 deletions(-) diff --git a/crates/editor/src/editor.rs b/crates/editor/src/editor.rs index adcc4c1eba3b429c689f5967a901ecc2a42d6019..66169be652ee1402c2a6359095e709a7c89f1911 100644 --- a/crates/editor/src/editor.rs +++ b/crates/editor/src/editor.rs @@ -6779,7 +6779,6 @@ fn build_style( text: TextStyle { color: settings.theme.editor.text_color, font_family_name, - font_features: settings.buffer_font_features.clone(), font_family_id, font_id, font_size, diff --git a/crates/gpui/src/fonts.rs b/crates/gpui/src/fonts.rs index 02fd288d81df44365f66a75b1e0efc7adb543e51..e0f037acb8fe1ec5b954b049930fbaac0e69313f 100644 --- a/crates/gpui/src/fonts.rs +++ b/crates/gpui/src/fonts.rs @@ -63,7 +63,6 @@ pub struct Features { pub struct TextStyle { pub color: Color, pub font_family_name: Arc, - pub font_features: Features, pub font_family_id: FamilyId, pub font_id: FontId, pub font_size: f32, @@ -160,7 +159,6 @@ impl TextStyle { Ok(Self { color, font_family_name, - font_features, font_family_id, font_id, font_size, @@ -307,7 +305,6 @@ impl Default for TextStyle { Self { color: Default::default(), font_family_name, - font_features: Default::default(), font_family_id, font_id, font_size: 14., @@ -389,7 +386,6 @@ impl ToJson for TextStyle { json!({ "color": self.color.to_json(), "font_family": self.font_family_name.as_ref(), - "font_features": serde_json::to_value(&self.font_features).unwrap(), "font_properties": self.font_properties.to_json(), }) } diff --git a/crates/terminal_view/src/terminal_element.rs b/crates/terminal_view/src/terminal_element.rs index f3c8cd37422316789f5f6edddcb78d70d5815a3b..d530a9858203332f2cf2e3ca540ca4f132777cf0 100644 --- a/crates/terminal_view/src/terminal_element.rs +++ b/crates/terminal_view/src/terminal_element.rs @@ -537,7 +537,6 @@ impl TerminalElement { color: settings.theme.editor.text_color, font_family_id: family_id, font_family_name: font_cache.family_name(family_id).unwrap(), - font_features: font_features.clone(), font_id, font_size, font_properties: Default::default(), diff --git a/crates/theme_testbench/src/theme_testbench.rs b/crates/theme_testbench/src/theme_testbench.rs index 993e1bd8c3c818da5920cc9af815bbab55082181..ad01f51a1535f8d49928f272f42c49624c858ab7 100644 --- a/crates/theme_testbench/src/theme_testbench.rs +++ b/crates/theme_testbench/src/theme_testbench.rs @@ -243,7 +243,6 @@ impl ThemeTestbench { color: style.foreground, font_family_id: family_id, font_family_name: font_cache.family_name(family_id).unwrap(), - font_features: settings.buffer_font_features.clone(), font_id, font_size, font_properties: Default::default(),