From dc03df8986c0bce710720d774de55e6d84fd4d22 Mon Sep 17 00:00:00 2001 From: Stewart Connor Date: Wed, 26 Mar 2025 17:43:13 +1100 Subject: [PATCH] Add comments --- src/attrs.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/attrs.rs b/src/attrs.rs index 24d515b..2a2d4c4 100644 --- a/src/attrs.rs +++ b/src/attrs.rs @@ -124,28 +124,33 @@ impl From for Metrics { } } } - -/// OpenType feature tag +/// A 4-byte OpenType feature tag identifier #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub struct FeatureTag([u8; 4]); impl FeatureTag { - /// Create a new feature tag from a 4-character string pub const fn new(tag: &[u8; 4]) -> Self { Self(*tag) } - // Common OpenType features as constants + /// Kerning adjusts spacing between specific character pairs pub const KERNING: Self = Self::new(b"kern"); + /// Standard ligatures (fi, fl, etc.) pub const STANDARD_LIGATURES: Self = Self::new(b"liga"); + /// Contextual ligatures (context-dependent ligatures) pub const CONTEXTUAL_LIGATURES: Self = Self::new(b"clig"); + /// Contextual alternates (glyph substitutions based on context) pub const CONTEXTUAL_ALTERNATES: Self = Self::new(b"calt"); + /// Discretionary ligatures (optional stylistic ligatures) pub const DISCRETIONARY_LIGATURES: Self = Self::new(b"dlig"); + /// Small caps (lowercase to small capitals) pub const SMALL_CAPS: Self = Self::new(b"smcp"); + /// All small caps (uppercase and lowercase to small capitals) pub const ALL_SMALL_CAPS: Self = Self::new(b"c2sc"); + /// Stylistic Set 1 (font-specific alternate glyphs) pub const STYLISTIC_SET_1: Self = Self::new(b"ss01"); + /// Stylistic Set 2 (font-specific alternate glyphs) pub const STYLISTIC_SET_2: Self = Self::new(b"ss02"); - // Add more common features as needed pub fn as_bytes(&self) -> &[u8; 4] { &self.0