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

Issues rendering double width icons #3729

Closed
HumblePresent opened this issue Jun 15, 2021 · 14 comments
Closed

Issues rendering double width icons #3729

HumblePresent opened this issue Jun 15, 2021 · 14 comments
Labels

Comments

@HumblePresent
Copy link

Describe the bug
As seen in the screenshot below I am experiencing sporadic rendering issues with double width icons. Sometimes certain icons render fine and others do not, but the next time I open kitty it might be the opposite in terms of which icons have issues but it only appears to affect icons that can be single or double width like those from patched Nerd Fonts.

To Reproduce
Steps to reproduce the behavior:

  1. Using JetBrainsMono Nerd Font from here
  2. Latest git master version of kitty installed via the AUR
  3. See error

Screenshots

kitty_rendering

Environment details

kitty 0.21.1 (63a36a1054) created by Kovid Goyal
Linux dagobah 5.12.9-arch1-1 #1 SMP PREEMPT Thu, 03 Jun 2021 11:36:13 +0000 x86_64
Arch Linux \r (\l)
Running under:X11
Loaded config files:
  /home/riley/.config/kitty/kitty.conf

Config options different from defaults:
active_border_color     Color(red=168, green=153, blue=132)
active_tab_background   Color(red=168, green=153, blue=132)
active_tab_foreground   Color(red=40, green=40, blue=40)
background              Color(red=40, green=40, blue=40)
cursor                  Color(red=235, green=219, blue=178)
cursor_text_color       None
enable_audio_bell       False
enabled_layouts         ['splits', 'stack']
font_family             JetBrainsMono Nerd Font
foreground              Color(red=235, green=219, blue=178)
inactive_border_color   Color(red=60, green=56, blue=54)
inactive_tab_background Color(red=60, green=56, blue=54)
inactive_tab_foreground Color(red=124, green=111, blue=100)
symbol_map:
	U+2800 - U+28ff → Braille
tab_bar_style           powerline
tab_separator           
tab_title_template      {index}: {title}
update_check_interval   24.0
url_prefixes            ('http', 'https', 'file', 'ftp')
window_border_width     (2.0, 'px')
window_padding_width    FloatEdges(left=3.0, top=3.0, right=3.0, bottom=3.0)
Added shortcuts:
	alt+l KeyAction('next_layout')
	shift+ctrl+; KeyAction('launch', ('--location=hsplit',))
	shift+ctrl+\ KeyAction('launch', ('--location=vsplit',))
Changed shortcuts:
	shift+ctrl+0 KeyAction('next_tab')
	shift+ctrl+9 KeyAction('previous_tab')
	shift+ctrl+h KeyAction('neighboring_window', ('left',))
	shift+ctrl+j KeyAction('neighboring_window', ('bottom',))
	shift+ctrl+k KeyAction('neighboring_window', ('top',))
	shift+ctrl+l KeyAction('neighboring_window', ('right',))
	shift+ctrl+up KeyAction('move_window', ('top',))
	shift+ctrl+down KeyAction('move_window', ('bottom',))

Additional context
I am able to reproduce this issue with the default config but font set to JetBrainsMono Nerd Font.

@HumblePresent
Copy link
Author

Hi @kovidgoyal, thanks for getting back to me so quickly. I have read that section of your website before, and the reason I created an issue is because the icons are not just small or truncated and they are followed by a space. I should have mentioned this in my initial post, but it appears when I insert a space after a character that can be double width the rightmost cell displays the portion of the resized icon that would appear in that cell, but the leftmost cell still shows the whole icon in single cell size instead of the resized portion of the icon. I have not had this issue with kitty before and I haven't changed the font files I'm using in a while, so I wondered if there was possibly a change on this end that might be causing the "half resized, half not resized" behavior.

@kovidgoyal
Copy link
Owner

ah ok

@kovidgoyal kovidgoyal reopened this Jun 15, 2021
@HumblePresent
Copy link
Author

Also I thought I should add that I did have to edit my font config according to the FAQ section of the website in order for the font to be detected by kitty. Here's my fonts.conf

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
    <match target="scan">
        <test name="family">
            <string>JetBrainsMono Nerd Font</string>
        </test>
        <edit name="spacing">
            <int>100</int>
        </edit>
    </match>
</fontconfig>

@kovidgoyal
Copy link
Owner

First thing you do is dont use a patched font. Just use plain jetbrains mono and install the nerd font separately kitty will automatically use the symbols from nerd font. Patching often breaks fonts.

@HumblePresent
Copy link
Author

I tried plain JetBrains Mono with the symbols only nerd font and am still experiencing the issue.

