microsoft / cascadia-code

This is a fun, new monospaced font that includes programming ligatures and is designed to enhance the modern look and feel of the Windows Terminal.
Other
25.39k stars 803 forks source link

Wrong size ligature for long/infinite strings #527

Closed kgizdov closed 3 years ago

kgizdov commented 3 years ago

Cascadia family version

2105.24

Cascadia family variant(s)

Cascadia Code (the version with ligatures)

Font file format(s)

.ttf (variable), .ttf (static), .otf (static)

Platform

Linux (ArchLinux x86_64)

Other Software

kitty terminal Python 3.9.6

What happened?

Relevant tracking issue - https://github.com/kovidgoyal/kitty/issues/3504

The length of the ligature is longer than the length of the string made up of the individual characters resulting in glyph cell overflow and truncation. Tested with multiple software and discussed in relevant issue.

To reproduce: kitty --config NONE -o 'font_family Cascadia Code' python -c "print(('#' * 60), end=']'); input()" results in: kitty-python-test

As can be seen the last # is truncated to fit in the glyph cell. This does not happen in other software as most are happy to overflow.

aaronbell commented 3 years ago

The fun thing with these infinite ligatures is that in the font's construction , the final # of ### is the same glyph as the final # in

Screen Shot 2021-07-05 at 5 50 40 AM

On the font side, here's the substitution for, say #####: # - numbersign_start.seq # - numbersign_middle.seq # - numbersign_middle.seq # - numbersign_middle.seq # - numbersign_end.seq

And as the string gets longer, the number of # - numbersign_middle.seq only gets longer. There's no other difference.

If ### renders fine and a really long string of #################### does not, then the bug is on kitty's end. In both situations the ligated form has the same advanced width as the constituent #.