CoreText: Ensure cell_width and cell_height are never zero

This commit is contained in:
Kovid Goyal 2017-12-13 09:35:50 +05:30
parent 77f0328f4f
commit d25c0d42bc
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -244,8 +244,9 @@ cell_metrics(PyObject *s, unsigned int* cell_width, unsigned int* cell_height, u
if (w > width) width = w; if (w > width) width = w;
} }
} }
*cell_width = width; *cell_width = MAX(1, width);
*cell_height = (unsigned int)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));
*cell_height = (unsigned int)line_height;
*underline_position = (unsigned int)self->underline_position; *underline_position = (unsigned int)self->underline_position;
*underline_thickness = (unsigned int)self->underline_thickness; *underline_thickness = (unsigned int)self->underline_thickness;
*baseline = (unsigned int)self->ascent; *baseline = (unsigned int)self->ascent;