Menu

#380 Glitch while printing using video font

5.1
open
nobody
1
2015-01-31
2013-01-09
Alex Porto
No

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:
//---------------------------------------------------------------------------

include <string></string>

include <allegro5 allegro.h=""></allegro5>

include <allegro5 allegro_image.h=""></allegro5>

include <allegro5 allegro_opengl.h=""></allegro5>

include <allegro5 allegro_font.h=""></allegro5>

include <allegro5 allegro_ttf.h=""></allegro5>

include <allegro5 allegro_primitives.h=""></allegro5>

//---------------------------------------------------------------------------

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;

}

Related

Bugs: #380

Discussion

  • Peter Wang

    Peter Wang - 2013-01-31

    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.

     
  • Alex Porto

    Alex Porto - 2013-02-16

    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:

    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.


    [bugs:#380] Glitch while printing using video font

    Status: open
    Labels: al_draw_text
    Created: Wed Jan 09, 2013 10:54 AM UTC by Alex Porto
    Last Updated: Wed Jan 09, 2013 10:54 AM UTC
    Owner: nobody

    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:
    //---------------------------------------------------------------------------

    include

    include allegro.h>

    include allegro_image.h>

    include allegro_opengl.h>

    include allegro_font.h>

    include allegro_ttf.h>

    include allegro_primitives.h>

    //---------------------------------------------------------------------------

    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;

    }


    Sent from sourceforge.net because you indicated interest in
    https://sourceforge.net/p/alleg/bugs/380/

    To unsubscribe from further messages, please visit
    https://sourceforge.net/auth/prefs/

     

    Related

    Bugs: #380


Log in to post a comment.

MongoDB Logo MongoDB