Overview
In fact these MultipleFontLetterSpacingSemanticToken, MultipleFontLineHeightSemanticToken and MultipleFontSizeSemanticToken classes will help users (i.e. developers) to handle one semantic token for font things depending to size class (whether it could be compact / mobile or regular / tablet). Because Figma is not able to manage pair of values for one token, and its produced JSON does not reflect this mecanism, the tokenator cannot provide such MultipleFontLetterSpacingSemanticToken, MultipleFontLineHeightSemanticToken and MultipleFontSizeSemanticToken tokens. Thus the “real” letter spacing, line height and font size tokens are declared in FontSemanticTokens protocol and defined inside OUDSTheme (to be overridable then by subthemes). These tokens are updated by the tokenator. Then they are gathered and wrapped so as to be used easily thanks to this FontMultipleSemanticTokens which must be updated manually.
However the composite tokens (here the ones gathering each type of semantic token here) are defined in FontCompositeSemanticTokens because the tokenator is not able to generate them yet, and they must be defined elsewhere to not be deleted.
In few words:
// Some font size raw tokens, defined by the tokenator (in FontRawTokens+Values.swift)
public static let size850: FontSizeRawToken = 40
public static let size1450: FontSizeRawToken = 64
// The font size semantic tokens using them
// declared (in FontMultipleSemanticTokens.swift) and defined (in OUDSTheme+FontSemanticTokens.swift) by the tokenator
var sizeDisplayLargeMobile: FontSizeSemanticToken { FontRawTokens.size850 }
var sizeDisplayLargeTablet: FontSizeSemanticToken { FontRawTokens.size1450 }
// The 'higher level' font semantic tokens wrapping them and exposed to users
// declared (in this FontMultipleSemanticTokens.swift) and defined manualy (in OUDSTheme+FontMultipleSemanticTokens.swift)
var sizeDisplayLarge: MultipleFontSizeSemanticToken { MultipleFontSizeSemanticToken(compact: sizeDisplayLargeMobile, regular: sizeDisplayLargeTablet) }
// Thus users can in their components use colorNone as defined in their design system
// (even if they are still able to use 'lower level' semantic tokens but it is more error-prone)
Since
0.8.0
Topics
Instance Properties