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:
opsz
is 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
opsz
axis 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
opsz
only works if the font provides it.- Designers usually align
opsz
values 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
opsz
axis (optional contrast hacks possible).
See Also
- Skia does not support variable axes (including
opsz
) withopsz: auto
or 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