Skip to content

Commit 2bf006e

Browse files
committed
[css-fonts-4] [varfont] @font-face descriptors should accept ranges
Incorporate the discussion at w3c#521
1 parent 5794e4c commit 2bf006e

File tree

1 file changed

+27
-17
lines changed

1 file changed

+27
-17
lines changed

css-fonts-4/Overview.bs

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -585,37 +585,43 @@ at least as dark as its predecessor. Only values between 1 - 999 are valid, and
585585

586586
<pre class='descdef mq'>
587587
Name: font-style
588-
Value: normal | italic | oblique <<angle>> ?
588+
Value: normal | italic | oblique [ <<angle>> | <<angle>>-<<angle>> ] ?
589589
For: @font-face
590590
Initial: normal
591591
</pre>
592592

593593
<pre class='descdef mq'>
594594
Name: font-weight
595-
Value: normal | bold | <<number>>
595+
Value: normal | bold | [ <<number>> | <<number>>-<<number>> ]
596596
For: @font-face
597597
Initial: normal
598598
</pre>
599599

600600
<pre class='descdef mq'>
601601
Name: font-stretch
602602
Value: normal | ultra-condensed | extra-condensed | condensed | semi-condensed |
603-
semi-expanded | expanded | extra-expanded | ultra-expanded | <<percentage>>
603+
semi-expanded | expanded | extra-expanded | ultra-expanded | [ <<percentage>> | <<percentage>>-<<percentage>> ]
604604
For: @font-face
605605
Initial: normal
606606
</pre>
607607

608608
These descriptors define the characteristics of a font face and are
609-
used in the process of matching styles to specific faces. For a font
609+
used in the process of matching styles to specific faces. For a font
610610
family defined with several <code>@font-face</code> rules, user agents can either
611611
download all faces in the family or use these descriptors to selectively
612-
download font faces that match actual styles used in document. The
613-
values for these descriptors are the same as those for the corresponding
612+
download font faces that match actual styles used in document. The
613+
meaning of the values for these descriptors are the same as those for the corresponding
614614
font properties except that relative keywords are not allowed, 'bolder' and
615-
'lighter'. If these descriptors are omitted, initial
615+
'lighter'. If these descriptors are omitted, initial
616616
values are assumed. If specified values are out of range of the accepted values
617617
of the property of the same name, the descriptor is treated as a parse error.
618618

619+
Ranges are accepted in these three descriptors in place of a single value. Where a single
620+
value is specified, it has the same meaning as a range with identical startpoint and
621+
endpoint. User agents may swap the computed value of the startpoint and endpoint of the range
622+
in order to forbid decreasing ranges. Both endpoints are inclusive.
623+
The ranges are used in the <a href="#font-matching-algorithm">Font Matching Algorithm</a> below.
624+
619625
The value for these font face style attributes is used in place of
620626
the style implied by the underlying font data. This allows authors to
621627
combine faces in flexible combinations, even in situations where the
@@ -798,10 +804,10 @@ at least as dark as its predecessor. Only values between 1 - 999 are valid, and
798804
<li>'font-stretch' is tried first. If a font
799805
does not have any concept of varying strengths of stretch values, its stretch value
800806
is mapped according table in the <a href="#stretchmappings">property definition</a>.
801-
If the matching set contains faces with width values
802-
matching the 'font-stretch' value, faces with other width
807+
If the matching set includes faces with width values
808+
containing the 'font-stretch' desired value, faces with other width
803809
values are removed from the matching set. If there is no face
804-
that exactly matches, a stretch value is chosen using the rules below:
810+
which contains the desired value, a stretch value is chosen using the rules below:
805811
<ul>
806812
<li>If the desired stretch value is less than 100, stretch values below the
807813
desired stretch value are checked in descending order followed by
@@ -814,14 +820,14 @@ at least as dark as its predecessor. Only values between 1 - 999 are valid, and
814820
</ul>
815821
Once the
816822
closest matching width has been determined by this process,
817-
faces with other widths are removed from the matching set.
823+
faces with widths which do not include this determined width are removed from the matching set.
818824
</li>
819825

820826
<li>'font-style' is tried next.
821827
If the value of 'font-style' is 'italic', italic faces are
822828
checked first, then oblique, then normal faces. If the value
823829
is 'oblique', oblique faces are checked first, then italic
824-
faces and then normal faces. If the value is 'normal',
830+
faces and then normal faces. If the value is 'normal',
825831
normal faces are checked first, then oblique faces, then
826832
italic faces. When checking oblique faces, an oblique angle is chosen using the rules below:
827833
<ul>
@@ -833,11 +839,13 @@ at least as dark as its predecessor. Only values between 1 - 999 are valid, and
833839
are checked in descending order until 0deg or a negative value is reached.
834840
<li>Otherwise, the same steps as above are performed, substituting negative values for the positive ones above.</li>
835841
</ul>
836-
During this operation, if a font does not have any concept of varying oblique angles, it is assumed to have an angle of 20deg. Faces with other style values are excluded
837-
from the matching set. User agents are permitted to
842+
During this operation, if an oblique font does not have any concept of varying oblique angles, it is assumed to have an angle of 20deg.
843+
If the search for a normal or italic face successfully determined a font, faces with other style values are excluded
844+
from the matching set. Otherwise, if the search for an oblique face successfully determined a font, fonts with oblique angles which do not include
845+
this determined angle are excluded from the matching set. User agents are permitted to
838846
distinguish between italic and oblique faces within platform
839847
font families but this is not required, so all
840-
italic or oblique faces may be treated as italic faces. However, within font
848+
italic or oblique faces may be treated as italic faces or oblique faces with an angle of 20deg. However, within font
841849
families defined via <code>@font-face</code> rules, italic and oblique
842850
faces must be distinguished using the value of the
843851
'font-style' descriptor.
@@ -853,9 +861,9 @@ at least as dark as its predecessor. Only values between 1 - 999 are valid, and
853861
If bolder/lighter relative weights are used, the
854862
effective weight is calculated based on the inherited weight
855863
value, as described in the definition of the 'font-weight'
856-
property. Given the desired weight and the weights of faces
864+
property. Given the desired weight and the weight ranges of faces
857865
in the matching set after the steps above, if the desired
858-
weight is available that face matches. Otherwise, a weight
866+
weight is available inside the weight range of a font in the matching set, then that face matches. Otherwise, a weight
859867
is chosen using the rules below:
860868
<ul>
861869
<li>If the desired weight is 400, 500 is checked first and then
@@ -872,6 +880,8 @@ at least as dark as its predecessor. Only values between 1 - 999 are valid, and
872880
weights below the desired weight in descending order until a
873881
match is found.</li>
874882
</ul>
883+
Once the closest matching weight has been determined by this process,
884+
faces with weights which do not include this determined width are removed from the matching set.
875885
</li>
876886

877887
<li>'font-size' must be

0 commit comments

Comments
 (0)