Avoid having no `pixel_width`

On small scales `pixel_width` could become `0`. This caused the creation 
of buffers of size `0` with consequent overflows.
This commit is contained in:
Guldoman 2021-08-28 06:02:12 +02:00 committed by Francesco
parent c7d044f178
commit 07c23fbf17
1 changed files with 1 additions and 1 deletions

View File

@ -245,7 +245,7 @@ FR_Bitmap *FR_Bake_Font_Bitmap(FR_Renderer *font_renderer, int font_height,
}
const int glyph_avg_width = glyph_count > 0 ? x_size_sum / (glyph_count * subpixel_scale) : font_height;
const int pixels_width = glyph_avg_width * 28;
const int pixels_width = glyph_avg_width > 0 ? glyph_avg_width * 28 : 28;
// dry run simulating pixel position to estimate required image's height
int x = x_start, y = 0, y_bottom = y;