[csswg-drafts] [css-fonts] Remove the <string> values from override-color and base-palette (#6627)

litherum has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-fonts] Remove the <string> values from override-color and base-palette ==
OpenType's string names for palettes and the colors inside them are meant to be displayed to the _user_, not the developer/author. The idea is for software to show a picker which displays the string names, and allow the user to interact with the picker. Then, the picker's internal logic would map the string names to indices internally, and supply the indices to CSS.

If a developer is hardcoding a particular palette or color in their CSS (rather than showing a picker), then they have already read the documentation for their font, and they know indices as well as names. (If they haven't read the documentation, neither string names nor indices will help them.) So, strings don't help them.

The problem with the strings is that they are localized, so each of these strings actually has many different options inside the file to be compared with. Implementing the string comparison involves an O(n) search over the palettes, and for each of those, an O(m) search over the localizations. You could improve this performance with preprocessing, but that's preprocessing that would almost entirely be wasted work, since any given webpage would likely use only a small fraction of the number of localized strings in the font. The strings also don't have to be unique, so there would need to be some kind of tiebreaker scheme.

This is realized by a platform API exposing this information as something like `getPaletteData(locale) -> map<index, localizedNameString>`. Here, the platform API doesn't tell the browser about all the localized strings; but instead it just maps from index to the best (one) localized string - this one string is what the picker would display. Indeed; with this kind of platform API, a browser actually can't implement the <string> values in `override-color` and `base-palette`.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/6627 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Friday, 17 September 2021 00:19:50 UTC