ref: fcf1e9d0c4850574c14f009f5cfee2f7ac4aa16b
parent: 80df145d3fd3803331cb2870193bf75fcb11a457
author: Clownacy <Clownacy@users.noreply.github.com>
date: Mon Sep 7 23:14:53 EDT 2020
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.
--- a/src/Font.cpp
+++ b/src/Font.cpp
@@ -1092,14 +1092,14 @@
// 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;
}