You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
These values form an ordered sequence, where each number indicates a weight that is
409
-
at least as dark as its predecessor. Only values greater than or equal to 1, and less than or equal to 1000, are valid, and all other values are treated as parse errors. Certain numeric values correspond to the commonly used weight names below (Note that a font might internally provide its own mappings, but those mappings within the font are disregarded):
Note: The table above is equivalent to selecting the next relative bolder or lighter face,
483
+
given a font family containing normal and bold faces
484
+
along with a thin and a heavy face.
485
+
Authors who desire finer control over the exact weight values used for a given element
486
+
can use numerical values instead of relative weights.
487
+
488
+
<h4 id="missing-weights">
489
+
Missing weights</h4>
490
+
491
+
Quite often there are only a few weights available for a particular font family.
492
+
When a weight is specified for which no face exists, a face with a nearby weight is used.
493
+
In general, bold weights map to faces with heavier weights and light weights map to faces with lighter weights.
494
+
(See the [[#font-matching-algorithm]] for a precise definition.)
462
495
463
-
<figure>
464
-
<img alt="weight mappings for a family with 300, 600 weights" src="images/hiraginoweights.png" >
465
-
<figcaption>Weight mappings for a font family with 300 and 600 weight faces</figcaption>
466
-
</figure>
496
+
<div class="example">
497
+
The examples here illustrate which face is used for different weights.
498
+
Grey indicates that a face for the desired weight does not exist, so a face with a nearby weight is used.
467
499
468
-
Most user agents model a font as having a particular weight which often corresponds to one of the numbers in the nine-step scale mentioned <a href="#font-weight-numeric-values">above</a>.
469
-
While this is true of most fonts, some fonts might be configurable so as to
470
-
support a range of weights. In this situation, the user agent uses a face
471
-
with a weight as close as possible to the weight requested (see the
472
-
<a href="#font-matching-algorithm">font matching section below</a> for the
473
-
precise algorithm). In particular, a user agent using a font which supports
474
-
a range of weights should behave the same as if a font is present at each
475
-
individual weight in the range. For TrueType / OpenType fonts which use variations, the "wght"
476
-
variation is used to implement varying weights. Fractional weights are
477
-
valid.
478
-
479
-
Although the practice is not well-loved by typographers, bold faces are often
480
-
synthesized by user agents for faces that lack actual bold faces. For
481
-
the purposes of style matching, these faces must be treated as if they
482
-
exist within the family. Authors can explicitly avoid this behavior
483
-
by using the 'font-synthesis' property.
484
-
485
-
Specified values of ''bolder'' and ''lighter'' indicate weights
486
-
relative to the weight of the parent element. The computed weight is
487
-
calculated based on the inherited 'font-weight!!property' value using the chart
<img alt="weight mappings for a family with 400, 700 and 900 weights" src="images/optimaweights.png" >
502
+
<figcaption>Weight mappings for a font family with 400, 700 and 900 weight faces</figcaption>
503
+
</figure>
504
504
505
-
The table above is equivalent to selecting the next relative bolder or lighter face,
506
-
given a font family containing normal and bold faces along with a thin and a heavy face.
507
-
Authors who desire finer control over the exact weight values used for a given element
508
-
can use numerical values instead of relative weights.
505
+
<figure>
506
+
<img alt="weight mappings for a family with 300, 600 weights" src="images/hiraginoweights.png" >
507
+
<figcaption>Weight mappings for a font family with 300 and 600 weight faces</figcaption>
508
+
</figure>
509
+
</div>
509
510
510
-
Note: There is a small behavior change between [[CSS-FONTS-3]] and this specification with the animation of the 'font-size' property.
511
-
Previously, interpolated values of font-weight were rounded to their closest multiple of 100, and the font-matching algorithm was run on these
512
-
rounded values. In this specification, the font-matching algorithm is able to accept any value, so no rounding occurs. The small behavior change is due to the discontinuous nature of the font-matching algorithm.
511
+
Most user agents model a font as having a particular weight
512
+
which often corresponds to one of the numbers in the nine-step scale in [[#font-weight-numeric-values]].
513
+
While this is true of most fonts, some fonts might be configurable so as to support a range of weights.
514
+
In this situation, the user agent uses a face with a weight as close as possible to the weight requested
515
+
(see [[#font-matching-algorithm]] for the precise algorithm).
516
+
In particular, a user agent using a font which supports a range of weights
517
+
should behave the same as if a font is present at each individual weight in the range.
518
+
For TrueType / OpenType fonts that use variations,
519
+
the <code>wght</code> variation is used to implement varying weights.
520
+
Fractional weights are valid.
521
+
522
+
Although the practice is not well-loved by typographers,
523
+
bold faces are often synthesized by user agents for families that lack actual bold faces.
524
+
For the purposes of font matching,
525
+
these faces must be treated as if they exist within the family.
526
+
Authors can explicitly avoid this behavior by using the 'font-synthesis' property.
513
527
514
528
<h3 id="font-stretch-prop">
515
529
Font width: the 'font-stretch!!property' property</h3>
@@ -2634,6 +2648,14 @@ if all font style properties were set to their initial value.
2634
2648
Once the closest matching weight has been determined by this process,
2635
2649
faces with weights which do not include this determined weight are removed from the matching set.
2636
2650
2651
+
Note: There is a small behavior change between [[CSS-FONTS-3]] and this specification
2652
+
with the animation of the 'font-weight' property.
2653
+
Previously, interpolated values of font-weight were rounded to their closest multiple of 100,
2654
+
and the font-matching algorithm was run on these rounded values.
2655
+
In this specification, the font-matching algorithm is able to accept any value,
2656
+
so no rounding occurs.
2657
+
The small behavior change is due to the discontinuous nature of the font-matching algorithm.
2658
+
2637
2659
4. 'font-size' must be
2638
2660
matched within a UA-dependent margin of tolerance. (Typically, sizes
2639
2661
for scalable fonts are rounded to the nearest whole pixel, while the
0 commit comments