Fix heuristic to find font atlas optimal width

This commit is contained in:
Francesco Abbate 2021-03-07 17:30:11 +01:00
parent baf5aebe1c
commit 6782533ad2
1 changed files with 2 additions and 1 deletions

View File

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