Skip to content

[css-fonts-4] [varfont] @font-face descriptors should accept ranges #521

@litherum

Description

@litherum

Migrated on behalf of @AmeliaBR

Would there be a value in allowing the font-face descriptors (e.g., font-weight, font-stretch) to take two values, defining the range available from the file?

If you use range descriptors, then the non-variable fallbacks no longer match the descriptors, and would need separate font-face rules. However, I'm pretty sure that still works with @font-face as currently defined, just need to watch the ordering:

@font-face { /* fallback normal weight face */
font-family: BodyText;
font-weight: normal;
src: url(something) format(woff);
}
@font-face { /* fallback bold weight face */
font-family: BodyText;
font-weight: bold;
src: url(something-bold) format(woff);
}
@font-face { /* variable weight font */
font-family: BodyText;
font-weight: 200/700; /* min and max weights */
src: url(something-variable) format(woff2-variations);
}

So user agents that recognize the range descriptor and variable-font format would download the final file, others would download one or all of the backups (depending on which weights are required).

EDIT: I initially had the range descriptor using comma to separate the values. But it would probably be best to reserve commas for a list of distinct values (not a range). So, for example, if a user agent supported OpenType collection files (multiple distinct faces in one file), that could be font-weight: 300, 500, 800, while a variable-weight font with a continuous range would be font-weight: 200/800.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions