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

Fallback fonts #3591

Closed
toonn opened this issue May 7, 2021 · 11 comments
Closed

Fallback fonts #3591

toonn opened this issue May 7, 2021 · 11 comments

Comments

@toonn
Copy link
Contributor

toonn commented May 7, 2021

Is your feature request related to a problem? Please describe.
Sometimes the font you prefer doesn't quite cover all the characters you commonly encounter.

Describe the solution you'd like
Other applications seem to fall back to whichever is the next font to contain a missing glyph. It seems like kitty may not (yet?), hence the feature request.

Is this inherent to kitty's handling of fonts or is there an issue like both fonts would need to be the exact same width or something? Any ways I can troubleshoot why it's not working in my particular case? (It involves emoji so I don't 100% expect it to work but kitty doesn't seem to have a problem with emoji, just the ones missing from my default emoji font.)

@kovidgoyal
Copy link
Owner

kitty implements font fallback. If a glyph is missing in a
font, kitty will query the system to find an alternate font for it. In
addition, if you dont like the default font kitty finds, you can specify
you own via symbol_map in kitty.conf.

https://sw.kovidgoyal.net/kitty/conf.html#opt-kitty.symbol_map

Finally, you can check what fallbacks kitty is using with
--debug-font-fallback

@toonn
Copy link
Contributor Author

toonn commented May 8, 2021

Thanks. My system seems to select the wrong font. Kitty reports the font doesn't actually contain the glyph. So you're saying it's not kitty's but the system's responsibility to suggest the proper font?

@kovidgoyal
Copy link
Owner

Yeah, every application is not supposed to scan every font file on its
own to determine which one has which glyphs. They system is supposed to
maintain a cache of that information, which all applications are
supposed to use.

@toonn
Copy link
Contributor Author

toonn commented May 8, 2021

But why does the system propose the correct font to other applications. Just not kitty?

@kovidgoyal
Copy link
Owner

No clue, it would help if you gave some more details about what the
problem is you are having exactly.

@toonn
Copy link
Contributor Author

toonn commented May 8, 2021

🥵 isn't in my "Apple Color Emoji" font. (I'm stuck on OSX 10.13.6.) I've installed Joypixels to use as a fallback and other applications render its glyph just fine. Kitty's the only one I've noticed that renders it as a wide dash "—". I expect this would happen with at least some other fonts as well.

@kovidgoyal
Copy link
Owner

Aah, you are on macOS. On macOS kitty hardcodes AppleColorEmoji for
emoji since that is the standard font. I suppose I can add a check to
see if it has the emoji and use a fallback if not.

@kovidgoyal kovidgoyal reopened this May 9, 2021
@vpeopleonatank
Copy link

kitty implements font fallback. If a glyph is missing in a
font, kitty will query the system to find an alternate font for it. In
addition, if you dont like the default font kitty finds, you can specify
you own via symbol_map in kitty.conf.

https://sw.kovidgoyal.net/kitty/conf.html#opt-kitty.symbol_map

Finally, you can check what fallbacks kitty is using with
--debug-font-fallback

Can I specify what font fallback kitty use? Because my main font in config is JetBrainMono, It doesn't have some glyps (from patched nerd fonts), sometimes system correctly "choose" my installed Dejavu Nerd font, then it show icon correctly but now system doesn't choose right font (currently check --debug-font-fallback It show JetBrainMono)

@pinpox
Copy link

pinpox commented Aug 1, 2021

Can I specify what font fallback kitty use?

Same issue here. I use an unpatched font and would like to specify the fallback font which will be used for things like emoji or symbols.

@Luflosi
Copy link
Contributor

Luflosi commented Aug 1, 2021

@jakwings
Copy link

Same issues here. But symbol_map is not ideal until I find or make a program to batch generate the maps based on my fallback list. symbol_map will fallback to the placeholder ⯑ instead of a system provided one. I need thousands of glyphs spanning various fonts, especially CJK fonts, Symbola and B&W emojis. A big headache.

Ideally the symbol maps should be calculated and cached by kitty (maybe asynchronously in a background process) every time the listed fonts are updated (infrequently).

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

6 participants