Skip to content

Commit b0660ee

Browse files
committed
[css-fonts-4] Make font-stretch a legacy name alias for font-width, #551
1 parent 0a1345a commit b0660ee

File tree

1 file changed

+121
-44
lines changed

1 file changed

+121
-44
lines changed

css-fonts-4/Overview.bs

+121-44
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ Relationship Between Faces and Families
414414
to a set of faces that vary along axes other than just
415415
the standard axes of
416416
weight ('font-weight!!property'),
417-
width ('font-stretch!!property'),
417+
width ('font-width!!property'),
418418
and slant ('font-style!!property').
419419
A family can vary along axes that are unique to that family.
420420
The CSS font selection mechanism merely
@@ -919,20 +919,20 @@ Missing weights</h4>
919919
Authors can explicitly avoid this behavior by using the 'font-synthesis' property.
920920

921921
<!--
922-
████████ ███████ ██ ██ ████████ ██████ ████████ ████████ ████████ ████████ ██████ ██ ██
923-
██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
924-
██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
925-
██████ ██ ██ ██ ██ ██ ██ ███████ ██████ ██ ████████ ██████ ██ ██ █████████
926-
██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
927-
██ ██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
928-
██ ███████ ██ ██ ██ ██████ ██ ██ ██ ████████ ██ ██████ ██ ██
922+
████████ ███████ ██ ██ ████████ ██ ██ ████ ████████ ████████ ██ ██
923+
██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
924+
██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
925+
██████ ██ ██ ██ ██ ██ ██ ███████ ██ ██ ██ ██ ██ ██ ██ █████████
926+
██ ██ ██ ██ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
927+
██ ██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
928+
██ ███████ ██ ██ ██ ███ ███ ████ ████████ ██ ██ ██
929929
-->
930930

931-
<h3 id="font-stretch-prop">
932-
Font width: the 'font-stretch!!property' property</h3>
931+
<h3 id="font-width-prop">
932+
Font width: the 'font-width!!property' property</h3>
933933

934934
<pre class="propdef">
935-
Name: font-stretch
935+
Name: font-width
936936
Value: normal | <<percentage [0,∞]>> | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded
937937
Initial: normal
938938
Applies to: all elements and text
@@ -969,18 +969,18 @@ Font width: the 'font-stretch!!property' property</h3>
969969
variations/font-stretch.html
970970
</wpt>
971971

972-
The 'font-stretch!!property' property selects a normal,
972+
The 'font-width!!property' property selects a normal,
973973
condensed, or expanded face from a font family.
974974
Values are specified either as percentages
975975
or as keywords which map to a percentage
976976
as defined in the following table:
977977

978-
<table id="stretchmappings" class="data">
978+
<table id="widthmappings" class="data">
979979
<thead>
980980
<tr>
981981
<th>Absolute keyword value
982982
<th>Numeric value
983-
<tbody dfn-for=font-stretch dfn-type=value>
983+
<tbody dfn-for=font-width dfn-type=value>
984984
<tr><th><dfn>ultra-condensed</dfn> <td>50%
985985
<tr><th><dfn>extra-condensed</dfn> <td>62.5%
986986
<tr><th><dfn>condensed</dfn> <td>75%
@@ -992,7 +992,7 @@ Font width: the 'font-stretch!!property' property</h3>
992992
<tr><th><dfn>ultra-expanded</dfn> <td>200%
993993
</table>
994994

995-
<dfn value for=font-stretch><<percentage [0,∞]>></dfn>
995+
<dfn value for=font-width><<percentage [0,∞]>></dfn>
996996
values represent the fractional width of the glyphs,
997997
with 100% representing “normal” glyph widths
998998
(as defined by the font designer).
@@ -1008,8 +1008,8 @@ Font width: the 'font-stretch!!property' property</h3>
10081008
For TrueType / OpenType fonts that support variations,
10091009
the <code>wdth</code> variation is used to implement varying widths.
10101010

