From b2c733baab2de1abd2dffa478069b878cfb4a32a Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 17 Mar 2023 09:51:07 +0100 Subject: [PATCH] WIP: Allow specifying font features in the editor This just lays the foundation for threading through a `fonts::Features` struct, but it's not used yet. --- Cargo.lock | 1 + assets/settings/default.json | 4 ++ crates/editor/src/display_map.rs | 33 +++++++++++---- crates/editor/src/display_map/block_map.rs | 15 +++++-- crates/editor/src/display_map/wrap_map.rs | 4 +- crates/editor/src/movement.rs | 5 ++- crates/editor/src/test.rs | 5 ++- crates/gpui/Cargo.toml | 1 + crates/gpui/examples/text.rs | 5 ++- crates/gpui/src/elements/label.rs | 2 + crates/gpui/src/font_cache.rs | 35 +++++++++++++--- crates/gpui/src/fonts.rs | 16 ++++++-- crates/gpui/src/platform.rs | 7 +++- crates/gpui/src/platform/mac/fonts.rs | 20 ++++----- crates/gpui/src/text_layout.rs | 8 +++- crates/settings/src/settings.rs | 43 +++++++++++++++++--- crates/terminal_view/src/terminal_element.rs | 7 +++- 17 files changed, 167 insertions(+), 44 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b111ab7190..a9c572ba6c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2664,6 +2664,7 @@ dependencies = [ "postage", "rand 0.8.5", "resvg", + "schemars", "seahash", "serde", "serde_json", diff --git a/assets/settings/default.json b/assets/settings/default.json index add664f956..2f7ced922d 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -3,6 +3,10 @@ "theme": "One Dark", // The name of a font to use for rendering text in the editor "buffer_font_family": "Zed Mono", + // The OpenType features to enable for text in the editor. + "buffer_font_features": { + "calt": true + }, // The default font size for text in the editor "buffer_font_size": 15, // The factor to grow the active pane by. Defaults to 1.0 diff --git a/crates/editor/src/display_map.rs b/crates/editor/src/display_map.rs index 500f3626e3..6684d0ae56 100644 --- a/crates/editor/src/display_map.rs +++ b/crates/editor/src/display_map.rs @@ -785,7 +785,9 @@ pub mod tests { let mut tab_size = rng.gen_range(1..=4); let buffer_start_excerpt_header_height = rng.gen_range(1..=5); let excerpt_header_height = rng.gen_range(1..=5); - let family_id = font_cache.load_family(&["Helvetica"]).unwrap(); + let family_id = font_cache + .load_family(&["Helvetica"], Default::default()) + .unwrap(); let font_id = font_cache .select_font(family_id, &Default::default()) .unwrap(); @@ -1042,7 +1044,9 @@ pub mod tests { let font_cache = cx.font_cache(); - let family_id = font_cache.load_family(&["Helvetica"]).unwrap(); + let family_id = font_cache + .load_family(&["Helvetica"], Default::default()) + .unwrap(); let font_id = font_cache .select_font(family_id, &Default::default()) .unwrap(); @@ -1131,7 +1135,10 @@ pub mod tests { cx.set_global(Settings::test(cx)); let text = sample_text(6, 6, 'a'); let buffer = MultiBuffer::build_simple(&text, cx); - let family_id = cx.font_cache().load_family(&["Helvetica"]).unwrap(); + let family_id = cx + .font_cache() + .load_family(&["Helvetica"], Default::default()) + .unwrap(); let font_id = cx .font_cache() .select_font(family_id, &Default::default()) @@ -1214,7 +1221,9 @@ pub mod tests { let buffer = cx.add_model(|cx| MultiBuffer::singleton(buffer, cx)); let font_cache = cx.font_cache(); - let family_id = font_cache.load_family(&["Helvetica"]).unwrap(); + let family_id = font_cache + .load_family(&["Helvetica"], Default::default()) + .unwrap(); let font_id = font_cache .select_font(family_id, &Default::default()) .unwrap(); @@ -1302,7 +1311,9 @@ pub mod tests { let font_cache = cx.font_cache(); - let family_id = font_cache.load_family(&["Courier"]).unwrap(); + let family_id = font_cache + .load_family(&["Courier"], Default::default()) + .unwrap(); let font_id = font_cache .select_font(family_id, &Default::default()) .unwrap(); @@ -1374,7 +1385,9 @@ pub mod tests { let buffer_snapshot = buffer.read_with(cx, |buffer, cx| buffer.snapshot(cx)); let font_cache = cx.font_cache(); - let family_id = font_cache.load_family(&["Courier"]).unwrap(); + let family_id = font_cache + .load_family(&["Courier"], Default::default()) + .unwrap(); let font_id = font_cache .select_font(family_id, &Default::default()) .unwrap(); @@ -1490,7 +1503,9 @@ pub mod tests { let text = "✅\t\tα\nβ\t\n🏀β\t\tγ"; let buffer = MultiBuffer::build_simple(text, cx); let font_cache = cx.font_cache(); - let family_id = font_cache.load_family(&["Helvetica"]).unwrap(); + let family_id = font_cache + .load_family(&["Helvetica"], Default::default()) + .unwrap(); let font_id = font_cache .select_font(family_id, &Default::default()) .unwrap(); @@ -1548,7 +1563,9 @@ pub mod tests { cx.set_global(Settings::test(cx)); let buffer = MultiBuffer::build_simple("aaa\n\t\tbbb", cx); let font_cache = cx.font_cache(); - let family_id = font_cache.load_family(&["Helvetica"]).unwrap(); + let family_id = font_cache + .load_family(&["Helvetica"], Default::default()) + .unwrap(); let font_id = font_cache .select_font(family_id, &Default::default()) .unwrap(); diff --git a/crates/editor/src/display_map/block_map.rs b/crates/editor/src/display_map/block_map.rs index 797f41c52a..aeeb7bcc44 100644 --- a/crates/editor/src/display_map/block_map.rs +++ b/crates/editor/src/display_map/block_map.rs @@ -1015,7 +1015,10 @@ mod tests { fn test_basic_blocks(cx: &mut gpui::MutableAppContext) { cx.set_global(Settings::test(cx)); - let family_id = cx.font_cache().load_family(&["Helvetica"]).unwrap(); + let family_id = cx + .font_cache() + .load_family(&["Helvetica"], Default::default()) + .unwrap(); let font_id = cx .font_cache() .select_font(family_id, &Default::default()) @@ -1185,7 +1188,10 @@ mod tests { fn test_blocks_on_wrapped_lines(cx: &mut gpui::MutableAppContext) { cx.set_global(Settings::test(cx)); - let family_id = cx.font_cache().load_family(&["Helvetica"]).unwrap(); + let family_id = cx + .font_cache() + .load_family(&["Helvetica"], Default::default()) + .unwrap(); let font_id = cx .font_cache() .select_font(family_id, &Default::default()) @@ -1241,7 +1247,10 @@ mod tests { Some(rng.gen_range(0.0..=100.0)) }; let tab_size = 1.try_into().unwrap(); - let family_id = cx.font_cache().load_family(&["Helvetica"]).unwrap(); + let family_id = cx + .font_cache() + .load_family(&["Helvetica"], Default::default()) + .unwrap(); let font_id = cx .font_cache() .select_font(family_id, &Default::default()) diff --git a/crates/editor/src/display_map/wrap_map.rs b/crates/editor/src/display_map/wrap_map.rs index 6c34fa4797..deb7be3e68 100644 --- a/crates/editor/src/display_map/wrap_map.rs +++ b/crates/editor/src/display_map/wrap_map.rs @@ -1053,7 +1053,9 @@ mod tests { Some(rng.gen_range(0.0..=1000.0)) }; let tab_size = NonZeroU32::new(rng.gen_range(1..=4)).unwrap(); - let family_id = font_cache.load_family(&["Helvetica"]).unwrap(); + let family_id = font_cache + .load_family(&["Helvetica"], Default::default()) + .unwrap(); let font_id = font_cache .select_font(family_id, &Default::default()) .unwrap(); diff --git a/crates/editor/src/movement.rs b/crates/editor/src/movement.rs index 0ede6186da..f554c88a47 100644 --- a/crates/editor/src/movement.rs +++ b/crates/editor/src/movement.rs @@ -587,7 +587,10 @@ mod tests { #[gpui::test] fn test_move_up_and_down_with_excerpts(cx: &mut gpui::MutableAppContext) { cx.set_global(Settings::test(cx)); - let family_id = cx.font_cache().load_family(&["Helvetica"]).unwrap(); + let family_id = cx + .font_cache() + .load_family(&["Helvetica"], Default::default()) + .unwrap(); let font_id = cx .font_cache() .select_font(family_id, &Default::default()) diff --git a/crates/editor/src/test.rs b/crates/editor/src/test.rs index 48652c44b7..8024986ec5 100644 --- a/crates/editor/src/test.rs +++ b/crates/editor/src/test.rs @@ -25,7 +25,10 @@ pub fn marked_display_snapshot( ) -> (DisplaySnapshot, Vec) { let (unmarked_text, markers) = marked_text_offsets(text); - let family_id = cx.font_cache().load_family(&["Helvetica"]).unwrap(); + let family_id = cx + .font_cache() + .load_family(&["Helvetica"], Default::default()) + .unwrap(); let font_id = cx .font_cache() .select_font(family_id, &Default::default()) diff --git a/crates/gpui/Cargo.toml b/crates/gpui/Cargo.toml index 7be254be4d..b3e9bda4ec 100644 --- a/crates/gpui/Cargo.toml +++ b/crates/gpui/Cargo.toml @@ -39,6 +39,7 @@ pathfinder_geometry = "0.5" postage = { version = "0.4.1", features = ["futures-traits"] } rand = "0.8.3" resvg = "0.14" +schemars = "0.8" seahash = "4.1" serde = { version = "1.0", features = ["derive", "rc"] } serde_json = "1.0" diff --git a/crates/gpui/examples/text.rs b/crates/gpui/examples/text.rs index 4d84fefab6..82413787c6 100644 --- a/crates/gpui/examples/text.rs +++ b/crates/gpui/examples/text.rs @@ -56,7 +56,10 @@ impl gpui::Element for TextElement { cx: &mut gpui::PaintContext, ) -> Self::PaintState { let font_size = 12.; - let family = cx.font_cache.load_family(&["SF Pro Display"]).unwrap(); + let family = cx + .font_cache + .load_family(&["SF Pro Display"], Default::default()) + .unwrap(); let normal = RunStyle { font_id: cx .font_cache diff --git a/crates/gpui/src/elements/label.rs b/crates/gpui/src/elements/label.rs index b7ac1938e3..aae00b07a8 100644 --- a/crates/gpui/src/elements/label.rs +++ b/crates/gpui/src/elements/label.rs @@ -216,6 +216,7 @@ mod tests { 12., Default::default(), Default::default(), + Default::default(), Color::black(), cx.font_cache(), ) @@ -225,6 +226,7 @@ mod tests { 12., *FontProperties::new().weight(Weight::BOLD), Default::default(), + Default::default(), Color::new(255, 0, 0, 255), cx.font_cache(), ) diff --git a/crates/gpui/src/font_cache.rs b/crates/gpui/src/font_cache.rs index 3631cbe724..e2884f038f 100644 --- a/crates/gpui/src/font_cache.rs +++ b/crates/gpui/src/font_cache.rs @@ -1,5 +1,5 @@ use crate::{ - fonts::{FontId, Metrics, Properties}, + fonts::{Features, FontId, Metrics, Properties}, geometry::vector::{vec2f, Vector2F}, platform, text_layout::LineWrapper, @@ -18,6 +18,7 @@ pub struct FamilyId(usize); struct Family { name: Arc, + font_features: Features, font_ids: Vec, } @@ -58,17 +59,21 @@ impl FontCache { .map(|family| family.name.clone()) } - pub fn load_family(&self, names: &[&str]) -> Result { + pub fn load_family(&self, names: &[&str], features: Features) -> Result { for name in names { let state = self.0.upgradable_read(); - if let Some(ix) = state.families.iter().position(|f| f.name.as_ref() == *name) { + if let Some(ix) = state + .families + .iter() + .position(|f| f.name.as_ref() == *name && f.font_features == features) + { return Ok(FamilyId(ix)); } let mut state = RwLockUpgradableReadGuard::upgrade(state); - if let Ok(font_ids) = state.fonts.load_family(name) { + if let Ok(font_ids) = state.fonts.load_family(name, &features) { if font_ids.is_empty() { continue; } @@ -82,6 +87,7 @@ impl FontCache { state.families.push(Family { name: Arc::from(*name), + font_features: features, font_ids, }); return Ok(family_id); @@ -254,7 +260,15 @@ mod tests { fn test_select_font() { let platform = test::platform(); let fonts = FontCache::new(platform.fonts()); - let arial = fonts.load_family(&["Arial"]).unwrap(); + let arial = fonts + .load_family( + &["Arial"], + Features { + calt: Some(false), + ..Default::default() + }, + ) + .unwrap(); let arial_regular = fonts.select_font(arial, &Properties::new()).unwrap(); let arial_italic = fonts .select_font(arial, Properties::new().style(Style::Italic)) @@ -265,5 +279,16 @@ mod tests { assert_ne!(arial_regular, arial_italic); assert_ne!(arial_regular, arial_bold); assert_ne!(arial_italic, arial_bold); + + let arial_with_calt = fonts + .load_family( + &["Arial"], + Features { + calt: Some(true), + ..Default::default() + }, + ) + .unwrap(); + assert_ne!(arial_with_calt, arial); } } diff --git a/crates/gpui/src/fonts.rs b/crates/gpui/src/fonts.rs index 5c49ddcf61..86ed46bc46 100644 --- a/crates/gpui/src/fonts.rs +++ b/crates/gpui/src/fonts.rs @@ -11,7 +11,8 @@ pub use font_kit::{ properties::{Properties, Stretch, Style, Weight}, }; use ordered_float::OrderedFloat; -use serde::{de, Deserialize}; +use schemars::JsonSchema; +use serde::{de, Deserialize, Serialize}; use serde_json::Value; use std::{cell::RefCell, sync::Arc}; @@ -20,6 +21,11 @@ pub struct FontId(pub usize); pub type GlyphId = u32; +#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, Serialize, Deserialize, JsonSchema)] +pub struct Features { + pub calt: Option, +} + #[derive(Clone, Debug)] pub struct TextStyle { pub color: Color, @@ -107,12 +113,13 @@ impl TextStyle { font_family_name: impl Into>, font_size: f32, font_properties: Properties, + font_features: Features, underline: Underline, color: Color, font_cache: &FontCache, ) -> Result { let font_family_name = font_family_name.into(); - let font_family_id = font_cache.load_family(&[&font_family_name])?; + let font_family_id = font_cache.load_family(&[&font_family_name], font_features)?; let font_id = font_cache.select_font(font_family_id, &font_properties)?; Ok(Self { color, @@ -175,6 +182,7 @@ impl TextStyle { json.family, json.size, font_properties, + Default::default(), underline_from_json(json.underline), json.color, font_cache, @@ -253,7 +261,9 @@ impl Default for TextStyle { .expect("TextStyle::default can only be called within a call to with_font_cache"); let font_family_name = Arc::from("Courier"); - let font_family_id = font_cache.load_family(&[&font_family_name]).unwrap(); + let font_family_id = font_cache + .load_family(&[&font_family_name], Default::default()) + .unwrap(); let font_id = font_cache .select_font(font_family_id, &Default::default()) .unwrap(); diff --git a/crates/gpui/src/platform.rs b/crates/gpui/src/platform.rs index 4c1ba49690..538b46ee77 100644 --- a/crates/gpui/src/platform.rs +++ b/crates/gpui/src/platform.rs @@ -9,7 +9,10 @@ pub mod current { use crate::{ executor, - fonts::{FontId, GlyphId, Metrics as FontMetrics, Properties as FontProperties}, + fonts::{ + Features as FontFeatures, FontId, GlyphId, Metrics as FontMetrics, + Properties as FontProperties, + }, geometry::{ rect::{RectF, RectI}, vector::Vector2F, @@ -335,7 +338,7 @@ pub enum RasterizationOptions { pub trait FontSystem: Send + Sync { fn add_fonts(&self, fonts: &[Arc>]) -> anyhow::Result<()>; - fn load_family(&self, name: &str) -> anyhow::Result>; + fn load_family(&self, name: &str, features: &FontFeatures) -> anyhow::Result>; fn select_font( &self, font_ids: &[FontId], diff --git a/crates/gpui/src/platform/mac/fonts.rs b/crates/gpui/src/platform/mac/fonts.rs index f39d548049..98ed541e35 100644 --- a/crates/gpui/src/platform/mac/fonts.rs +++ b/crates/gpui/src/platform/mac/fonts.rs @@ -1,5 +1,5 @@ use crate::{ - fonts::{FontId, GlyphId, Metrics, Properties}, + fonts::{Features, FontId, GlyphId, Metrics, Properties}, geometry::{ rect::{RectF, RectI}, transform2d::Transform2F, @@ -64,8 +64,8 @@ impl platform::FontSystem for FontSystem { self.0.write().add_fonts(fonts) } - fn load_family(&self, name: &str) -> anyhow::Result> { - self.0.write().load_family(name) + fn load_family(&self, name: &str, features: &Features) -> anyhow::Result> { + self.0.write().load_family(name, features) } fn select_font(&self, font_ids: &[FontId], properties: &Properties) -> anyhow::Result { @@ -126,7 +126,7 @@ impl FontSystemState { Ok(()) } - fn load_family(&mut self, name: &str) -> anyhow::Result> { + fn load_family(&mut self, name: &str, features: &Features) -> anyhow::Result> { let mut font_ids = Vec::new(); let family = self @@ -503,7 +503,7 @@ mod tests { fn test_layout_str(_: &mut MutableAppContext) { // This is failing intermittently on CI and we don't have time to figure it out let fonts = FontSystem::new(); - let menlo = fonts.load_family("Menlo").unwrap(); + let menlo = fonts.load_family("Menlo", &Default::default()).unwrap(); let menlo_regular = RunStyle { font_id: fonts.select_font(&menlo, &Properties::new()).unwrap(), color: Default::default(), @@ -544,13 +544,13 @@ mod tests { #[test] fn test_glyph_offsets() -> anyhow::Result<()> { let fonts = FontSystem::new(); - let zapfino = fonts.load_family("Zapfino")?; + let zapfino = fonts.load_family("Zapfino", &Default::default())?; let zapfino_regular = RunStyle { font_id: fonts.select_font(&zapfino, &Properties::new())?, color: Default::default(), underline: Default::default(), }; - let menlo = fonts.load_family("Menlo")?; + let menlo = fonts.load_family("Menlo", &Default::default())?; let menlo_regular = RunStyle { font_id: fonts.select_font(&menlo, &Properties::new())?, color: Default::default(), @@ -584,7 +584,7 @@ mod tests { use std::{fs::File, io::BufWriter, path::Path}; let fonts = FontSystem::new(); - let font_ids = fonts.load_family("Fira Code").unwrap(); + let font_ids = fonts.load_family("Fira Code", &Default::default()).unwrap(); let font_id = fonts.select_font(&font_ids, &Default::default()).unwrap(); let glyph_id = fonts.glyph_for_char(font_id, 'G').unwrap(); @@ -618,7 +618,7 @@ mod tests { #[test] fn test_wrap_line() { let fonts = FontSystem::new(); - let font_ids = fonts.load_family("Helvetica").unwrap(); + let font_ids = fonts.load_family("Helvetica", &Default::default()).unwrap(); let font_id = fonts.select_font(&font_ids, &Default::default()).unwrap(); let line = "one two three four five\n"; @@ -636,7 +636,7 @@ mod tests { #[test] fn test_layout_line_bom_char() { let fonts = FontSystem::new(); - let font_ids = fonts.load_family("Helvetica").unwrap(); + let font_ids = fonts.load_family("Helvetica", &Default::default()).unwrap(); let style = RunStyle { font_id: fonts.select_font(&font_ids, &Default::default()).unwrap(), color: Default::default(), diff --git a/crates/gpui/src/text_layout.rs b/crates/gpui/src/text_layout.rs index 8fd10a6018..654922ea2d 100644 --- a/crates/gpui/src/text_layout.rs +++ b/crates/gpui/src/text_layout.rs @@ -663,7 +663,9 @@ mod tests { fn test_wrap_line(cx: &mut crate::MutableAppContext) { let font_cache = cx.font_cache().clone(); let font_system = cx.platform().fonts(); - let family = font_cache.load_family(&["Courier"]).unwrap(); + let family = font_cache + .load_family(&["Courier"], Default::default()) + .unwrap(); let font_id = font_cache.select_font(family, &Default::default()).unwrap(); let mut wrapper = LineWrapper::new(font_id, 16., font_system); @@ -725,7 +727,9 @@ mod tests { let font_system = cx.platform().fonts(); let text_layout_cache = TextLayoutCache::new(font_system.clone()); - let family = font_cache.load_family(&["Helvetica"]).unwrap(); + let family = font_cache + .load_family(&["Helvetica"], Default::default()) + .unwrap(); let font_id = font_cache.select_font(family, &Default::default()).unwrap(); let normal = RunStyle { font_id, diff --git a/crates/settings/src/settings.rs b/crates/settings/src/settings.rs index 3dc0769a4b..33977a42e6 100644 --- a/crates/settings/src/settings.rs +++ b/crates/settings/src/settings.rs @@ -5,7 +5,7 @@ pub mod watched_json; use anyhow::{bail, Result}; use gpui::{ font_cache::{FamilyId, FontCache}, - AssetSource, + fonts, AssetSource, }; use schemars::{ gen::{SchemaGenerator, SchemaSettings}, @@ -28,6 +28,8 @@ pub use watched_json::watch_files; #[derive(Clone)] pub struct Settings { + pub buffer_font_family_name: String, + pub buffer_font_features: fonts::Features, pub buffer_font_family: FamilyId, pub default_buffer_font_size: f32, pub buffer_font_size: f32, @@ -332,6 +334,8 @@ pub struct SettingsFileContent { #[serde(default)] pub buffer_font_size: Option, #[serde(default)] + pub buffer_font_features: Option, + #[serde(default)] pub active_pane_magnification: Option, #[serde(default)] pub cursor_blink: Option, @@ -396,10 +400,16 @@ impl Settings { ) .unwrap(); + let buffer_font_features = defaults.buffer_font_features.unwrap(); Self { buffer_font_family: font_cache - .load_family(&[defaults.buffer_font_family.as_ref().unwrap()]) + .load_family( + &[defaults.buffer_font_family.as_ref().unwrap()], + buffer_font_features, + ) .unwrap(), + buffer_font_family_name: defaults.buffer_font_family.unwrap(), + buffer_font_features, buffer_font_size: defaults.buffer_font_size.unwrap(), active_pane_magnification: defaults.active_pane_magnification.unwrap(), default_buffer_font_size: defaults.buffer_font_size.unwrap(), @@ -451,11 +461,24 @@ impl Settings { theme_registry: &ThemeRegistry, font_cache: &FontCache, ) { - if let Some(value) = &data.buffer_font_family { - if let Some(id) = font_cache.load_family(&[value]).log_err() { + let mut family_changed = false; + if let Some(value) = data.buffer_font_family { + self.buffer_font_family_name = value; + family_changed = true; + } + if let Some(value) = data.buffer_font_features { + self.buffer_font_features = value; + family_changed = true; + } + if family_changed { + if let Some(id) = font_cache + .load_family(&[&self.buffer_font_family_name], self.buffer_font_features) + .log_err() + { self.buffer_font_family = id; } } + if let Some(value) = &data.theme { if let Some(theme) = theme_registry.get(value).log_err() { self.theme = theme; @@ -482,7 +505,10 @@ impl Settings { // Ensure terminal font is loaded, so we can request it in terminal_element layout if let Some(terminal_font) = &data.terminal.font_family { - font_cache.load_family(&[terminal_font]).log_err(); + // TODO: enable font features for the terminal as well. + font_cache + .load_family(&[terminal_font], Default::default()) + .log_err(); } self.editor_overrides = data.editor; @@ -616,7 +642,12 @@ impl Settings { #[cfg(any(test, feature = "test-support"))] pub fn test(cx: &gpui::AppContext) -> Settings { Settings { - buffer_font_family: cx.font_cache().load_family(&["Monaco"]).unwrap(), + buffer_font_family_name: "Monaco".to_string(), + buffer_font_features: Default::default(), + buffer_font_family: cx + .font_cache() + .load_family(&["Monaco"], Default::default()) + .unwrap(), buffer_font_size: 14., active_pane_magnification: 1., default_buffer_font_size: 14., diff --git a/crates/terminal_view/src/terminal_element.rs b/crates/terminal_view/src/terminal_element.rs index 5d03d6304e..fc72016d9b 100644 --- a/crates/terminal_view/src/terminal_element.rs +++ b/crates/terminal_view/src/terminal_element.rs @@ -505,13 +505,18 @@ impl TerminalElement { ///Configures a text style from the current settings. pub fn make_text_style(font_cache: &FontCache, settings: &Settings) -> TextStyle { + // TODO allow font features // Pull the font family from settings properly overriding let family_id = settings .terminal_overrides .font_family .as_ref() .or(settings.terminal_defaults.font_family.as_ref()) - .and_then(|family_name| font_cache.load_family(&[family_name]).log_err()) + .and_then(|family_name| { + font_cache + .load_family(&[family_name], Default::default()) + .log_err() + }) .unwrap_or(settings.buffer_font_family); let font_size = settings