Re: [csswg-drafts] [css-fonts-4] Definition of `normal` for font-palette not well-defined or interoperable (#9281)

> https://www.w3.org/TR/css-fonts-4/#font-palette-prop describes the `normal` property value as follows.
> 
> > User-Agents attempt to treat the color font as closely as possible to a non-color font. In particular, user-agents use a palette which will yield the best default result for reading. User-agents may take the computed value of the [color](https://www.w3.org/TR/css-color-4/#propdef-color) property into consideration when making this decision. User agents may also construct and use a palette not defined in the font.
> 
> I describe below why I find this definition here not well defined and how it lacks interoperability:
> ### Lack of interop / algorithmic description for discretion of palette choice
> 
>  * "In particular, user-agents use a palette which will yield the best default result for reading."
> 
> 
> Other than with `USABLE_WITH_(LIGHT|DARK)_BACKGROUND` there are not attributes on the palettes in the font that would let the user agent algorythmically choose such a palette. https://learn.microsoft.com/en-us/typography/opentype/spec/cpal#palette-type-array
> 
> What we can define here is only: "User agents choose the default palette of the color font to render glyphs."

I'm not necessarily opposed to that simplification, but just trying to understand the intention of the existing text....

"user-agents use a palette which will yield the best default result for reading" -- my assumption is that the UA would choose between palettes tagged "light" and "dark" based on the current background color. So `normal` would behave as `light` if the background is light, and as `dark` if the background is dark. (For some definition of "light" and "dark"....maybe based on levels of luminosity. Maybe only applicable if the background is sufficiently close to the white or black ends of the scale; for mid-range luminosity levels we'd just use the default palette.)

>  * "User-agents may take the computed value of the [color](https://www.w3.org/TR/css-color-4/#propdef-color) property into consideration when making this decision. "
> 
> 
> Is similarly weakly defined and not helpful or interoperable without an algorithmic description of what should happen. What is the idea here? Should there be some sort of similarity score between a foreground color and a set of palette colors? I suggest to strip this.

Possible interpretation: if the computed value of `color` is "light" (again, needs a definition) then choose the palette tagged "dark", and vice versa.

> ### Lack of interop / algorithmic description for synthetisation of "monochromatic-looking" palette
> 
> > "User agents may also construct and use a palette not defined in the font."
> 
> What would be the use case here or how would a user agent be successful with that? Is the idea here to compute a default grayscale palette that matches luminosity of the default color palette of the font?

This seems a bad idea, in general; I can't see how the UA could come up with anything sensible.


> ### Glyph selection preference should be the colored glyph
> 
> > "User-Agents attempt to treat the color font as closely as possible to a non-color font."
> 
> I tend to disagree with that. When the font has a color-glyph in `SBIX`, `CBDT/CBLX`, `COLR` or `SVG ` tables, in the spirit of incremental enhancement that glyph should usually be preferred over the monochromatic variant when the UA supports the color font format, as it provides the richer representation.

+1


-- 
GitHub Notification of comment by jfkthame
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/9281#issuecomment-1701067169 using your GitHub account


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

Received on Thursday, 31 August 2023 13:44:10 UTC