Skip to content

[css-fonts][cssom] Serialization of font properties when system font is specified #1586

@upsuper

Description

@upsuper

For example, if I have font: menu, what should be returned for

  • getPropertyValue('font')
  • getPropertyValue('font-family')
  • cssText

This isn't quite interop at the moment. See the following table on Windows:

Browser font font-family cssText
Blink 12px "Segoe UI" "Segoe UI" expand to all longhands
Edge menu Segoe UI font: 400 9pt Segoe UI;
Gecko menu -moz-use-system-font font: menu;

In Gecko, we use an internal property for holding system font with a placeholder value on all font longhands. And then we expand that to actual value during computation. I admit that the -moz-prefixed thing doesn't make much sense here anyway.

It seems to me that Blink expands the system font into their actual value during parsing. This is probably the simplest way to implement, and the spec somehow indicates this behavior (see the last yellow box in the section of font shorthand), but there is a problem with this approach that, it would be unable to respond to system setting changes.

Edge seems to go a middle path, although I'm not sure how exactly it is implemented. My guess is that, they store system font as specified value, and when others want to serialize the longhands, it returns the effective value of the corresponding system font?

It would probably make most sense to standardize some behavior similar to Edge, but returns font: menu; for cssText instead, I guess.

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