Skip to content

Commit 051c015

Browse files
authored
[css-env-1] Add a text-scale env() (name to be bikeshedded). w3c#10674 (w3c#11961)
* [css-env-1] Add a text-scale env() (name to be bikeshedded). w3c#10674 * Switch to the resolved-on name, and fix wording of where the data comes from.
1 parent 2941ae1 commit 051c015

File tree

1 file changed

+53
-2
lines changed

1 file changed

+53
-2
lines changed

css-env-1/Overview.bs

Lines changed: 53 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ calculating the area between the position of the viewport segments.
215215

216216
<div class="example">
217217
When the viewport is split into two side-by-side segments, the viewport segment on
218-
the left would have indices (0, 0). It's width would be represented as
218+
the left would have indices (0, 0). Its width would be represented as
219219
''env(viewport-segment-width 0 0, 300px)''.
220220
The viewport segment on the right would have indices (1, 0).
221221
Similarly, for a viewport split into two vertical segments, the viewport segment
@@ -227,6 +227,57 @@ Viewport units should be used instead when there is no hardware feature
227227
splitting the viewport, otherwise content will not display as intended when
228228
viewed on a device with multiple segments.
229229

230+
Preferred Text Zoom {#text-zoom}
231+
--------------------------------
232+
233+
<table dfn-type=value dfn-for="env()">
234+
<tr>
235+
<th>Name
236+
<th>Value
237+
<th>Number of dimensions
238+
<tr>
239+
<td><dfn>preferred-text-scale</dfn>
240+
<td><<number>>
241+
<td>0 (scalar)
242+
</table>
243+
244+
The ''preferred-text-scale'' [=environment variable=]
245+
represents the user's preferred text scale factor;
246+
aka, the adjustment they make to the "default" font size
247+
of the OS and/or user agent.
248+
(On devices where 'text-size-adjust' has an effect,
249+
this is the scale factor applied by ''text-size-adjust: auto''.)
250+
251+
For example, if ''text-size-adjust:auto''
252+
would cause text sizes to double,
253+
then ''env(preferred-text-scale)'' would resolve to ''2''.
254+
255+
Note: The ''pem'' unit represents this same information;
256+
''1em'' is exactly equivalent to ''calc(1em * env(preferred-text-scale))''.
257+
When directly sizing things, ''bsem'' is just a more convenient length to use.
258+
259+
<div class=example>
260+
This [=environment variable=] requires care to be used correctly.
261+
By default, text scaling is applied automatically;
262+
using ''env(preferred-text-scale)'' or ''pem''
263+
would result in the scale being <em>double</em>-applied,
264+
making text or UI elements too large.
265+
266+
Typically, authors should either:
267+
268+
* set ''text-size-adjust: calc(100% * env(preferred-text-scale));'',
269+
to ensure that all the text in the page is automatically scaled
270+
to the user's preference,
271+
and when necessary scale non-text sizes by the scale factor as well.
272+
* or set ''text-size-adjust:none'',
273+
and then consistently use this [=environment variable=]
274+
and/or the ''pem'' unit
275+
to scale relevant text and UI to the user's preference.
276+
</div>
277+
278+
279+
280+
230281
Using Environment Variables: the ''env()'' notation {#env-function}
231282
===================================================================
232283

@@ -337,4 +388,4 @@ This specification provides read-only access
337388
to some new types of information about the device.
338389

339390
The [=environment variables=] defined by this specification
340-
do not expose any security-sensitive information.
391+
do not expose any security-sensitive information.

0 commit comments

Comments
 (0)