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

Sometimes unicode symbols are not displayed #799

Closed
ahmedelgabri opened this issue Aug 8, 2018 · 10 comments
Closed

Sometimes unicode symbols are not displayed #799

ahmedelgabri opened this issue Aug 8, 2018 · 10 comments
Labels

Comments

@ahmedelgabri
Copy link

ahmedelgabri commented Aug 8, 2018

Sometimes I end up with characters like this in my prompt

screen shot 2018-08-08 at 22 10 52

And it happens quite randomly sometimes it renders, sometimes not, I tried several fonts too:

  • San Francisco Mono
  • IBM Plex Mono
  • Fira Code
  • Iosevka Term

Here are the symbols I use https://github.com/ahmedelgabri/dotfiles/blob/ef31ad9d2ad052e1901f8c406a22948f4f43d701/zsh/.zshrc#L139-L150

They all work in iTerm & alacritty fine.

@alok
Copy link

alok commented Aug 8, 2018

I've had this too. I use DejaVu sans mono and most of the time the symbols render fine, but very occasionally it doesn't happen.

@kovidgoyal
Copy link
Owner

Use the --debug-font-fallback option to get information about what fonts are used to render symbols not present in the main font (although I dont recall how well that option is implemented on macOS). Still it might give something useful.

@kovidgoyal
Copy link
Owner

Oh and note that you can tell kitty exactly which font you want it to use for a particular symbol via symbol_map in kitty.conf

@ahmedelgabri
Copy link
Author

Oh and note that you can tell kitty exactly which font you want it to use for a particular symbol via symbol_map in kitty.conf

Yeah I know that, but these symbols are in the font & gets rendered already sometimes. That's the problem; it's a bit random. Sometimes they work, sometimes not.

I'm not even sure if it's a fallback font issue, since they render fine with all the fonts I listed in multiple terminal emulators

For example in Iosevka's U+E0A0 https://be5invis.github.io/Iosevka/specimen.html there is a branch glyph. Sometimes it renders & sometimes not.

Here is the output of --debug-font-fallback

[221 11:18:24.030074] Preloaded font faces:
[221 11:18:24.030123] normal face: {'path': '/Users/ahmed/Library/Fonts/iosevka-term-medium.ttf', 'postscript_name': 'Iosevka-Term-Medium', 'family': 'Iosevka Term', 'style': 'Medium', 'bold': False, 'italic': False, 'monospace': True, 'weight': 0.23000000417232513, 'width': 0.0, 'traits': 2147484672}
[221 11:18:24.030153] bold face: {'path': '/Users/ahmed/Library/Fonts/iosevka-term-extrabold.ttf', 'postscript_name': 'Iosevka-Term-Extrabold', 'family': 'Iosevka Term', 'style': 'Extrabold', 'bold': True, 'italic': False, 'monospace': True, 'weight': 0.5, 'width': 0.0, 'traits': 2147484674}
[221 11:18:24.030174] italic face: {'path': '/Users/ahmed/Library/Fonts/iosevka-term-mediumitalic.ttf', 'postscript_name': 'Iosevka-Term-Medium-Italic', 'family': 'Iosevka Term', 'style': 'Medium Italic', 'bold': False, 'italic': True, 'monospace': True, 'weight': 0.23000000417232513, 'width': 0.0, 'traits': 2147484673}
[221 11:18:24.030191] bi face: {'path': '/Users/ahmed/Library/Fonts/iosevka-term-extrabolditalic.ttf', 'postscript_name': 'Iosevka-Term-Extrabold-Italic', 'family': 'Iosevka Term', 'style': 'Extrabold Italic', 'bold': True, 'italic': True, 'monospace': True, 'weight': 0.5, 'width': 0.0, 'traits': 2147484675}
U+9f8 Face(family=Kohinoor Bangla, full_name=Kohinoor Bangla Medium, postscript_name=KohinoorBangla-Medium, path=/System/Library/Fonts/KohinoorBangla.ttc, units_per_em=1000, ascent=25.2, descent=8.4, leading=2.4, point_sz=0.0, scaled_point_sz=24.0, underline_position=-1.8 underline_thickness=1.2) (new face)
U+9f8 Face(family=Kohinoor Bangla, full_name=Kohinoor Bangla Medium, postscript_name=KohinoorBangla-Medium, path=/System/Library/Fonts/KohinoorBangla.ttc, units_per_em=1000, ascent=25.2, descent=8.4, leading=2.4, point_sz=0.0, scaled_point_sz=24.0, underline_position=-1.8 underline_thickness=1.2)

@kovidgoyal
Copy link
Owner

I need the debug output from a time when it doesn't render fine.

