Fix possible segfault in Font
This commit is contained in:
parent
dec6cdec3f
commit
656603f439
@ -249,9 +249,9 @@ CharacterBlock Font::generateCharacterBlock(unsigned int block) {
|
||||
int row = c / KEK_FONT_BITMAP_WIDTH_BLOCKS;
|
||||
|
||||
// TODO: handle wide characters more gracefully
|
||||
for(unsigned int r = 0; r < std::min(64u, face->glyph->bitmap.rows); r++) {
|
||||
for(unsigned int r = 0; r < std::min((unsigned int) KEK_FONT_RESOLUTION, face->glyph->bitmap.rows); r++) {
|
||||
size_t offset = row * KEK_FONT_RESOLUTION * KEK_FONT_BITMAP_WIDTH + col * KEK_FONT_RESOLUTION + r * KEK_FONT_BITMAP_WIDTH;
|
||||
size_t len = face->glyph->bitmap.width;
|
||||
size_t len = glm::min((unsigned int) KEK_FONT_RESOLUTION, face->glyph->bitmap.width);
|
||||
memcpy(textureBytes + offset,
|
||||
face->glyph->bitmap.buffer + r * face->glyph->bitmap.width,
|
||||
len);
|
||||
|
Loading…
Reference in New Issue
Block a user