w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.5k stars 661 forks source link

[css-font-loading] Renaming the FontFace 'stretch' attribute to 'width' (to align with CSS Fonts) #10673

Open jfkthame opened 3 months ago

jfkthame commented 3 months ago

With CSS Fonts having replaced the font-stretch descriptor with font-weight, we should presumably make a corresponding change to the FontFace interface defined by CSS Font Loading.

svgeesus commented 3 months ago

Yes, indeed we should.

svgeesus commented 3 months ago

How do we deal with the legacy alias though, on that interface?

jfkthame commented 3 months ago

Presumably the FontFace interface can simply expose both width and stretch attributes, with both being mapped to the same internal value (so that setting either of them will affect the value returned by both).

For the FontFaceDescriptors dictionary passed to the constructor, either width and stretch can be used to set the attribute. If both are present but have different values, what happens? We could either say this throws an error, or define which is to take precedence. (I think I'd vote for giving precedence to width as the "canonical" name of the attribute, and only honoring stretch if width is not present.)

tabatkins commented 3 months ago

Yeah, we can have them both map to the same internal slot, that's fine.

For the dictionary, I think I weakly lean towards "defer to width when both are present", to allow for transitional usage.