What problem does this address?
Since weights can be a range, it would make sense for any weight within the range of the registered font face to be enqueued.
For example:
wp_register_webfont(
array(
'font-family' => 'Source Serif Pro',
'font-style' => 'normal',
'font-stretch' => 'normal',
'font-weight' => '200 900',
'src' => get_theme_file_uri( '/assets/fonts/SourceSerif4Variable-Roman.ttf.woff2' ),
)
);
Font weight range from 200 to 900 gets registered. But right now, if you try passing a font weight within this range, you get an error:
The "Source Serif Pro:400:normal" font face is not registered.
What is your proposed solution?
Passing a font weight within the range (200 to 900) should enqueue that registered face.
In theme.json:
"fontFamilies": [
{
"fontFamily": "Source Serif Pro",
"name": "Source Serif Pro",
"slug": "source-serif-pro",
"fontFaces": [
{
"fontFamily": "Source Serif Pro",
"fontWeight": "400",
"fontStyle": "normal"
}
]
}
]