@kovidgoyal
Copy link
Owner

Post the output of --debug-font-fallback when running kitty and
displaying just one of these icons.

@HumblePresent
Copy link
Author

Here's the output although there is more than one symbol displayed. The last two lines are from

  1. Pasting a symbol into the terminal -> displayed single cell width icon normally
  2. Adding a space after the icon -> Issue reproduced with one cell still showing single width icon and second cell showing part of resized icon
[166 21:58:56.134400] Preloaded font faces:
[166 21:58:56.134447] normal face: /usr/share/fonts/TTF/JetBrainsMono-Regular.ttf:0
[166 21:58:56.134478] bold face: /usr/share/fonts/TTF/JetBrainsMono-Bold.ttf:0
[166 21:58:56.134523] italic face: /usr/share/fonts/TTF/JetBrainsMono-Italic.ttf:0
[166 21:58:56.134553] bi face: /usr/share/fonts/TTF/JetBrainsMono-BoldItalic.ttf:0
U+f63d Face(family=Symbols Nerd Font, style=2048-em, ps_name=SymbolsNerdFontComplete-2048-em, path=/usr/share/fonts/TTF/Symbols-2048-em Nerd Font Complete.ttf, index=0, is_scalable=True, has_color=False, ascender=1638, descender=-410, height=2048, underline_position=-306, underline_thickness=102, strikethrough_position=530, strikethrough_thickness=102) (new face)
U+f63d Face(family=Symbols Nerd Font, style=2048-em, ps_name=SymbolsNerdFontComplete-2048-em, path=/usr/share/fonts/TTF/Symbols-2048-em Nerd Font Complete.ttf, index=0, is_scalable=True, has_color=False, ascender=1638, descender=-410, height=2048, underline_position=-306, underline_thickness=102, strikethrough_position=530, strikethrough_thickness=102)
U+e5fe bold Face(family=Symbols Nerd Font, style=2048-em, ps_name=SymbolsNerdFontComplete-2048-em, path=/usr/share/fonts/TTF/Symbols-2048-em Nerd Font Complete.ttf, index=0, is_scalable=True, has_color=False, ascender=1638, descender=-410, height=2048, underline_position=-306, underline_thickness=102, strikethrough_position=530, strikethrough_thickness=102) (new face)
U+f63d Face(family=Symbols Nerd Font, style=2048-em, ps_name=SymbolsNerdFontComplete-2048-em, path=/usr/share/fonts/TTF/Symbols-2048-em Nerd Font Complete.ttf, index=0, is_scalable=True, has_color=False, ascender=1638, descender=-410, height=2048, underline_position=-306, underline_thickness=102, strikethrough_position=530, strikethrough_thickness=102)
U+e5fe bold Face(family=Symbols Nerd Font, style=2048-em, ps_name=SymbolsNerdFontComplete-2048-em, path=/usr/share/fonts/TTF/Symbols-2048-em Nerd Font Complete.ttf, index=0, is_scalable=True, has_color=False, ascender=1638, descender=-410, height=2048, underline_position=-306, underline_thickness=102, strikethrough_position=530, strikethrough_thickness=102)

@kovidgoyal
Copy link
Owner

I am not able to replicate on Arch with kitty running from master with
the following:

kitty --config=NONE -o 'font_family JetBrains Mono' -o 'symbol_map U+e5fe Symbols Nerd Font' --debug-font-fallback sh -c "printf '\ue5fe a'; read"

The folder icon is correctly rendered, as expected, despite the space
after.

This is with the fonts:

community/ttf-jetbrains-mono 2.225-1
community/ttf-nerd-fonts-symbols-mono 2.1.0+36+gd0bf73a1-4

@HumblePresent
Copy link
Author

Ok so that also displays normally for me, but what if you try pasting that character into the terminal and then adding a space after? That seems to be the case that consistently causes the issue for me.

@kovidgoyal
Copy link
Owner

Like this?
kitty --config=NONE -o 'font_family JetBrains Mono' -o 'symbol_map U+e5fe Symbols Nerd Font' --debug-font-fallback sh -c "printf '\ue5fe'; sleep 0.1s; printf ' ';read"

@kovidgoyal kovidgoyal reopened this Jun 16, 2021
@HumblePresent
Copy link
Author

Yes that causes the issue for me

@kovidgoyal
Copy link
Owner

OK, I'll take a look at it when I have a few minutes

@HumblePresent
Copy link
Author

I just did a quick check and so far I have not been able to reproduce the issue with kitty release version 0.20.3 but I am able to reproduce it with release version 0.21.0. Hope that helps narrow it down at least a little bit.

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

2 participants