mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-30 13:24:19 +00:00
Ensure underlines are rendered even for fonts with very poor metrics
Fixes #236
This commit is contained in:
parent
eed11361c5
commit
8d94285a5d
2 changed files with 3 additions and 1 deletions
|
|
@ -289,6 +289,8 @@ update_cell_metrics() {
|
|||
if (cell_height < 4) { PyErr_SetString(PyExc_ValueError, "line height too small after adjustment"); return NULL; }
|
||||
if (cell_height > 1000) { PyErr_SetString(PyExc_ValueError, "line height too large after adjustment"); return NULL; }
|
||||
underline_position = MIN(cell_height - 1, underline_position);
|
||||
// ensure there is at least a couple of pixels available to render styled underlines
|
||||
while (underline_position > baseline + 1 && cell_height - underline_position < 2) underline_position--;
|
||||
if (line_height_adjustment > 1) {
|
||||
baseline += MIN(cell_height - 1, (unsigned)line_height_adjustment / 2);
|
||||
underline_position += MIN(cell_height - 1, (unsigned)line_height_adjustment / 2);
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ def resize_fonts(new_sz):
|
|||
|
||||
def add_line(buf, cell_width, position, thickness, cell_height):
|
||||
y = position - thickness // 2
|
||||
while thickness > 0 and y > -1 and y < cell_height - 1:
|
||||
while thickness > 0 and y > -1 and y < cell_height:
|
||||
thickness -= 1
|
||||
ctypes.memset(ctypes.addressof(buf) + (cell_width * y), 255, cell_width)
|
||||
y += 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue