Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[css-font-loading] [info discovery] List of available glyphs #6798

Open
jespertheend opened this issue Nov 5, 2021 · 2 comments
Open

[css-font-loading] [info discovery] List of available glyphs #6798

jespertheend opened this issue Nov 5, 2021 · 2 comments

Comments

@jespertheend
Copy link

Not sure if I'm missing something obvious here, but I'd like to render user generated content in a specific font. And once it contains a missing glyph just swap the entire element with a different font, rather than just those missing glyphs.

The unicodeRange property is arbitrarily large (U+0-10FFFF), even though my font only contains a-z0-1 with a few extra characters.

@tabatkins
Copy link
Member

Wrt info discovery, there's not a lot we can do if you're not setting up the unicode-range properly. Allowing that to work would encourage writing pages that trigger multiple useless font downloads before we finally discover one that works, which is a bad user experience.

But if you do write unicode-range to cover the actual characters of the font, then the FontFaceSet.check() method somewhat works. It's not designed for this use-case, but you can finagle it, by creating a dummy font that's not loaded with a default (full-coverage) unicode-range, and putting its name last in the .check() list, so if it falls back to that font due to bad character coverage, the method will return false.

@jespertheend
Copy link
Author

The main reason why I'd want this functionality is so that I don't have to keep a list of available characters in sync with the actual characters (in case we add more characters later). Which I'd still have to do with a unicode-range.
We only have a single font and would use system fonts in the case of special characters for only a small portion of the site, so no useless font downloads in our case.

But really this functionality would only fix a minor annoyance. I'm not sure this could warrant the bad user experience you'd get from encouraging multiple font downloads.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants