Fix segmentation fault in Font loading
This commit is contained in:
parent
da91e92124
commit
2ff8debe8c
@ -248,11 +248,13 @@ CharacterBlock Font::generateCharacterBlock(unsigned int block) {
|
||||
int col = c % KEK_FONT_BITMAP_WIDTH_BLOCKS;
|
||||
int row = c / KEK_FONT_BITMAP_WIDTH_BLOCKS;
|
||||
|
||||
for(unsigned int r = 0; r < face->glyph->bitmap.rows; r++) {
|
||||
memcpy(
|
||||
textureBytes + row * KEK_FONT_RESOLUTION * KEK_FONT_BITMAP_WIDTH + col * KEK_FONT_RESOLUTION + r * KEK_FONT_BITMAP_WIDTH,
|
||||
// TODO: handle wide characters more gracefully
|
||||
for(unsigned int r = 0; r < std::min(64u, 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;
|
||||
memcpy(textureBytes + offset,
|
||||
face->glyph->bitmap.buffer + r * face->glyph->bitmap.width,
|
||||
face->glyph->bitmap.width);
|
||||
len);
|
||||
}
|
||||
|
||||
Character ch;
|
||||
|
Loading…
Reference in New Issue
Block a user