From 872118fcbec68c4613585e0172fc0b368ab1df90 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 13 Dec 2017 13:59:11 +0530 Subject: [PATCH] CoreText: Fix incorrect underline position and thickness calculation --- kitty/core_text.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kitty/core_text.m b/kitty/core_text.m index 9736b5379..59404e3fa 100644 --- a/kitty/core_text.m +++ b/kitty/core_text.m @@ -247,8 +247,8 @@ cell_metrics(PyObject *s, unsigned int* cell_width, unsigned int* cell_height, u *cell_width = MAX(1, width); float line_height = MAX(1, floor(self->ascent + self->descent + MAX(0, self->leading) + 0.5)); *cell_height = (unsigned int)line_height; - *underline_position = (unsigned int)self->underline_position; - *underline_thickness = (unsigned int)self->underline_thickness; + *underline_position = floor(self->ascent - self->underline_position + 0.5); + *underline_thickness = (unsigned int)ceil(MAX(0.1, self->underline_thickness)); *baseline = (unsigned int)self->ascent; }