Skip to content

[css-fonts-5] Add "font-synthesis: super" #7441

@faceless2

Description

@faceless2

CSS fonts 4 has this:

Because of the semantic nature of subscripts and superscripts, when the value is either sub or super for a given contiguous run of text, if a variant glyph is not available for all the characters in the run, simulated glyphs should be synthesized for all characters using reduced forms of the glyphs that would be used without this feature applied.

Which is nice, but it's currently implemented in Gecko only. The spec also marks this as "at risk".

This means font-variant-position is a bit useless - as it may or may not generate superscript, everyone just uses font-size and vertical-align instead which is guaranteed to work cross-browser, even if it's not as nice typographically.

Ideally all platforms would implement it, but an alternative would be: add font-synthesis: super to control whether this substitution takes place, and have it set by default. My presumption is this would be pretty easy to implement.

More useful than turning it off is checking for whether it's supported. This would make font-variant-position safe to use in a cross-browser way.

.call {
    font-size: 0.7em;
    vertical-align: super;
}
@supports (font-synthesis: super) {
    .call {
        font-size: inherit;
        vertical-align: inherit;
        font-variant-position: super;
    }
}

Technically it applies to subscript too, so could be font-synthesis: position?

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