From f652106ec38b05ff6b10db85e7cc4957b83b901f Mon Sep 17 00:00:00 2001 From: Brett Bergstrom Date: Tue, 22 Sep 2026 14:23:02 -0500 Subject: [PATCH] fix ranges overwriting duplicates, resulting in non-consecutive characters in the cache string breaking everything --- allegro_schrift.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/allegro_schrift.c b/allegro_schrift.c index 1f85c39..5409670 100644 --- a/allegro_schrift.c +++ b/allegro_schrift.c @@ -204,15 +204,15 @@ ALLEGRO_FONT *al_load_ttf_font_f(ALLEGRO_FILE *file, al_save_bitmap("schrift_test.png", gtex); // convert texture to bitmap font - const unsigned int ranges_size = i*2; - int ranges[ranges_size]; + const unsigned int ranges_size = i; + int ranges[ranges_size*2]; i = 0; while (i < ranges_size) { - ranges[i] = (unsigned char)cache_text_str[i]; - ranges[i+1] = (unsigned char)cache_text_str[i]; + ranges[i*2] = (unsigned char)cache_text_str[i]; + ranges[i*2+1] = (unsigned char)cache_text_str[i]; i++; } - f = al_grab_font_from_bitmap(gtex, ranges_size/2, ranges); + f = al_grab_font_from_bitmap(gtex, ranges_size, ranges); ALLEGRO_DEBUG("Font %s loaded.\n", filename); CLEANUP;