Skip to content

Commit

Permalink
Remove the ceil() call around fontDescent in Core Text renderer
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ychin committed Jan 21, 2023
1 parent 2007549 commit 9fc4b1c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/MacVim/MMCoreTextView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 9fc4b1c

Please sign in to comment.