From 2c8f66586f5f4cfca65efea0edcc1d256e1faac1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 13 Jun 2021 09:29:30 +0530 Subject: [PATCH] macOS: Fix a regression in the previous release that broke rendering of strikeout The new cell height code forgot to adjust strikeout position. Fixes #3717 --- docs/changelog.rst | 7 +++++++ kitty/core_text.m | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index c543a4e56..faeaf182c 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,6 +4,13 @@ Changelog |kitty| is a feature-rich, cross-platform, *fast*, GPU based terminal. To update |kitty|, :doc:`follow the instructions `. +0.21.1 [future] +---------------------- + +- macOS: Fix a regression in the previous release that broke rendering of + strikeout (:iss:`3717`) + + 0.21.0 [2021-06-12] ---------------------- diff --git a/kitty/core_text.m b/kitty/core_text.m index 729f6ec3d..a878825da 100644 --- a/kitty/core_text.m +++ b/kitty/core_text.m @@ -342,7 +342,6 @@ cell_metrics(PyObject *s, unsigned int* cell_width, unsigned int* cell_height, u } *cell_width = MAX(1u, width); *underline_thickness = (unsigned int)ceil(MAX(0.1, self->underline_thickness)); - *strikethrough_position = (unsigned int)floor(*baseline * 0.65); *strikethrough_thickness = *underline_thickness; // float line_height = MAX(1, floor(self->ascent + self->descent + MAX(0, self->leading) + 0.5)); // Let CoreText's layout engine calculate the line height. Slower, but hopefully more accurate. @@ -373,6 +372,7 @@ cell_metrics(PyObject *s, unsigned int* cell_width, unsigned int* cell_height, u // Not sure if we should add this to bounds ascent and then round it or add // it to already rounded baseline and round again. *underline_position = (unsigned int)floor(bounds_ascent - self->underline_position + 0.5); + *strikethrough_position = (unsigned int)floor(*baseline * 0.65); debug("Cell height calculation:\n"); debug("\tline height from line origins: %f\n", line_height); @@ -381,7 +381,7 @@ cell_metrics(PyObject *s, unsigned int* cell_width, unsigned int* cell_height, u debug("\tbounds metrics: ascent: %f\n", bounds_ascent); debug("\tline metrics: ascent: %f descent: %f leading: %f\n", typographic_ascent, typographic_descent, typographic_leading); debug("\tfont metrics: ascent: %f descent: %f leading: %f underline_position: %f\n", self->ascent, self->descent, self->leading, self->underline_position); - debug("\tcell_height: %u baseline: %u underline_position: %u\n", *cell_height, *baseline, *underline_position); + debug("\tcell_height: %u baseline: %u underline_position: %u strikethrough_position: %u\n", *cell_height, *baseline, *underline_position, *strikethrough_position); CFRelease(test_frame); CFRelease(path); CFRelease(framesetter);