Skip to content

Commit 4062365

Browse files
committed
Revert "Adjust cell height automatically for buggy fonts that draw brackets outside the bounding box"
This reverts commit 5555a66. Since it does not fix the issue.
1 parent 7f48a92 commit 4062365

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

docs/changelog.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
1414
- Fix a regression in the previous release that could cause an exception during
1515
startup in rare circumstances (:iss:`2896`)
1616

17-
- Adjust cell height automatically for buggy fonts that draw brackets outside the bounding box
18-
1917
- Fix image leaving behind a black rectangle when switch away and back to
2018
alternate screen (:iss:`2901`)
2119

kitty/core_text.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@
336336
*strikethrough_thickness = *underline_thickness;
337337
// float line_height = MAX(1, floor(self->ascent + self->descent + MAX(0, self->leading) + 0.5));
338338
// Let CoreText's layout engine calculate the line height. Slower, but hopefully more accurate.
339-
#define W "A{Q](WMH_gyl "
339+
#define W "AQWMH_gyl "
340340
CFStringRef ts = CFSTR(W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W W);
341341
#undef W
342342
CFMutableAttributedStringRef test_string = CFAttributedStringCreateMutable(kCFAllocatorDefault, CFStringGetLength(ts));

kitty/freetype.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,11 @@ static inline unsigned int
125125
calc_cell_height(Face *self, bool for_metrics) {
126126
unsigned int ans = font_units_to_pixels_y(self, self->height);
127127
if (for_metrics) {
128-
static const char chars[] = "_{[(";
129-
for (unsigned i = 0; i < arraysz(chars) - 1; i++) {
130-
unsigned int char_height = get_height_for_char(self, chars[i]);
131-
if (char_height > ans) {
132-
if (global_state.debug_font_fallback) printf(
133-
"Increasing cell height by %u pixels to work around buggy font that renders '%c' outside the bounding box\n", char_height - ans, chars[i]);
134-
ans = char_height;
135-
}
128+
unsigned int underscore_height = get_height_for_char(self, '_');
129+
if (underscore_height > ans) {
130+
if (global_state.debug_font_fallback) printf(
131+
"Increasing cell height by %u pixels to work around buggy font that renders underscore outside the bounding box\n", underscore_height - ans);
132+
return underscore_height;
136133
}
137134
}
138135
return ans;

0 commit comments

Comments
 (0)