Link glyph array from back to front
This way, glyphs are allocated from front to bacl, which makes the atlas much more pleasant to look at.
This commit is contained in:
parent
80df145d3f
commit
fcf1e9d0c4
1 changed files with 4 additions and 4 deletions
|
@ -1092,14 +1092,14 @@ FontObject* LoadFontFromData(const unsigned char *data, size_t data_size, unsign
|
|||
// Initialise the linked-list
|
||||
for (size_t i = 0; i < TOTAL_GLYPH_SLOTS; ++i)
|
||||
{
|
||||
if (i != 0)
|
||||
font_object->glyphs[i].next = &font_object->glyphs[i - 1];
|
||||
|
||||
font_object->glyphs[i].x = (i % font_object->atlas_row_length) * atlas_entry_width;
|
||||
font_object->glyphs[i].y = (i / font_object->atlas_row_length) * atlas_entry_height;
|
||||
|
||||
if (i != TOTAL_GLYPH_SLOTS - 1)
|
||||
font_object->glyphs[i].next = &font_object->glyphs[i + 1];
|
||||
}
|
||||
|
||||
font_object->glyph_list_head = font_object->glyphs;
|
||||
font_object->glyph_list_head = &font_object->glyphs[TOTAL_GLYPH_SLOTS - 1];
|
||||
|
||||
return font_object;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue