Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Loading of .fon files.

This thread is locked; no one can reply to it. rss feed Print
Loading of .fon files.
Desmond Taylor
Member #11,943
May 2010
avatar

I am trying to load MS Sans Serif but it seems to not render correctly.

Here is the code used.

#SelectExpand
1#include <allegro5/allegro.h> 2#include <allegro5/allegro_font.h> 3#include <allegro5/allegro_ttf.h> 4 5int main( int argc, char** argv ) 6{ 7 al_init(); 8 al_init_font_addon(); 9 al_init_ttf_addon(); 10 11 ALLEGRO_DISPLAY* display = al_create_display( 640, 480 ); 12 13 ALLEGRO_FONT* font = al_load_font( "sserife.fon", 12, 0 ); 14 15 al_draw_text( font, al_map_rgb( 255, 255, 255 ), 10, 10, 0, "This is a test" ); 16 17 al_flip_display(); 18 19 al_rest( 2 ); 20 21 al_destroy_font( font ); 22 23 al_shutdown_font_addon(); 24 al_shutdown_ttf_addon(); 25 26 al_destroy_display( display ); 27 28 return 0; 29}

I have also attached the executable.

Does anyone know what this happens?

Edit: I've fixed it using ALLEGRO_TTF_MONOCHROME in the al_load_font function :D

Edit 2: Now I cannot change the size :/

weapon_S
Member #7,859
October 2006
avatar

Desmond Taylor
Member #11,943
May 2010
avatar

It's a windows font file. It loads but the size will not change it's loading really small. Readable but I need it bigger. I really don't want to use a similar font but will use Verdana or Arial if needed.

gnolam
Member #2,030
March 2002
avatar

It's a windows font file.

Windows 3.1 font. I believe it's a bitmap font format. :P

--
Move to the Democratic People's Republic of Vivendi Universal (formerly known as Sweden) - officially democracy- and privacy-free since 2008-06-18!

torhu
Member #2,727
September 2002
avatar

You could try loading the TTF version instead, micross.ttf.

Desmond Taylor
Member #11,943
May 2010
avatar

;D, I didn't know there was a ttf version. Going to look for it now and report back to you.

Edit: Works perfectly thanks :D

torhu
Member #2,727
September 2002
avatar

Go to: