This commit is contained in:
Stewart Connor 2025-03-26 17:45:21 +11:00
parent dc03df8986
commit 03180dd9ee

View file

@ -157,27 +157,22 @@ impl FeatureTag {
}
}
/// Font feature with tag and value
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub struct Feature {
pub tag: FeatureTag,
pub value: u32,
}
/// Font features for text shaping
#[derive(Clone, Debug, Default, Eq, Hash, PartialEq)]
pub struct FontFeatures {
/// List of OpenType features with their values (0 = disabled, 1 = enabled)
pub features: Vec<Feature>,
}
impl FontFeatures {
/// Create new font features with default settings
pub fn new() -> Self {
Self { features: Vec::new() }
}
/// Set a feature value
pub fn set(&mut self, tag: FeatureTag, value: u32) -> &mut Self {
self.features.push(Feature { tag, value });
self