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

Nerd font symbol renders differently based on first instance of the symbol #2117

ratorx opened this issue Nov 7, 2019 · 2 comments


Copy link

ratorx commented Nov 7, 2019


Kitty version: 0.14.6
OS: Arch Linux
Font: Ubuntu Mono
Symbol Map: U+E000-U+FFFF 3270Narrow Nerd Font


Script with two lines:

  • Line 1: echo -e 'M \uf111 M'
  • Line 2: echo -e 'M\uf111M'

Run the script in a fresh terminal instance.

Actual Behaviour

Depending on the order of lines in the script, the rendering for all instances of the character u+f111 changes.

If line 2 is after line 1:
screenshot from 2019-11-07 16:00:20

If they are the other way around:
screenshot from 2019-11-07 16:01:04

The chosen size of the symbol seems to be sticky (i.e. once the character is rendered a certain size, it is always rendered in that size). The only way to force rendering of the other version is to restart kitty.

Expected Behaviour

The first render of an ambiguous width character should not determine the character to use for all renders.

I like the behaviour of rendering a larger version of the character if there is enough space to allow it, but this should be dynamically determined, rather than being cached after the first instance of the character.

Using a symbol map of 3270Narrow Nerd Font Mono fixes this issue by forcing the small version of all characters to be rendered, but I would rather be able to dynamically use the bigger version.

Copy link

bew commented Nov 8, 2019

Hi @kovidgoyal, could you quickly explain in a line or two how the fix works?
Thank you

Copy link

kitty renders every character only once. And then re-uses the stored
alpha map for that character. This cache is per font face and keyed by
glyph ids. However, glyph rendering can change when involved in a
multi-glyph ligature, so that cache is actually keyed by glyph + extra
ligature glyphs. For private use unicode codepoints followed by spaces
kitty uses a fake ligature with the spaces to render the glyph at full
size. Because some silly fonts such as powerline do not have space
glyphs I made a change in 0.14.5 to not actually render the spaces in
the space ligature. However this change had the inadvertent side-effect
of making the cache hit for both non-space-ligature and space-ligature
versions of the same glyph. My fix was to make the cache key have an
extra field indicating the number of spaces in the ligature.

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

No branches or pull requests

3 participants