font: never set glyph->cols to something that is less than 0

This commit is contained in:
Daniel Eklöf 2019-11-30 00:15:54 +01:00
parent 88c1a8939f
commit 8274e3e034
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

5
font.c
View file

@ -648,10 +648,13 @@ glyph_for_wchar(const struct font *font, wchar_t wc, struct glyph *glyph)
pixman_image_set_filter(pix, PIXMAN_FILTER_BEST, NULL, 0);
}
int cols = wcwidth(wc);
if (cols < 0)
cols = 0;
*glyph = (struct glyph){
.wc = wc,
.cols = wcwidth(wc),
.cols = cols,
.pix = pix,
.x = font->face->glyph->bitmap_left * font->pixel_size_fixup,
.y = font->face->glyph->bitmap_top * font->pixel_size_fixup,