Paragraph - opsz: auto
| feature id | status | description | PRs |
|---|---|---|---|
opsz-auto | supported | support optical size auto like major browser does | #415 |
What is optical size (opsz)?
Optical size is a type design concept: at small sizes, glyphs need more weight/contrast and looser spacing to remain legible; at large sizes, they can be finer and tighter. In modern OpenType variable fonts this is encoded as the opsz variation axis. When opsz changes, the design of the outline itself changes (different curves/ink traps/joins), not just the scale.
Key points:
opszis available only if the font provides the axis.- It controls the design of glyphs for legibility at different sizes.
- Browsers support automatic optical sizing via
font-optical-sizing: auto. - Authors can disable or override optical sizing manually.
How we implement
- If font has
opszaxis and mode is Auto → setopsz=font_size, clamped to min/max. - If Fixed(v) → set
opsz= v clamped to min/max. - If None or no axis → don’t set
opsz(use default).
Rust model (author intent):
pub enum OpticalSizing {
Auto, // link opsz to font_size (if axis exists)
None, // uses the default `opsz` value if one.
Fixed(f32), // explicit opsz value; disables Auto
}
Notes
opszonly works if the font provides it.- Designers usually align
opszvalues with point sizes, but clamp to [min, max] to be safe. - Auto links to logical
font_size, not device zoom. - No faux optical sizing is applied if no
opszaxis (optional contrast hacks possible).
See Also
- Skia does not support variable axes (including
opsz) withopsz: autoor dynamic font size. Skia Discuss -opsz: auto - Microsoft OpenType Specification - Design Variation Axis Tag Registry -
opsz - font-variation-settings - MDN
- font-optical-sizing - MDN
- font-size - MDN
- Google Fonts - Optical Size Axis