Ensure underline_position is viable

This commit is contained in:
Kovid Goyal 2017-11-05 10:34:30 +05:30
parent 9842a47f85
commit c8b7b49d56
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -135,6 +135,7 @@ def render_special(underline=0, strikethrough=False, missing=False):
s = set_font_family.state
cell_width, cell_height, baseline = s.cell_width, s.cell_height, s.baseline
underline_position, underline_thickness = s.underline_position, s.underline_thickness
underline_position = min(underline_position, cell_height - underline_thickness)
CharTexture = ctypes.c_ubyte * (cell_width * cell_height)
ans = CharTexture if missing else CharTexture()