diff --git a/crates/gpui/src/text_system/font_features.rs b/crates/gpui/src/text_system/font_features.rs index ef6d76481a..db48db62ef 100644 --- a/crates/gpui/src/text_system/font_features.rs +++ b/crates/gpui/src/text_system/font_features.rs @@ -58,7 +58,7 @@ impl<'de> serde::Deserialize<'de> for FontFeatures { while let Some((key, value)) = access.next_entry::>()? { - if key.len() != 4 && !key.is_ascii() { + if !is_valid_feature_tag(&key) { log::error!("Incorrect font feature tag: {}", key); continue; } @@ -142,3 +142,15 @@ impl schemars::JsonSchema for FontFeatures { schema.into() } } + +fn is_valid_feature_tag(tag: &str) -> bool { + if tag.len() != 4 { + return false; + } + for ch in tag.chars() { + if !ch.is_ascii_alphanumeric() { + return false; + } + } + true +}