Do not use nullptr and add check
This commit is contained in:
parent
a23986f171
commit
ea8a8770ea
|
@ -221,7 +221,7 @@ FR_Bitmap *FR_Bake_Font_Bitmap(FR_Renderer *font_renderer, int font_height,
|
||||||
i = i + 1;
|
i = i + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (glyph_count == 0) return nullptr;
|
if (glyph_count == 0) return NULL;
|
||||||
const int pixels_width = (x_size_sum / glyph_count) * 16;
|
const int pixels_width = (x_size_sum / glyph_count) * 16;
|
||||||
|
|
||||||
// dry run simulating pixel position to estimate required image's height
|
// dry run simulating pixel position to estimate required image's height
|
||||||
|
|
|
@ -107,6 +107,7 @@ static GlyphSet* load_glyphset(RenFont *font, int idx) {
|
||||||
GlyphSet *set = check_alloc(calloc(1, sizeof(GlyphSet)));
|
GlyphSet *set = check_alloc(calloc(1, sizeof(GlyphSet)));
|
||||||
|
|
||||||
set->image = FR_Bake_Font_Bitmap(font->renderer, font->height, idx << 8, 256, set->glyphs);
|
set->image = FR_Bake_Font_Bitmap(font->renderer, font->height, idx << 8, 256, set->glyphs);
|
||||||
|
check_alloc(set->image);
|
||||||
|
|
||||||
/* adjust glyph's xadvance */
|
/* adjust glyph's xadvance */
|
||||||
for (int i = 0; i < 256; i++) {
|
for (int i = 0; i < 256; i++) {
|
||||||
|
|
Loading…
Reference in New Issue