Docs
You are viewing an older version (0.0.5).
Go to the latest.
Customizing Letter Spacing
Manage character spacing through WindTheme: pre-defined keys, arbitrary values, and runtime customization.
WindTheme.setLetterSpacing('extra-wide', 0.15);
double spacing = WindTheme.getLetterSpacing('wide'); // 0.025
Default Letter Spacings
WindTheme defines several pre-defined letter spacings mapped to descriptive keys. Values are in em units.
| Key | Value (em) | Description |
|---|---|---|
tighter |
-0.05 |
Very tight spacing |
tight |
-0.025 |
Tight spacing |
normal |
0 |
Default spacing |
wide |
0.025 |
Wide spacing |
wider |
0.05 |
Very wide spacing |
widest |
0.1 |
Extremely wide spacing |
For example:
tracking-tightapplies a letter spacing of -0.025em.tracking-wideapplies a letter spacing of 0.025em.
Arbitrary Letter Spacings
For values outside the scale, use the tracking-[value] syntax, where value is the desired spacing in em units.
tracking-[0.1]applies a letter spacing of 0.1em.tracking-[0.3]applies a letter spacing of 0.3em.
Managing Letter Spacings
WindTheme provides methods to check, retrieve, add, and remove letter spacings at runtime.
// Check whether a letter spacing exists
bool exists = WindTheme.hasLetterSpacing('normal');
print(exists); // Output: true
// Retrieve a letter spacing value
double spacing = WindTheme.getLetterSpacing('wide');
print(spacing); // Output: 0.025
// Add a custom letter spacing
WindTheme.setLetterSpacing('extra-wide', 0.15);
// Update an existing letter spacing
WindTheme.setLetterSpacing('wide', 0.03);
// Remove a letter spacing
WindTheme.removeLetterSpacing('extra-wide');
Related Documentation
- Letter Spacing Utilities — apply spacing with
tracking-* - Line Height — customize line height keys
- Font Size — customize the typographic scale