@ahmedelgabri
Copy link
Author

ahmedelgabri commented Sep 3, 2018

Here is a debug output when this happened

∴ kitty --debug-font-fallback
[246 23:22:30.677002] Preloaded font faces:
[246 23:22:30.677045] normal face: {'monospace': True, 'bold': False, 'italic': False, 'family': 'IBM Plex Mono'}
[246 23:22:30.677066] bold face: {'monospace': True, 'bold': True, 'italic': False, 'family': 'IBM Plex Mono'}
[246 23:22:30.677083] italic face: {'monospace': True, 'bold': False, 'italic': True, 'family': 'IBM Plex Mono'}
[246 23:22:30.677099] bi face: {'monospace': True, 'bold': True, 'italic': True, 'family': 'IBM Plex Mono'}
U+25b2 Face(family=Courier New, full_name=Courier New, postscript_name=CourierNewPSMT, path=/Library/Fonts/Courier New.ttf, units_per_em=2048, ascent=20.0, descent=7.2, leading=0.0, point_sz=0.0, scaled_point_sz=24.0, underline_position=-5.6 underline_thickness=1.0) (new face)
U+e0a0 Face(family=.LastResort, full_name=.LastResort, postscript_name=LastResort, path=/System/Library/Fonts/LastResort.otf, units_per_em=2048, ascent=20.0, descent=6.0, leading=0.2, point_sz=0.0, scaled_point_sz=24.0, underline_position=-1.7 underline_thickness=0.2) (new face)
U+25b2 Face(family=Courier New, full_name=Courier New, postscript_name=CourierNewPSMT, path=/Library/Fonts/Courier New.ttf, units_per_em=2048, ascent=20.0, descent=7.2, leading=0.0, point_sz=0.0, scaled_point_sz=24.0, underline_position=-5.6 underline_thickness=1.0)
U+e0a0 Face(family=.LastResort, full_name=.LastResort, postscript_name=LastResort, path=/System/Library/Fonts/LastResort.otf, units_per_em=2048, ascent=20.0, descent=6.0, leading=0.2, point_sz=0.0, scaled_point_sz=24.0, underline_position=-1.7 underline_thickness=0.2)
U+25b2 Face(family=Courier New, full_name=Courier New, postscript_name=CourierNewPSMT, path=/Library/Fonts/Courier New.ttf, units_per_em=2048, ascent=20.0, descent=7.2, leading=0.0, point_sz=0.0, scaled_point_sz=24.0, underline_position=-5.6 underline_thickness=1.0)

and a screenshot showing a missing glyph

screen shot 2018-09-03 at 23 22 55

And this is the font-family I was using

∴ kitty list-fonts | grep IBM
IBM Plex Mono
    IBM Plex Mono Bold
    IBM Plex Mono Bold Italic
    IBM Plex Mono ExtraLight
    IBM Plex Mono ExtraLight Italic
    IBM Plex Mono Italic
    IBM Plex Mono Light
    IBM Plex Mono Light Italic
    IBM Plex Mono Medium
    IBM Plex Mono Medium Italic
    IBM Plex Mono Regular
    IBM Plex Mono SemiBold
    IBM Plex Mono SemiBold Italic
    IBM Plex Mono Text
    IBM Plex Mono Text Italic
    IBM Plex Mono Thin
    IBM Plex Mono Thin Italic

@kovidgoyal
Copy link
Owner

That shows it is indeed a fallback issue, cocoa is returning the "Last Resort" font for the U+e0a0 symbol. That font always renders as a question mark. U+e0a0 is a private use symbol https://www.fileformat.info/info/unicode/char/e0a0/index.htm

so it will not be present in normal fonts. What font on your system has this symbol? For private use unicode codepoints you really should use symbol_map -- that's what it's designed for. Otherwise what rendering your get for it is not determined by any standard and depends on what order the ystem searches fonts for it.

@ahmedelgabri
Copy link
Author

That symbol is in Iosevka but that was not the only symbol there were also , & which should be available in IBM Plex too. You can try the typetester here https://www.ibm.com/plex/

@juanibiapina
Copy link

This still happens. Suddently all weird unicode characters are gone. Restarting kitty doesn't help. At some point things go back to normal, but I can't find the cause.

@femtomc
Copy link

femtomc commented May 17, 2020

I'm having the same issue as well - although I think mine is slightly complicated by the fact that I'm using PragmataPro Mono (which doesn't support nerd font glyphs). Sometimes, they render correctly - sometimes they don't.

Is there a way to force a fallback? I'm don't know much about this.

Edit: interesting twist on this - I'm using ranger and when I highlight a file it renders the glyph correctly.

image

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

No branches or pull requests

5 participants