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

[Feature] Dynamic font replacement #12702

Open
oberrich opened this issue May 8, 2024 · 0 comments
Open

[Feature] Dynamic font replacement #12702

oberrich opened this issue May 8, 2024 · 0 comments

Comments

@oberrich
Copy link
Contributor

oberrich commented May 8, 2024

Currently there are multiple inherent issues with replacing the font globally:

Currently this feature is implemented naively in createTextStyle.
I think it might be interesting to expand on this feature by:

  • Detecting monospaced fonts
  • Detecting emoji/icon fonts

This could be done possibly by either checking the name (e.g. is font family ui-monospace, Consolas, ...`), actually analyzing the font's glyphs/code points programmatically or rendering it to see if it displays correctly. Fallback: Don't replace font.

This would allow to offer a much more granular control over font replacement, for example based on the standard CSS font-family aliases ui-*, emoji, math, etc.

Example: Chromium font selection

image


Why not fix inside dynamic theme fixes?

It's not sustainable to hardcode a list of monospaced fonts for every broken site and keep that up-to-date.
Sometimes it's also non-trivial to match code blocks using CSS or HTML directly, so we need to use globs/wildcards and that's not trivial. Not overriding the font in the first place for an element that should be excluded would be ideal.

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

1 participant