This is something new to digital fonts and CSS, but is a centuries-old technique in designing and creating metal type. Optical sizing refers to the practice of varying the overall stroke thickness of letterforms based on physical size. If the size was very small (such as an equivalent to 10 or 12px), the characters would have an overall thicker stroke, and perhaps other small modifications to ensure that it would reproduce and be readable at a physically smaller size. Conversely, when a much larger size was being used (like 48 or 60px), there might be much greater variation in thick and thin stroke weights, showing the typeface design more in line with the original intent.
While this was originally done to compensate for the ink and paper printing process (very thin lines at small sizes often didn't print, giving the letterforms a broken appearance), it translates well to digital displays when compensating for screen quality and physical size rendering.
Optical size values are generally intended to be automatically applied corresponding to font-size
, but can also be manipulated using the lower-level font-variation-settings
syntax.
There is a new attribute, font-optical-sizing
, created to support variable fonts in CSS. When using font-optical-sizing
, the only allowed values are auto
or none
— so this attribute only allows for turning optical sizing on or off. However when using font-variation-settings: 'opsz' <num>
, you can supply a numeric value. In most cases you would want to match the font-size
(the physical size the type is being rendered) with the opsz
value (which is how optical sizing is intended to be applied when using auto
). The option to provide a specific value is provided so that should it be necessary to override the default — for legibility, aesthetic, or some other reason — a specific value can be applied.
font-optical-sizing: auto;
font-variation-settings: "opsz" 36;
The following live example's CSS can be edited to allow you to play with optical size values.