w3c / csswg-drafts

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

[css-fonts-4] PUA fallback #6851

Open litherum opened 2 years ago

litherum commented 2 years ago

The spec currently says:

If a given character is a Private-Use Area Unicode codepoint, user agents must only match font families named in the font-family list that are not generic families. If none of the families named in the font-family list contain a glyph for that codepoint, user agents must display some form of missing glyph symbol for that character rather than attempting system font fallback for that codepoint.

This should probably be made more strict. Because PUA characters are font-specific, and websites don't know what fonts are installed on the system (or any details about them like their character coverage), no installed font should match any PUA characters.

@svgeesus

drott commented 2 years ago

Edit: Yes, I raised this in a previous issue: https://github.com/w3c/csswg-drafts/issues/2110

Agree, we do not do system fallback for PUA anymore in Chrome, it's bitten us before mainly when a particular icon or specific math font gets installed on the system and suddenly provides wide PUA coverage. On top of the correctness problems, searching for fallback in the PUA region is inefficient from a performance point of view, as it's so unlikely to find coverage in any font.

IIRC MS has a slightly different view on it, as they provide a mechanism called EUDC that places user-group wide extensions into the PUA range for specific system fonts: https://docs.microsoft.com/en-us/windows/win32/intl/eudc

See also @SergeyMalkin's earlier comment: https://github.com/w3c/csswg-drafts/issues/2110#issuecomment-352853932

CC @dlibby-

litherum commented 2 years ago

Interesting, thanks for the links.

Maybe we should say "certain installed fonts can be used for certain PUA characters, but UAs should try to be conservative" or something. This attempts to strike a balance between allowing for @SergeyMalkin's concerns while also attempting to not make the problem get any bigger in the future.