Skip to content

Commit 6c5c076

Browse files
author
litherum
committed
[css-fonts-4] Font matching algorithm benefits from graphs
#1077
1 parent aa5419d commit 6c5c076

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

css-fonts-4/Overview.bs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1394,12 +1394,33 @@ at least as dark as its predecessor. Only values between 1 - 999 are valid, and
13941394

13951395
<div class="example">
13961396

1397-
Similar to the <a href="#ascendingstretch">previous example</a>, here is the conceptual distance graph for an element styled with "font-weight: 500":
1397+
Similar to the <a href="#ascendingstretch">previous example</a>, here is the conceptual distance graph for an element styled with "font-weight: 400":
13981398

13991399
<img src="styleweight.svg">
14001400

14011401
As you can see, because font B contains the minimum oblique value across the entire family, font B would be selected by this algorithm. However, if font B were somehow eliminated from the family, font D would then contain the lowest distance in the family, so it would be selected. If D were eliminated, A would be selected, followed by fonts C and then E.
14021402
</div>
1403+
1404+
<div class="example">
1405+
1406+
Similar to the <a href="#ascendingstretch">previous example</a>, here is the conceptual distance graph for an element styled with "font-weight: 500":
1407+
1408+
<img src="weightmatching.svg">
1409+
1410+
As you can see, because font D contains the minimum oblique value across the entire family, font D would be selected by this algorithm. However, if font D were somehow eliminated from the family, font B would then contain the lowest distance in the family, so it would be selected. If B were eliminated, C would be selected, followed by fonts A and then E.
1411+
</div>
1412+
Once the closest matching weight has been determined by this process,
1413+
faces with weights which do not include this determined width are removed from the matching set.
1414+
</li>
1415+
1416+
<div class="example">
1417+
1418+
Similar to the <a href="#ascendingstretch">previous example</a>, here is the conceptual distance graph for an element styled with "font-weight: 300":
1419+
1420+
<img src="weightmatching2.svg">
1421+
1422+
As you can see, because font B contains the minimum oblique value across the entire family, font B would be selected by this algorithm. However, if font B were somehow eliminated from the family, font A would then contain the lowest distance in the family, so it would be selected. If A were eliminated, C would be selected.
1423+
</div>
14031424
Once the closest matching weight has been determined by this process,
14041425
faces with weights which do not include this determined width are removed from the matching set.
14051426
</li>

css-fonts-4/styleweight.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)