fix ranges overwriting duplicates, resulting in non-consecutive characters in the cache string breaking everything
This commit is contained in:
@@ -204,15 +204,15 @@ ALLEGRO_FONT *al_load_ttf_font_f(ALLEGRO_FILE *file,
|
|||||||
al_save_bitmap("schrift_test.png", gtex);
|
al_save_bitmap("schrift_test.png", gtex);
|
||||||
|
|
||||||
// convert texture to bitmap font
|
// convert texture to bitmap font
|
||||||
const unsigned int ranges_size = i*2;
|
const unsigned int ranges_size = i;
|
||||||
int ranges[ranges_size];
|
int ranges[ranges_size*2];
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < ranges_size) {
|
while (i < ranges_size) {
|
||||||
ranges[i] = (unsigned char)cache_text_str[i];
|
ranges[i*2] = (unsigned char)cache_text_str[i];
|
||||||
ranges[i+1] = (unsigned char)cache_text_str[i];
|
ranges[i*2+1] = (unsigned char)cache_text_str[i];
|
||||||
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);
|
ALLEGRO_DEBUG("Font %s loaded.\n", filename);
|
||||||
|
|
||||||
CLEANUP;
|
CLEANUP;
|
||||||
|
|||||||
Reference in New Issue
Block a user