Make the calculation of the bound for underline_position more precise

Fixes #5308
This commit is contained in:
Kovid Goyal 2022-07-26 16:07:01 +05:30
parent 546cdbefae
commit 93b05bcd1e
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -314,7 +314,8 @@ def render_special(
dpi_x: float = 96.,
dpi_y: float = 96.,
) -> CBufType:
underline_position = min(underline_position, cell_height - underline_thickness)
udelta, uextra = divmod(underline_thickness, 2)
underline_position = min(underline_position, cell_height - udelta - uextra)
CharTexture = ctypes.c_ubyte * (cell_width * cell_height)
if missing: