I've experiencing problems to load a font on video memory. Whenever I try to print using it, the first character of the string is skiiped and any instance of the same character inside the string will also be skipped. Printing "012034" will print " 12 34".
If the font size is bigger than 50, other characters start vanishing too, but could not figure out a pattern, since printing several strings on screen may cause different results.
This happens when using any TTF font I have, even the Windows default ones
This bug doesn't appear if the font is loeaded on memory.
This is a code to replicate it on Allegro 5.0.8:
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
using namespace std;
//---------------------------------------------------------------------------
int main(int argc, char * argv[])
{
al_init();
al_install_keyboard();
al_init_image_addon();
al_init_primitives_addon();
al_init_font_addon();
al_init_ttf_addon();
al_set_new_display_flags(ALLEGRO_OPENGL);
ALLEGRO_DISPLAY * mainWindow= al_create_display(1200, 1000);
ALLEGRO_PATH *path = al_get_standard_path(ALLEGRO_RESOURCES_PATH);
string file = al_path_cstr(path, '/');
file = file + "arial.ttf";
ALLEGRO_FONT * font = al_load_font(file.c_str(), 50, 0);
al_set_target_bitmap(al_get_backbuffer(mainWindow));
al_draw_filled_rectangle(0, 0, 1200, 1000, al_map_rgb(0,0,0));
al_draw_text(font, al_map_rgb(255,0,0), 50, 50, 0, "0123045670890");
al_save_bitmap("d:\\teste.bmp", al_get_backbuffer(mainWindow));
al_flip_display();
al_rest(5.0);
return 0;
}
Unfortunately, like previous times, I wasn't able to reproduce this on two Windows machines (nvidia and intel graphics).
Can you try setting GL_EXT_framebuffer_object=0 or GL_ARB_texture_non_power_of_two=0 in allegro5.cfg (see the sample file)? Not sure it will do anything, but it's something to try.
Hello, Peter
Sorry for taking so long to answer, but I was looking for the
documentation about allegro5.cfg before editing it, or trying to find
setup.exe in allegro 5, but couldn't find any of them. I even
re-downloaded and re-built allegro 4 a 5, but it appears that
setup.exe is not part of allegro 5, only allegro 4.
But then I blindly followed your hints. And they worked. Thanks a lot! :-)
Alex
On Thu, Jan 31, 2013 at 9:10 AM, Peter Wang tjaden@users.sf.net wrote:
Related
Bugs: #380