Fix divide by zero displaying characters with an unknown column width
The result of BLI_wcwidth wasn't checked before using the result to calculate a width, this cause a negative return value to be multiplied by the font size which divided by zero.
This commit is contained in:
@@ -1053,7 +1053,10 @@ static FT_GlyphSlot blf_glyph_render(FontBLF *settings_font,
|
||||
}
|
||||
|
||||
if ((settings_font->flags & BLF_MONOSPACED) && (settings_font != glyph_font)) {
|
||||
blf_glyph_transform_monospace(glyph, BLI_wcwidth(char32_t(charcode)) * fixed_width);
|
||||
const int col = BLI_wcwidth(char32_t(charcode));
|
||||
if (col > 0) {
|
||||
blf_glyph_transform_monospace(glyph, col * fixed_width);
|
||||
}
|
||||
}
|
||||
|
||||
/* Fallback glyph transforms, but only if required and not yet done. */
|
||||
|
||||
Reference in New Issue
Block a user