1011-
<div class="example" id="ex-font-stretch-matching">
1012-
The figure below shows how nine font-stretch property settings
1011+
<div class="example" id="ex-font-width-matching">
1012+
The figure below shows how nine font-width property settings
10131013
affect font matching for a font family containing a variety of discrete widths.
10141014
Grey indicates a width for which no face exists and a different width is substituted:
10151015

@@ -1019,10 +1019,77 @@ Font width: the 'font-stretch!!property' property</h3>
10191019
</figure>
10201020
</div>
10211021

1022-
User agents must not synthesize stretched faces for font families which lack actual stretched faces.
1023-
10241022
{{getComputedStyle()}} always serializes its value as a <<percentage>>, regardless of how the value was specified by the author, or whether or not a keyword happens to map to the value.
10251023

1024+
<h4 id="font-stretch-prop">
1025+
Font width: the 'font-stretch!!property' legacy name alias</h4>
1026+
1027+
For historical reasons,
1028+
a <dfn>font-stretch</dfn> property exists
1029+
which is a [=legacy name alias=]
1030+
and functions in the identical way to
1031+
the 'font-width!!property'.
1032+
1033+
<div class="example" id="ex-font-stretch-set">
1034+
For example, here the legacy 'font-stretch!!property' is used
1035+
on level one headings.
1036+
1037+
<pre>
1038+
h1 {font-stretch: condensed; }
1039+
</pre>
1040+
1041+
The specified value of the 'font-width!!property'
1042+
on those headings
1043+
becomes set to 'condensed'.
1044+
</div>
1045+
1046+
<div class="example" id="ex-font-stretch-set">
1047+
For example, here the 'font-width!!property' is used
1048+
on level one headings.
1049+
1050+
<pre>
1051+
h1 {font-width: condensed; }
1052+
</pre>
1053+
1054+
The specified value of the 'font-stretch!!property'
1055+
on those headings
1056+
becomes set to 'condensed'.
1057+
</div>
1058+
1059+
<wpt>
1060+
font-stretch-01.html
1061+
font-stretch-02.html
1062+
font-stretch-03.html
1063+
font-stretch-04.html
1064+
font-stretch-05.html
1065+
font-stretch-06.html
1066+
font-stretch-07.html
1067+
font-stretch-08.html
1068+
font-stretch-09.html
1069+
font-stretch-10.html
1070+
font-stretch-11.html
1071+
font-stretch-12.html
1072+
font-stretch-13.html
1073+
font-stretch-14.html
1074+
font-stretch-15.html
1075+
font-stretch-16.html
1076+
font-stretch-17.html
1077+
font-stretch-18.html
1078+
animations/font-stretch-interpolation.html
1079+
parsing/font-stretch-computed.html
1080+
parsing/font-stretch-invalid.html
1081+
parsing/font-stretch-valid.html
1082+
variations/font-parse-numeric-stretch-style-weight.html
1083+
variations/font-stretch.html
1084+
</wpt>
1085+
1086+
User agents must not synthesize condensed or expanded faces
1087+
for font families which lack such faces
1088+
and which do not have a width variation axis.
1089+
In particular, user agents must not geometrically stretch such faces.
1090+
1091+
1092+
10261093
<!--
10271094
████████ ███████ ██ ██ ████████ ██████ ████████ ██ ██ ██ ████████
10281095
██ ██ ██ ███ ██ ██ ██ ██ ██ ██ ██ ██ ██
@@ -1621,7 +1688,7 @@ Shorthand font property: the 'font' property</h3>
16211688
Value: [ [ <<'font-style'>> ||
16221689
<<font-variant-css2>> ||
16231690
<<'font-weight'>> ||
1624-
<<font-stretch-css3>> ]? <<'font-size'>> [ / <<'line-height'>> ]?
1691+
<<font-width-css3>> ]? <<'font-size'>> [ / <<'line-height'>> ]?
16251692
<<'font-family'>> ] |
16261693
<<system-family-name>>
16271694
Initial: see individual properties
@@ -1655,7 +1722,7 @@ Shorthand font property: the 'font' property</h3>
16551722
except as described below,
16561723
a shorthand property for setting
16571724
'font-style!!property', 'font-variant!!property',
1658-
'font-weight!!property', 'font-stretch!!property',
1725+
'font-weight!!property', 'font-width!!property',
16591726
'font-size!!property', 'line-height', 'font-family!!property'
16601727
at the same place in the stylesheet.
16611728

