When omitting the end of the glyph interval in the text file load_txt_font causes a segmentation fault. Content of font.txt:
prop_font_orig.bmp 0x20
Code:
int main(void)
{
FONT *f;
if (allegro_init() != 0) return 1;
if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, 320, 200, 0, 0) != 0) return 1;
f = load_txt_font("font.txt", NULL , NULL);
return 0;
}
END_OF_MAIN()
Adding the end code 0xff in font.txt makes it load correctly and it also draws the glyphs in the entire interval correctly
Allegro 4.2.2
Ubuntu 7.04
Logged In: YES
user_id=32894
Originator: NO
According to http://www.liballeg.org/stabledocs/en//alleg017.html#load_txt_font you can't leave out the end glyph.
Logged In: YES
user_id=713645
Originator: YES
Strange. So what does
"the script:
...
dingbats.fnt 0x1000
would import ... the entire contents of dingbats.fnt starting at Unicode position 0x1000."
mean if it does not mean that you can omit the end glyph if you want to load the entire contents?
Logged In: YES
user_id=32894
Originator: NO
Ah, I see. So to fix it, it should just use as many characters as it can find after the given one.
Logged In: YES
user_id=713645
Originator: YES
Attached patch should fixes the crash, and also fixes that leaving out the end glyph crashes. Also fixes another missing check for NULL in the same loop, and replaces an _AL_FREE with destroy_font(), as well as adjusting bad indentation.
File Added: fonttxt.diff
Logged In: YES
user_id=1171214
Originator: NO
Thanks! Committed the patch to 4.3.10+ branch on SVN.