Adjust cell height automatically for buggy fonts that draw brackets outside the bounding box
See https://github.com/cormullion/juliamono/issues/14
This commit is contained in:
parent
dad355b932
commit
5555a66638
@ -14,6 +14,8 @@ To update |kitty|, :doc:`follow the instructions <binary>`.
|
|||||||
- Fix a regression in the previous release that could cause an exception during
|
- Fix a regression in the previous release that could cause an exception during
|
||||||
startup in rare circumstances (:iss:`2896`)
|
startup in rare circumstances (:iss:`2896`)
|
||||||
|
|
||||||
|
- Adjust cell height automatically for buggy fonts that draw brackets outside the bounding box
|
||||||
|
|
||||||
|
|
||||||
0.18.2 [2020-07-28]
|
0.18.2 [2020-07-28]
|
||||||
--------------------
|
--------------------
|
||||||
|
|||||||
@ -336,7 +336,7 @@ cell_metrics(PyObject *s, unsigned int* cell_width, unsigned int* cell_height, u
|
|||||||
*strikethrough_thickness = *underline_thickness;
|
*strikethrough_thickness = *underline_thickness;
|
||||||
// float line_height = MAX(1, floor(self->ascent + self->descent + MAX(0, self->leading) + 0.5));
|
// 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.
|
// Let CoreText's layout engine calculate the line height. Slower, but hopefully more accurate.
|
||||||
#define W "AQWMH_gyl "
|
#define W "A{Q](WMH_gyl "
|
||||||
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);
|
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);
|
||||||
#undef W
|
#undef W
|
||||||
CFMutableAttributedStringRef test_string = CFAttributedStringCreateMutable(kCFAllocatorDefault, CFStringGetLength(ts));
|
CFMutableAttributedStringRef test_string = CFAttributedStringCreateMutable(kCFAllocatorDefault, CFStringGetLength(ts));
|
||||||
|
|||||||
@ -125,11 +125,14 @@ static inline unsigned int
|
|||||||
calc_cell_height(Face *self, bool for_metrics) {
|
calc_cell_height(Face *self, bool for_metrics) {
|
||||||
unsigned int ans = font_units_to_pixels_y(self, self->height);
|
unsigned int ans = font_units_to_pixels_y(self, self->height);
|
||||||
if (for_metrics) {
|
if (for_metrics) {
|
||||||
unsigned int underscore_height = get_height_for_char(self, '_');
|
static const char chars[] = "_{[(";
|
||||||
if (underscore_height > ans) {
|
for (unsigned i = 0; i < arraysz(chars) - 1; i++) {
|
||||||
|
unsigned int char_height = get_height_for_char(self, chars[i]);
|
||||||
|
if (char_height > ans) {
|
||||||
if (global_state.debug_font_fallback) printf(
|
if (global_state.debug_font_fallback) printf(
|
||||||
"Increasing cell height by %u pixels to work around buggy font that renders underscore outside the bounding box\n", underscore_height - ans);
|
"Increasing cell height by %u pixels to work around buggy font that renders '%c' outside the bounding box\n", char_height - ans, chars[i]);
|
||||||
return underscore_height;
|
ans = char_height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ans;
|
return ans;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user