Skip to content

Commit 653a9a1

Browse files
committed
[css-env-1] Add a text-scale env() (name to be bikeshedded). #10674
1 parent 44891c4 commit 653a9a1

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

css-env-1/Overview.bs

Lines changed: 50 additions & 1 deletion
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,55 @@ 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>bikeshed-text-scale</dfn>
240+
<td><<number>>
241+
<td>0 (scalar)
242+
</table>
243+
244+
The ''bikeshed-text-scale'' [=environment variable=]
245+
represents the scale factor
246+
of the user agent's operating system font scale.
247+
(Aka, the scale factor applied by ''text-size-adjust: auto''.)
248+
249+
For example, if ''text-size-adjust:auto''
250+
would cause text sizes to double,
251+
then ''env(bikeshed-text-scale)'' would resolve to ''2''.
252+
253+
Note: The ''bsem'' unit represents this same information;
254+
''1em'' is exactly equivalent to ''calc(1em * env(bikeshed-text-scale))''.
255+
When directly sizing things, ''bsem'' is just a more convenient length to use.
256+
257+
<div class=example>
258+
This [=environment variable=] requires care to be used correctly.
259+
By default, text scaling is applied automatically;
260+
using ''env(bikeshed-text-scale)'' or ''bsem''
261+
would result in the scale being <em>double</em>-applied,
262+
making text or UI elements too large.
263+
264+
Typically, authors should either:
265+
266+
* set ''text-size-adjust: calc(100% * env(bikeshed-text-scale));'',
267+
to ensure that all the text in the page is automatically scaled
268+
to the user's preference,
269+
and when necessary scale non-text sizes by the scale factor as well.
270+
* or set ''text-size-adjust:none'',
271+
and then consistently use this [=environment variable=]
272+
and/or the ''bsem'' unit
273+
to scale relevant text and UI to the user's preference.
274+
</div>
275+
276+
277+
278+
230279
Using Environment Variables: the ''env()'' notation {#env-function}
231280
===================================================================
232281

0 commit comments

Comments
 (0)