Support matching variable stretch, style, weight axis according to the https://drafts.csswg.org/css-fonts-4/#font-matching-algorithm
This will require replacing FontTraits with something like FontSelectionRequest and FontSelectionCapabilities and generalizing FontStyleMatcher.
This bug is about moving from the CSS Fonts Level 3 Font Selection Algorithm to the new version in CSS Fonts Level 4, which supports ranges for stretch, style, weight. With that new OpenType Variations fonts can be matched against and correct axis values for those fonts can be configured. For more info, see my intent to ship:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/AzphlHk8orw
This will require a cross cutting change, which I will try to approach in several stages. I'd kindly ask for help and patience with reviewing this overall rather large change. Thanks in advance.
1) Introduce FontSelectionValue, FontSelectionRequest and FontSelectionCapabilities, which replace FontTraits. Add FontSelectionAlgorithm, which replaces FontStyleMatcher.h|cpp.
FontDescription will contain a FontSelectionRequest (consisting of a FontSelectionValue for stretch, style & weight). FontFaceCache is matching such requests against declared @font-faces, or CSS FontFace objects, which have FontSelectionCapabilties, i.e. ranges of FontSelectionValues for stretch, style weight. This should not have any developer facing functional changes yet, even though internal types need to be changed and some values in parsing need to be changed from CSSIdentifierValue to CSSPrimitiveValue.
2) Introduce unit tests to FontFaceCache, which already test the new variable stretch, style, weight range matching, but don't expose it to CSS yet.
3) Extend CSSPropertyParser, Properties API parseSingleValue stretch, style and weight functions, and CSSPropertyFontUtils to parse the new https://drafts.csswg.org/css-fonts-4/#font-prop-desc font face property descriptors that can have range expressions in them and map those to new CSSValue types that will then be understood by StyleBuilderConverter.
4) Hook things up and enable the previously created ref tests ( https://chromium-review.googlesource.com/c/552123/ ) which exercise the parser, StyleBuilderConverter and FontFaceCache FontSelectionAlgorithm to do variations matching.
Feedback is welcome, especially if you have more ideas for how to split things up.
Comment 1 by bugdroid1@chromium.org
, Jun 14 2017