diff --git a/docs/changelog.rst b/docs/changelog.rst index 922070c0e..1f4676983 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -78,6 +78,9 @@ To update |kitty|, :doc:`follow the instructions `. - macOS: Fix a rare crash on exit (:iss:`3686`) +- Fix ligatures not working with the Iosevka font (requires Iosevka >= 7.1) + (:iss:`297`) + 0.20.3 [2021-05-06] ---------------------- diff --git a/kitty/freetype.c b/kitty/freetype.c index aa2212a60..d6a53a836 100644 --- a/kitty/freetype.c +++ b/kitty/freetype.c @@ -576,7 +576,7 @@ place_bitmap_in_canvas(pixel *cell, ProcessedBitmap *bm, size_t cell_width, size dest.top = baseline - yoff; } - /* printf("x_offset: %d bearing_x: %f y_offset: %d bearing_y: %f src_start_row: %u src_start_column: %u dest_start_row: %u dest_start_column: %u bm_width: %lu bitmap_rows: %lu\n", xoff, bearing_x, yoff, bearing_y, src.top, src.left, dest.top, dest.left, bm->width, bm->rows); */ + /* printf("x_offset: %d y_offset: %d src_start_row: %u src_start_column: %u dest_start_row: %u dest_start_column: %u bm_width: %lu bitmap_rows: %lu\n", xoff, yoff, src.top, src.left, dest.top, dest.left, bm->width, bm->rows); */ if (bm->pixel_mode == FT_PIXEL_MODE_BGRA) { copy_color_bitmap(bm->buf, cell, &src, &dest, bm->stride, cell_width); diff --git a/kitty_tests/fonts.py b/kitty_tests/fonts.py index 52b30aad6..a64e60175 100644 --- a/kitty_tests/fonts.py +++ b/kitty_tests/fonts.py @@ -99,16 +99,22 @@ class Rendering(BaseTest): def groups(text, font=None): return [x[:2] for x in ss(text, font)] - for font in ('FiraCode-Medium.otf', 'CascadiaCode-Regular.otf'): + for font in ('FiraCode-Medium.otf', 'CascadiaCode-Regular.otf', 'iosevka-regular.ttf'): g = partial(groups, font=font) self.ae(g('abcd'), [(1, 1) for i in range(4)]) - self.ae(g('----'), [(4, 4)]) self.ae(g('A===B!=C'), [(1, 1), (3, 3), (1, 1), (2, 2), (1, 1)]) - self.ae(g('F--a--'), [(1, 1), (2, 2), (1, 1), (2, 2)]) - self.ae(g('===--<>=='), [(3, 3), (2, 2), (2, 2), (2, 2)]) - self.ae(g('==!=<>==<><><>'), [(4, 4), (2, 2), (2, 2), (2, 2), (2, 2), (2, 2)]) self.ae(g('A=>>B!=C'), [(1, 1), (3, 3), (1, 1), (2, 2), (1, 1)]) - self.ae(g('-' * 18), [(18, 18)]) + if 'iosevka' in font: + self.ae(g('--->'), [(4, 4)]) + self.ae(g('-' * 12 + '>'), [(13, 13)]) + self.ae(g('<~~~'), [(4, 4)]) + self.ae(g('a<~~~b'), [(1, 1), (4, 4), (1, 1)]) + else: + self.ae(g('----'), [(4, 4)]) + self.ae(g('F--a--'), [(1, 1), (2, 2), (1, 1), (2, 2)]) + self.ae(g('===--<>=='), [(3, 3), (2, 2), (2, 2), (2, 2)]) + self.ae(g('==!=<>==<><><>'), [(4, 4), (2, 2), (2, 2), (2, 2), (2, 2), (2, 2)]) + self.ae(g('-' * 18), [(18, 18)]) colon_glyph = ss('9:30', font='FiraCode-Medium.otf')[1][2] self.assertNotEqual(colon_glyph, ss(':', font='FiraCode-Medium.otf')[0][2]) self.ae(colon_glyph, 1031) diff --git a/kitty_tests/iosevka-regular.ttf b/kitty_tests/iosevka-regular.ttf new file mode 100644 index 000000000..34d888641 Binary files /dev/null and b/kitty_tests/iosevka-regular.ttf differ