-
Notifications
You must be signed in to change notification settings - Fork 747
Description
#10674 and #12380 have introduced env(preferred-text-scale)
and <meta name="text-scale">
to allow authors to respect the user's text scale preference. The user can increase their text scale either in their OS settings or sometimes (currently just on desktop browsers) in their UA settings. When the meta
tag is set to the scale
keyword, the initial font size will change depending on the user's text scale preference.
The font-size
property accepts absolute font-size keywords, which are sized in proportion to medium
, which is the initial font size.
[ xx-small | x-small | small | medium | large | x-large | xx-large | xxx-large ]
Depending on how the user increases or decreases their text scale preference from the default, they risk making xx-small
too small to be readable and xxx-large
so large that it takes up too much screen real estate.
Should the absolute font size keywords use different scaling factors depending on the size of the user's text scale preference?
Note
For example, if the user sets a really big text scale like 200%, what should happen? By default, medium
is 16px
, so the xxx-large
font-size is 48px. Therefore, if medium
is increased by 200% to 32px
, so the xxx-large
font-size is 96px.
Is that too big? The user desires the body text to be doubled to 32px, but do they really need a 96px heading? That will take up a lot of screen real estate, which is more of a problem on smaller viewports/mobile devices.
Also, are there ways other than the absolute size keywords that authors can achieve this?
Prior work
Apple OSs' system fonts scale at different rates depending on the user's text scale setting (referred to as 'Dynamic Type').
WebKit defines proprietary font
shorthand property values for getting the system dynamic type fonts. For example:
font: -apple-system-body;
font: -apple-system-headline;
font: -apple-system-subheadline;
These wouldn't just set the macOS or iOS standard font-sizes but also the system font-family.
It was previously discussed for standardisation back in 2015.