Skip to content

Commit 107bc18

Browse files
committed
[css-fonts-4] Clean up font-stretch section
r=fantasai
1 parent bd29a7b commit 107bc18

File tree

1 file changed

+65
-54
lines changed

1 file changed

+65
-54
lines changed

css-fonts-4/Overview.bs

Lines changed: 65 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -528,65 +528,75 @@ Missing weights</h4>
528528
<h3 id="font-stretch-prop">
529529
Font width: the 'font-stretch!!property' property</h3>
530530

531-
<pre class="propdef">
532-
Name: font-stretch
533-
Value: <<font-stretch-absolute>>
534-
Initial: normal
535-
Applies to: all elements
536-
Inherited: yes
537-
Percentages: Not resolved.
538-
Computed value: As specified
539-
Media: visual
540-
Animatable: As <<number>>
541-
</pre>
542-
543-
The 'font-stretch!!property' property selects a normal,
544-
condensed, or expanded face from a font family.
531+
<pre class="propdef">
532+
Name: font-stretch
533+
Value: normal | <<percentage>> | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded
534+
Initial: normal
535+
Applies to: all elements
536+
Inherited: yes
537+
Percentages: Not resolved
538+
Computed value: percentage
539+
Media: visual
540+
Animatable: As <<percentage>>
541+
</pre>
545542

546-
This property accepts values of the following:
543+
The 'font-stretch!!property' property selects a normal,
544+
condensed, or expanded face from a font family.
545+
Values are specified either as percentages
546+
or as keywords which map to a percentage
547+
as defined in the following table:
547548

548-
<pre class="prod"><dfn id="font-stretch-absolute-values">&lt;font-stretch-absolute&gt;</dfn> = [normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | <<percentage>>]</pre>
549+
<table id="stretchmappings" class="data">
550+
<thead>
551+
<tr>
552+
<th>Absolute keyword value
553+
<th>Numeric value
554+
<tbody dfn-for=font-stretch dfn-type=value>
555+
<tr><th><dfn>ultra-condensed</dfn> <td>50%
556+
<tr><th><dfn>extra-condensed</dfn> <td>62.5%
557+
<tr><th><dfn>condensed</dfn> <td>75%
558+
<tr><th><dfn>semi-condensed</dfn> <td>87.5%
559+
<tr><th><dfn>normal</dfn> <td>100%
560+
<tr><th><dfn>semi-expanded</dfn> <td>112.5%
561+
<tr><th><dfn>expanded</dfn> <td>125%
562+
<tr><th><dfn>extra-expanded</dfn> <td>150%
563+
<tr><th><dfn>ultra-expanded</dfn> <td>200%
564+
</table>
565+
566+
<dfn value for=font-stretch><<percentage>></dfn>
567+
values represent the fractional width of the glyphs,
568+
with 100% representing “normal” glyph widths
569+
(as defined by the font designer).
570+
Values less than 0% are <a>invalid</a>.
571+
572+
When a face does not exist for a given width,
573+
values less than 100% map to a narrower face if one exists, otherwise a wider face.
574+
Conversely, values greater than or equal to 100% map to a wider face if one exists, otherwise a narrower face.
575+
Some fonts might support a range of stretch values;
576+
if the requested stretch value is not available in the font,
577+
the closest supported value is used, using the same mapping rules
578+
(see the [[#font-matching-algorithm]] for the precise algorithm).
579+
For TrueType / OpenType fonts that support variations,
580+
the <code>wdth</code> variation is used to implement varying widths.
549581

550-
Absolute keyword values are aliased to
551-
have the following meaning (Note that a font might internally provide its own mappings, but those mappings within the font are disregarded):
582+
<div class="example">
583+
The figure below shows how nine font-stretch property settings
584+
affect font matching for a font family containing a variety of discrete widths.
585+
Grey indicates a width for which no face exists and a different width is substituted:
552586

553-
<table id="stretchmappings" class="data" summary="font-stretch numeric mappings">
554-
<thead>
555-
<tr>
556-
<th>Absolute keyword value
557-
<th>Numeric value
558-
<tbody>
559-
<tr><th>ultra-condensed<th>50%
560-
<tr><th>extra-condensed<th>62.5%
561-
<tr><th>condensed<th>75%
562-
<tr><th>semi-condensed<th>87.5%
563-
<tr><th>normal<th>100%
564-
<tr><th>semi-expanded<th>112.5%
565-
<tr><th>expanded<th>125%
566-
<tr><th>extra-expanded<th>150%
567-
<tr><th>ultra-expanded<th>200%
568-
</table>
569-
570-
Values less than 0% are not allowed and are treated as parse errors.
571-
When a face does not exist
572-
for a given width, values less than 100% map to a narrower face,
573-
otherwise a wider face. Conversely, values greater than or equal to 100% map to a wider
574-
face, otherwise a narrower face. Some fonts might support a range of stretch
575-
values; if the requested stretch value is not available in the font, the
576-
closest supported value should be used, using the same mapping rules (see the
577-
<a href="#font-matching-algorithm">font matching section below</a> for the
578-
precise algorithm). For TrueType / OpenType fonts which use variations, the "wdth"
579-
variation is used to implement varying widths. The figure below shows how nine
580-
font-stretch property settings affect font matching for font family
581-
containing a variety of discrete widths. Grey indicates a width for which no
582-
face exists and a different width is substituted:
587+
<figure>
588+
<img alt="width mappings for a family with condensed, normal and expanded faces" src="images/universwidths.png" >
589+
<figcaption>Width mappings for a font family with condensed, normal and expanded width faces</figcaption>
590+
</figure>
591+
</div>
583592

584-
<figure>
585-
<img alt="width mappings for a family with condensed, normal and expanded faces" src="images/universwidths.png" >
586-
<figcaption>Width mappings for a font family with condensed, normal and expanded width faces</figcaption>
587-
</figure>
593+
User Agents must not sythesize stretched faces for font families which lack actual stretched faces.
588594

589-
User Agents must not sythesize stretched faces for font families which lack actual stretched faces.
595+
For compatibility with [[CSS-FONTS-3]],
596+
{{getComputedStyle()}} serializes values
597+
that correspond to one of the 'font-stretch' keywords
598+
as that keyword
599+
(instead of as a <<percentage>>).
590600

591601
<h3 id="font-style-prop">
592602
Font style: the 'font-style!!property' property</h3>
@@ -1702,7 +1712,8 @@ Initial: normal
17021712

17031713
<pre class='descdef'>
17041714
Name: font-stretch
1705-
Value: <<font-stretch-absolute>> <<font-stretch-absolute>>?
1715+
Value: <<'font-stretch'>> <<'font-stretch'>>?
1716+
17061717
For: @font-face
17071718
Initial: normal
17081719
</pre>

0 commit comments

Comments
 (0)