From 76167ca65c03d5af2c9e94cc3f1f0a86d14555d8 Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Fri, 17 Mar 2023 11:44:29 +0100 Subject: [PATCH] Allow setting font features on `TextStyle` --- crates/gpui/src/fonts.rs | 4 +++- styles/src/styleTree/components.ts | 7 ++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/crates/gpui/src/fonts.rs b/crates/gpui/src/fonts.rs index 298bc27d21a2c18188bb35198a65ec24aa54aa43..cd7d4e0444b33f71429ba3d0bbea2b39b09bfc77 100644 --- a/crates/gpui/src/fonts.rs +++ b/crates/gpui/src/fonts.rs @@ -78,6 +78,8 @@ thread_local! { struct TextStyleJson { color: Color, family: String, + #[serde(default)] + features: Features, weight: Option, size: f32, #[serde(default)] @@ -184,7 +186,7 @@ impl TextStyle { json.family, json.size, font_properties, - Default::default(), + json.features, underline_from_json(json.underline), json.color, font_cache, diff --git a/styles/src/styleTree/components.ts b/styles/src/styleTree/components.ts index 3f69df981e8124a343c3b534aced6261b72bf309..033c0c87254f81dad1d8c920db0ff9a9cff85b39 100644 --- a/styles/src/styleTree/components.ts +++ b/styles/src/styleTree/components.ts @@ -97,7 +97,12 @@ export interface TextProperties { size?: keyof typeof fontSizes weight?: FontWeight underline?: boolean - color?: string + color?: string, + features?: TextFeatures, +} + +interface TextFeatures { + calt?: boolean } export function text(