본문으로 건너뛰기

Paragraph - opsz: auto

feature idstatusdescriptionPRs
opsz-autosupportedsupport 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 → set opsz = 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