8000 Merge pull request #6108 from litherum/size-adjust · MaxCodeXTC/csswg-drafts@137c54b · GitHub
Skip to content

Commit 137c54b

Browse files
authored
Merge pull request w3c#6108 from litherum/size-adjust
[css-fonts-5] Add size-adjust @font-face descriptor
2 parents 57dcb25 + c869db8 commit 137c54b

File tree

1 file changed

+31
-5
lines changed

1 file changed

+31
-5
lines changed

css-fonts-5/Overview.bs

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ Issue(5892):
145145

146146
<h3 id="font-metrics-override-desc">
147147
Default font metrics overriding:
148-
the 'ascent-override', 'descent-override', and 'line-gap-override' descriptors</h3>
148+
the 'ascent-override', 'descent-override', 'line-gap-override', and 'size-adjust' descriptors</h3>
149149

150150
<pre class='descdef'>
151151
Name: ascent-override
@@ -168,24 +168,49 @@ For: @font-face
168168
Initial: normal
169169
</pre>
170170

171+
<pre class='descdef'>
172+
Name: size-adjust
173+
Value: normal | <<percentage>>
174+
For: @font-face
175+
Initial: normal
176+
</pre>
177+
171178
The 'ascent-override', 'descent-override', and 'line-gap-override' descriptors define the
172179
<a spec="CSS-INLINE-3">ascent metric</a>, <a spec="CSS-INLINE-3">descent metric</a> and
173-
<a spec="CSS-INLINE-3">line gap metric</a> of the font, respectively.
180+
<a spec="CSS-INLINE-3">line gap metric</a> of the font, respectively. The `size-adjust`
181+
descriptor defines a scalar by which glyph outlines and metrics from this font are multiplied.
174182

175183
When the descriptor value is 'normal', the corresponding metric value is obtained as-if the
176184
descriptor was absent from the <code>@font-face</code> block.
177185

178-
Note: User agents may draw data from different places from the font file as the metric values,
186+
Note: User agents may gather data from different places from the font file as the metric values,
179187
which results in different text layouts.
180188

181189
For the 'ascent-override', 'descent-override' and 'line-gap-override' descriptors, when the
182190
descriptor value is a percentage, the corresponding metric value is resolved as the
183191
given percentage multiplied by the used font size. Negative values are invalid at parse time.
184192

193+
For 'size-adjust', when the descriptor value is a percentage, all metrics values of this font,
194+
including glyph advance sizes, are resolved as the given percentage multiplied by the used font
195+
size. When glyphs are visibly drawn, the visual size of the glyphs is also multiplied by the
196+
percentage.
197+
198+
None of these descriptors affect the calculation of
199+
<a href="https://drafts.csswg.org/css-values-4/#font-relative-lengths">Font-relative Lengths</a>.
200+
None of these descriptors affect the behavior of any of the values of 'line-height' other than
201+
'normal'. The behavior of <code>line-height: normal</code> may be affected by all of these
202+
descriptors. 'size-adjust' does not affect the computed font size of any element.
203+
204+
When 'size-adjust' is applied in conjunction with 'ascent-override', 'descent-override',
205+
or 'line-gap-override' in the same @font-face block, the relevant metrics are multiplied by both
206+
percentages.
207+
185208
Note: Using the 'ascent-override', 'descent-override', and 'line-gap-override' descriptors can
186-
achieve a similar effect as specifying a percentage for 'line-height' property.
209+
achieve a similar effect as specifying a percentage for 'line-height' property. Using the
210+
'size-adjust' descriptor can achieve a similar effect as specifying a percentage for the
211+
'font-size' property.
187212

188-
Note: 'ascent-override', 'descent-override', and 'line-gap-override'
213+
Note: 'ascent-override', 'descent-override', 'line-gap-override', and 'size-adjust'
189214
are applied per-font rather than per-element. Multiple fonts may be used
190215
within an individual element e.g. for characters not supported by the primary font.
191216

@@ -228,6 +253,7 @@ within an individual element e.g. for characters not supported by the primary fo
228253
ascent-override: 125%;
229254
descent-override: 25%;
230255
line-gap-override: 0%;
256+
size-adjust: 96%;
231257
}
232258

233259
&lt;div style="font-family: cool-web-font, fallback-to-local"&gt;Title goes here&lt;/div&gt;

0 commit comments

Comments
 (0)