@@ -1669,12 +1736,12 @@ Shorthand font property: the 'font' property</h3>
16691736
<pre class="prod"><dfn id="font-variant-css21-values"><<font-variant-css2>></dfn>
16701737
= [normal | small-caps]</pre>
16711738

1672-
Values for the 'font-stretch!!property' property can also be included
1739+
Values for the 'font-width!!property' property can also be included
16731740
but only those supported in CSS Fonts level 3,
1674-
none of the 'font-stretch!!property' values added in this specification
1741+
none of the 'font-width!!property' values added in this specification
16751742
can be used in the 'font' shorthand:
16761743

1677-
<pre class="prod"><dfn id="font-stretch-css3-values"><<font-stretch-css3>></dfn>
1744+
<pre class="prod"><dfn id="font-width-css3-values"><<font-width-css3>></dfn>
16781745
= [normal | ultra-condensed | extra-condensed | condensed |
16791746
semi-condensed | semi-expanded | expanded | extra-expanded |
16801747
ultra-expanded]</pre>
@@ -1689,6 +1756,7 @@ Shorthand font property: the 'font' property</h3>
16891756
<ul>
16901757
<li>'font-family!!property'</li>
16911758
<li>'font-size!!property'</li>
1759+
<li>'font-width!!property'</li>
16921760
<li>'font-stretch!!property' (css3)</li>
16931761
<li>'font-style!!property'</li>
16941762
<li>'font-variant-caps!!property' (css2)</li>
@@ -1775,20 +1843,20 @@ Shorthand font property: the 'font' property</h3>
17751843
'font-style!!property' and 'font-weight!!property'.
17761844

17771845
The sixth rule sets the 'font-style!!property',
1778-
'font-stretch!!property',
1846+
'font-width!!property',
17791847
'font-size!!property', and
17801848
'font-family!!property',
17811849
the other font properties being set to their initial values.
17821850

17831851
The seventh rule sets 'font-style!!property' to ''oblique 25deg'',
17841852
'font-weight!!property' to ''753'', and
1785-
'font-stretch!!property' to ''condensed''.
1853+
'font-width!!property' to ''condensed''.
17861854
Note that the ''25deg'' in this rule must be
17871855
immediately following the "oblique" keyword.
17881856
</div>
17891857

1790-
Since the 'font-stretch!!property' property was not defined in CSS 2.1,
1791-
when using 'font-stretch!!property' values within 'font' rules,
1858+
Since the 'font-width!!property' property was not defined in CSS 2.1,
1859+
when using 'font-width!!property' values within 'font' rules,
17921860
authors should include a extra version compatible with older user agents:
17931861

17941862
<pre>
@@ -2901,7 +2969,7 @@ or font format.
29012969

29022970
<h3 id="font-prop-desc">
29032971
Font property descriptors: the 'font-style!!descriptor', 'font-weight!!descriptor', and
2904-
'font-stretch!!descriptor' descriptors</h3>
2972+
'font-width!!descriptor' descriptors</h3>
29052973

29062974
<pre class='descdef'>
29072975
Name: font-style
@@ -2918,8 +2986,8 @@ Font property descriptors: the 'font-style!!descriptor', 'font-weight!!descripto
29182986
</pre>
29192987

29202988
<pre class='descdef'>
2921-
Name: font-stretch
2922-
Value: auto | <<'font-stretch'>>{1,2}
2989+
Name: font-width
2990+
Value: auto | <<'font-width'>>{1,2}
29232991
For: @font-face
29242992
Initial: auto
29252993
</pre>
@@ -3040,7 +3108,7 @@ Font property descriptors: the 'font-style!!descriptor', 'font-weight!!descripto
30403108
</div>
30413109

