CSS3字体匹配算法解读

Interpreting the CSS 3 font matching algorithm

CSS 3 Font Matching Algorithm 状态

4. a. ‘font-stretch’ is tried first. If the matching set contains faces with width values matching the ‘font-stretch’ value, faces with other width values are removed from the matching set. If there is no face that exactly matches the width value the nearest width is used instead. If the value of ‘font-stretch’ is ‘normal’ or one of the condensed values, narrower width values are checked first, then wider values. If the value of ‘font-stretch’ is one of the expanded values, wider values are checked first, followed by narrower values. Once the closest matching width has been determined by this process, faces with other widths are removed from the matching set.

您如何解释规范的顺序与 "closest matching width" 相结合?

说可用的宽度是

如果页面请求 font-stretch: expanded (125%),规范说要先查看较宽的值,然后再查看较窄的值。 selected 宽度最终会变成 ultra-expanded 因为它 expanded 或者 semi-expanded 因为它是 更接近 expanded?

或者,采取更极端的情况,如果两个可用宽度是

font-stretch: normal (100%) 被请求,算法 select?

来自3.3. Font width: the font-stretch property

When a face does not exist for a given width, normal or condensed values map to a narrower face, otherwise a wider face. Conversely, expanded values map to a wider face, otherwise a narrower face.

唯一符合该说法的算法解释是:

对于第一种情况:"the nearest wider face if any, otherwise the nearest narrower face."
ultra-expanded

对于第二种情况:"the nearest narrower face if any, otherwise the nearest wider face."
ultra-condensed