Skip to content

[css-fonts] Suggest allowing a list of font-family values in @font-face #3691

@faceless2

Description

@faceless2

@font-face only allows a single value for the "font-family" entry, but I can't think of a reason that a list shouldn't be allowed here, and at times it could be useful.

An example: "NotoSans-Black.ttf" has two names in the OpenType name table: "Noto Sans" and "Noto Sans Blk". While best practice would be to define the Noto sans families like so:

@font-face {
    font-family: "Noto Sans";
    font-weight: 900;
    url(NotoSans-Black.ttf);
}
@font-face {
    font-family: "Noto Sans";
    font-weight: 400;
    url(NotoSans.ttf);
}

I can't think of any ambiguity that would arise if you could also do this:

@font-face {
    font-family: "Noto Sans", "Noto Sans Blk";
    font-weight: 900;
    url(NotoSans-Black.ttf);
}
@font-face {
    font-family: "Noto Sans";
    font-weight: 400;
    url(NotoSans.ttf);
}

This would be also useful if the font has names in several languages, eg "MS Mincho" and "MS 明朝". In fact that's probably a more compelling usecase, I should have opened with that really.

Finally, it's also an advantage when generating @font-face rules automatically from font files; there's no need to choose which of the several names an OpenType font is known by as the definitive one, you can just list all the appropriate entries.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions