From 9fc4b1ca57543a77e920862e78ef467e1d6698e9 Mon Sep 17 00:00:00 2001 From: Yee Cheng Chin Date: Fri, 20 Jan 2023 18:25:16 -0800 Subject: [PATCH] Remove the ceil() call around fontDescent in Core Text renderer I have looked and I do not believe there is a good reason to do this rounding up at all. I believe the motivation is to align the baseline with the pixel boundary, but I don't believe that is necessary, given that Core Text will properly perform the correct antialiasing for us. Most texts aren't directly aligned at the baseline anyway. Before, that ceil() option is a reason why sometimes fonts would feel pushed upwards, clipping emojis to the top, and creating a lopsided effect for fonts like Fira Code (h11), since we draw the boxes aligned to the line height at the bottom of the descender, meaning the ceil() has an effect of pushing the text up. --- src/MacVim/MMCoreTextView.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/MacVim/MMCoreTextView.m b/src/MacVim/MMCoreTextView.m index 85a169fcc5..0dbf22e2e2 100644 --- a/src/MacVim/MMCoreTextView.m +++ b/src/MacVim/MMCoreTextView.m @@ -434,7 +434,7 @@ - (void)setFont:(NSFont *)newFont } else { font = [newFont retain]; } - fontDescent = ceil(CTFontGetDescent((CTFontRef)font)); + fontDescent = CTFontGetDescent((CTFontRef)font); fontAscent = CTFontGetAscent((CTFontRef)font); fontXHeight = CTFontGetXHeight((CTFontRef)font);