@@ -93,13 +93,235 @@ Issue(4044):
93
93
<h3 id="font-size-adjust-prop">
94
94
Relative sizing: the 'font-size-adjust' property</h3>
95
95
96
- The 'font-size-adjust' property is applied after the 'size-adjust' descriptor.
96
+ <pre class="propdef">
97
+ Name : font-size-adjust
98
+ Value : none | [ ex | cap | ch | ic ]? [ from-font | <<number>> ]
99
+ Initial : none
100
+ Applies to : all elements and text
101
+ Inherited : yes
102
+ Percentages : N/A
103
+ Computed value : the keyword ''font-size-adjust/none'', or a pair of a metric keyword and a <<number>>
104
+ Animation type : discrete if the keywords differ, otherwise by computed value type
105
+ </pre>
106
+
107
+ For any given font size, the apparent size and effective legibility of text
108
+ varies across fonts as a function of their design.
109
+ For example,
110
+ for bicameral scripts such as Latin or Cyrillic that
111
+ distinguish between upper and lowercase letters,
112
+ the relative height of lowercase letters
113
+ compared to their uppercase counterparts
114
+ is a determining factor of legibility.
115
+ In situations where font fallback occurs,
116
+ fallback fonts might not share
117
+ the same ratios as the desired font family
118
+ for key typographic metrics,
119
+ and will thus appear to be a different size
120
+ and possibly be less readable.
121
+
122
+ The 'font-size-adjust' property provides a way
123
+ to preserve the readability and apparent size of text
124
+ when font fallback occurs.
125
+ It does this by adjusting the used font size
126
+ so that the specified metric is the same
127
+ regardless of the font used.
128
+
129
+ Values have the following meanings:
130
+
131
+ <dl dfn-type=value dfn-for="font-size-adjust">
132
+ <dt> <dfn>none</dfn>
133
+ <dd>
134
+ No special 'font-size' adjustment is applied.
135
+
136
+ <dt> <dfn>ex | cap | ch | ic</dfn>
137
+ <dd>
138
+ Specifies the font metric to normalize,
139
+ defaulting to ''font-size-adjust/ex'' :
140
+
141
+ <dl>
142
+ <dt> <dfn>ex</dfn>
143
+ <dd>
144
+ Normalize the <dfn dfn>aspect value</dfn> of the fonts,
145
+ using the x-height divided by the font size.
146
+
147
+ <dt> <dfn>cap</dfn>
148
+ <dd>
149
+ Normalize the cap-height of the fonts,
150
+ using the cap-height by the font size.
151
+
152
+ <dt> <dfn>ch</dfn>
153
+ <dd>
154
+ Normalize the narrow pitch of the fonts,
155
+ using the advance measure of “0” (ZERO, U+0030)
156
+ divided by the font size.
157
+
158
+ <dt> <dfn>ic</dfn>
159
+ <dd>
160
+ Normalize the wide pitch of the font,
161
+ using the advance measure of “水” (CJK water ideograph, U+6C34)
162
+ divided by the font size.
163
+ </dl>
164
+
165
+ ISSUE(6384):
166
+ If the required font metric cannot be derived from a font,
167
+ then that font’s size is not adjusted.
168
+
169
+ <dt> <dfn><<number>></dfn>
170
+ <dd>
171
+ Each font’s [=used value|used=] size is normalized
172
+ to match the chosen font metric to
173
+ this specified proportion of the [=computed value|computed=] 'font-size' .
174
+ In other words,
175
+ for each glyph,
176
+ the adjusted font size to use <var> u</var>
177
+ is calculated as:
178
+
179
+ <pre><var> u</var> = ( <var> m</var> / <var> m′</var> ) <var> s</var></pre>
97
180
98
- Note: The consequence of applying 'font-size-adjust' after 'size-adjust' is that
99
- 'size-adjust' appears to have no effect.
181
+ where:
100
182
101
- Issue(5539):
183
+ <pre>
184
+ <var> s</var> = computed 'font-size' value
185
+ <var> m</var> = metric as specified by the 'font-size-adjust' property
186
+ <var> m′</var> = metric as specified in the actual font
187
+ <var> u</var> = adjusted font-size to use
188
+ </pre>
189
+
190
+ Negative values are invalid.
191
+
192
+ <dt> <dfn>from-font</dfn>
193
+ <dd>
194
+ Computes to the <<number>> corresponding to
195
+ the specified metric of the [=first available font=] .
196
+
197
+ ISSUE(6384): Shouldn't this be the first available font
198
+ that can provide the required metric?
199
+ </dl>
102
200
201
+ <div class="example">
202
+ The style defined below defines Verdana as the desired font family,
203
+ but if Verdana is not available Futura or Times will be used.
204
+ One paragraph also has font-size-adjust specified.
205
+
206
+ <pre>
207
+ p {
208
+ font-family: Verdana, Futura, Times;
209
+ }
210
+ p.adj {
211
+ font-size-adjust: 0.545;
212
+ }
213
+
214
+ <p>Lorem ipsum dolor sit amet, ...</p>
215
+ <p class="adj">Lorem ipsum dolor sit amet, ...</p>
216
+ </pre>
217
+
218
+ Verdana has a relatively high aspect value of 0.545,
219
+ meaning lowercase letters are relatively tall
220
+ compared to uppercase letters,
221
+ so at small sizes text appears legible.
222
+ Times has a lower aspect value of 0.447,
223
+ and so if fallback occurs,
224
+ the text will be less legible at small sizes than Verdana
225
+ unless font-size-adjust is also specified.
226
+
227
+ Note: For text which uses diacritics,
228
+ too large an x-height will actually decrease legibility
229
+ as the diacritics become cramped.
230
+
231
+ How text rendered in each of these fonts compares is shown below,
232
+ the columns show text rendered in Verdana, Futura and Times.
233
+ The same font-size value is used across cells
234
+ within each row and red lines are included to show the differences in x-height.
235
+ In the upper half, each row is rendered in the same font-size value.
236
+ The same is true for the lower half,
237
+ but in this half the 'font-size-adjust' property is also set
238
+ to 0.545,
239
+ so that the actual font size is adjusted
240
+ to preserve the x-height of Verdana across each row.
241
+ Note how small text remains relatively legible across each row in the lower half.
242
+
243
+ <figure>
244
+ <img alt="text with and without 'font-size-adjust'" src="images/fontsizeadjust.png" >
245
+ <figcaption> Text with and without the use of 'font-size-adjust' </figcaption>
246
+ </figure>
247
+ </div>
248
+
249
+ The value of 'font-size-adjust' affects the [=used value|used=] value of 'font-size'
250
+ but does not affect the [=computed value|computed=] value.
251
+ Therefore it can affect the size of relative units
252
+ that are based on font metrics
253
+ such as <code> ex</code> and <code> ch</code>
254
+ but does not affect the size of <code> em</code> units.
255
+ Since numeric values of 'line-height'
256
+ refer to the [=computed value|computed=] size of 'font-size' ,
257
+ 'font-size-adjust' also does not affect the [=used value|used=] value of 'line-height' .
258
+
259
+ Note: Since 'font-size-adjust' does not factor into the 'line-height' ,
260
+ specifying a line height too tightly can result in overlapping lines of text.
261
+ For example, when a fallback font with a low [=aspect value=]
262
+ is normalized to match one with a high [=aspect value=] ,
263
+ its ascenders and descenders are likely to extend outside the line box
264
+ with ''line-height: 1'' .
265
+
266
+ The 'font-size-adjust' adjustment applies to any font that is selected
267
+ but in typical usage it would be based
268
+ on the corresponding metric value
269
+ of the first (most desired) font in the 'font-family' list.
270
+ If this is specified accurately,
271
+ the <code> (<var> m</var> /<var> m′</var> )</code> term in the adjustment formula
272
+ will resolve to <code> 1</code> for the first font
273
+ and no adjustment occurs for that font;
274
+ and the rest of the fonts will resolve to match.
275
+ If the value is specified inaccurately,
276
+ text rendered using the first font in the family list
277
+ will display differently in older user agents
278
+ that don't support 'font-size-adjust' .
279
+
280
+ <div class="example">
281
+ Authors can calculate the <a>aspect value</a> for a given font
282
+ by comparing spans with the same content
283
+ but different 'font-size-adjust' properties.
284
+ If the same font-size is used, the spans will match
285
+ when the 'font-size-adjust' value is accurate for the given font.
286
+
287
+ Two spans with borders are used to determine the <a>aspect value</a> of a font.
288
+ The 'font-size' is the same for both spans
289
+ but the 'font-size-adjust' property is specified only for the right span.
290
+ Starting with a value of 0.5,
291
+ the aspect value can be adjusted
292
+ until the borders around the two letters line up.
293
+
294
+ <pre>
295
+ p {
296
+ font-family: Futura;
297
+ font-size: 500px;
298
+ }
299
+
300
+ span {
301
+ border: solid 1px red;
302
+ }
303
+
304
+ .adjust {
305
+ font-size-adjust: 0.5;
306
+ }
307
+
308
+ <p><span>b</span><span class="adjust">b</span></p>
309
+ </pre>
310
+
311
+ <figure>
312
+ <img alt="Futura with an aspect value of 0.5" src="images/beforefontsizeadjust.png" >
313
+ <figcaption> Futura with an <a>aspect value</a> of 0.5</figcaption>
314
+ </figure>
315
+
316
+ The box on the right is a bit bigger than the one on the left, so the <a>aspect value</a> of this font is something less than 0.5.
317
+ Adjust the value until the boxes align.
318
+ </div>
319
+
320
+ Note: If the specified metric has been overridden in ''@font-face'' ,
321
+ e.g. by 'size-adjust' ,
322
+ then the overridden metric will be used in the 'font-size-adjust' calculation.
323
+ Consequently, applying 'font-size-adjust' and 'size-adjust' together
324
+ means that 'size-adjust' appears to have no effect.
103
325
104
326
<h2 id="font-resources">
105
327
Font Resources</h2>
@@ -381,8 +603,15 @@ No new security or privacy considerations have been raised on this specification
381
603
<h2 id="acknowledgments">
382
604
Acknowledgments</h2>
383
605
384
- The CSS Working group would like to thank:
606
+ Firstly, the editors would like to thank all of the
607
+ <a href="https://www.w3.org/TR/css-fonts-4/#acknowledgments">contributors to the previous level of this module</a> .
385
608
609
+ Secondly, we would like to acknowledge
610
+ DerKoun from PDFReactor,
611
+ Xiaocheng Hu from Google,
612
+ and
613
+ Jonathan Kew from Mozilla,
614
+ for their contributions to the improvements in this Level 5.
386
615
387
616
<h2 id="changes">
388
617
Changes
0 commit comments