30423110
<div class="example" id="ex-descriptors-range">
3043-
Fonts may advertise the range of 'font-weight!!property', 'font-stretch!!property', and 'font-style!!property' they are
3111+
Fonts may advertise the range of 'font-weight!!property', 'font-width!!property', and 'font-style!!property' they are
30443112
compatible with.
30453113
<pre>
30463114
@font-face {
@@ -3055,7 +3123,7 @@ Font property descriptors: the 'font-style!!descriptor', 'font-weight!!descripto
30553123
outside of the 100 - 399 range. For more details, see the [[#font-matching-algorithm]].
30563124

30573125
As <a href="#ex-descriptors-matching">above</a>, multiple ''@font-face'' rules may be joined together into a single
3058-
family, spanning multiple ranges of 'font-weight!!property', 'font-stretch!!property', and/or 'font-style!!property':
3126+
family, spanning multiple ranges of 'font-weight!!property', 'font-width!!property', and/or 'font-style!!property':
30593127
<pre>
30603128
@font-face {
30613129
font-family: Lastima;
@@ -3073,6 +3141,15 @@ Font property descriptors: the 'font-style!!descriptor', 'font-weight!!descripto
30733141
'font-weight!!property' is between 400 and 700.
30743142
</div>
30753143

3144+
<h4 id="font-stretch-desc">
3145+
Font width: the 'font-stretch!!descriptor' legacy name alias</h4>
3146+
3147+
For historical reasons,
3148+
a <dfn for="@font-face">font-stretch</dfn> descriptor exists
3149+
which is a [=legacy name alias=]
3150+
and functions in the identical way to
3151+
the 'font-width!!descriptor'.
3152+
30763153
<!--
30773154
██ ██ ████████ ███ ██ ██ ██████ ████████
30783155
██ ██ ██ ██ ██ ██ ███ ██ ██ ██ ██
@@ -3416,7 +3493,7 @@ but will override the "XHGT" axis to have a value of 0.7.
34163493
</div>
34173494

34183495
Note: Because the variation axis values supplied in the
3419-
'font-weight!!property', 'font-stretch!!property', and 'font-style!!property' properties
3496+
'font-weight!!property', 'font-width!!property', and 'font-style!!property' properties
34203497
are applied before
34213498
the value in the 'font-named-instance!!descriptor' descriptor,
34223499
there is no need to change the value of those properties
@@ -4070,11 +4147,11 @@ if all font style properties were set to their initial value.
40704147
of font faces in that family and then narrows the set to a single
40714148
face using other font properties in the order given below. Fonts might be
40724149
present in this group which can support a range of
4073-
'font-stretch!!property', 'font-style!!property', or 'font-weight!!property' properties. In
4150+
'font-width!!property', 'font-style!!property', or 'font-weight!!property' properties. In
40744151
this case, the algorithm proceeds as if each supported combination of
40754152
values is a unique font in the set. If such a font is ultimately
40764153
selected by this algorithm, particular values for
4077-
'font-stretch!!property', 'font-style!!property', and 'font-weight!!property' must be applied
4154+
'font-width!!property', 'font-style!!property', and 'font-weight!!property' must be applied
40784155
before any layout or rendering occurs. The application of these values
40794156
must be applied in the <a href="#apply-font-matching-variations">Apply
40804157
font matching variations</a> step detailed in
@@ -4091,11 +4168,11 @@ if all font style properties were set to their initial value.
40914168
</wpt>
40924169

40934170
<ol id="fontstylematchingalg">
4094-
1. 'font-stretch!!property' is tried first. If a font
4171+
1. 'font-width!!property' is tried first. If a font
40954172
does not have any concept of varying strengths of stretch values, its stretch value
4096-
is mapped according table in the <a href="#stretchmappings">property definition</a>.
4173+
is mapped according table in the <a href="#widthmappings">property definition</a>.
40974174
If the matching set includes faces with width values
4098-
containing the 'font-stretch!!property' desired value, faces with width values which do not include the desired width value
4175+
containing the 'font-width!!property' desired value, faces with width values which do not include the desired width value
40994176
are removed from the matching set. If there is no face
41004177
which contains the desired value, a stretch value is chosen using the rules below:
41014178

@@ -4115,15 +4192,15 @@ if all font style properties were set to their initial value.
41154192
<div class="example" id="ex-ascending-stretch">
41164193
This search algorithm can be thought of as a distance function, where the lowest-distance value present in the font family is selected, and all fonts not including that value are eliminated.
41174194

4118-
Consider a font family with three fonts, named A, B, and C, each with associated supported ranges for the 'font-stretch!!property' descriptor. If an element is styled with "font-stretch: 125%", the search algorithm can be visualized as follows:
4195+
Consider a font family with three fonts, named A, B, and C, each with associated supported ranges for the 'font-width!!property' descriptor. If an element is styled with "font-width: 125%", the search algorithm can be visualized as follows:
41194196

41204197
<img src="images/stretchdistance.svg" alt="algorithm">
41214198

41224199
The font stretch ranges supported by fonts A, B, and C are shown in the graph above. As you can see, because font B contains the minimum stretch value across the entire family, font B would be selected by this algorithm. However, if font B were somehow eliminated from the family, font C would then contain the lowest distance in the family, so it would be selected.
41234200
</div>
41244201

41254202
<div class="example" id="ex-ascending-stretch-2">
4126-
Similar to the <a href="#ex-ascending-stretch">previous example</a>, here is the conceptual distance graph for an element styled with "font-stretch: 75%":
4203+
Similar to the <a href="#ex-ascending-stretch">previous example</a>, here is the conceptual distance graph for an element styled with "font-width: 75%":
41274204

41284205
<img src="images/stretchdistance2.svg" alt="distance graph">
41294206

@@ -6701,7 +6778,7 @@ text run.
67016778
See [[#default-features]] for a description of these.
67026779

67036780
2. <span id="apply-font-matching-variations">Font variations as enabled by the 'font-weight!!property',
6704-
'font-stretch!!property', and 'font-style!!property' properties are applied.</span>
6781+
'font-width!!property', and 'font-style!!property' properties are applied.</span>
67056782

67066783
The application of the value enabled by
67076784
'font-style!!property' is affected by font selection, because this property might select an
@@ -6711,7 +6788,7 @@ text run.
67116788
not be set together.
67126789

67136790
If the selected font is defined in an ''@font-face'' rule, then the values applied at this step
6714-
should be clamped to the value of the 'font-weight!!descriptor', 'font-stretch!!descriptor',
6791+
should be clamped to the value of the 'font-weight!!descriptor', 'font-width!!descriptor',
67156792
and 'font-style!!descriptor'
67166793
descriptors in that ''@font-face'' rule.
67176794

@@ -7008,7 +7085,7 @@ the table below. Instead, please use the higher-level replacement properties, be
70087085
<th>Notes
70097086
<tbody>
70107087
<tr><td>Weight (<code>wght</code>)<td>'font-weight!!property'<td>The 'font-weight!!property' property will set the <code>wght</code> axis if one is present.
7011-
<tr><td>Width (<code>wdth</code>)<td>'font-stretch!!property'<td>The 'font-stretch!!property' property will set the <code>wdth</code> axis if one is present.
7088+
<tr><td>Width (<code>wdth</code>)<td>'font-width!!property'<td>The 'font-width!!property' property will set the <code>wdth</code> axis if one is present.
70127089
<tr><td>Slant (<code>slnt</code>) or Italic (<code>ital</code>)<td>'font-style!!property'<td>The 'font-style!!property' property will set the <code>slnt</code> or <code>ital</code> axis, depending on its value.
70137090
<tr><td>Optical size (<code>opsz</code>)<td>'font-optical-sizing!!property'<td>The 'font-optical-sizing!!property' property will set the <code>opsz</code> axis if one is present.
70147091
</table>

0 commit comments

Comments
 (0)