Fonts for menu.
Eman_321

Hi, been a while folks.
So, I would like to get some cool fonts, the inbuilt one is tiny and not much fun.

Is there a way to download some .pcx fonts?

I don't know how to make one :(

Thanks for help.

Billybob

TTF2PCX

That should let you download fonts in the normal TTF format and make PCX files out of it.

Eman_321

Thanks a lot man.
I will try it now! :)

Audric

If you want to draw your own:
http://www.allegro.cc/depot/AllegroFontEditor/
Has some sample fonts already, and can convert/import from Windows fonts - however you can't expect to convert a TrueType vectorial font to 16x16 monochrome and get clean result.

If you want to use existing bitmap fonts, such as some from:
http://cgi.algonet.se/htbin/cgiwrap?user=guld1&script=fonts.pl
http://www.zone38.net/font/bmpfont.html
You'll need to convert them - by cut-n-pasting the letters into a new bitmap like the Allegro fonts.

Eman_321

Thanks Audric, I will try them out as well, and see which works best.

EDIT:
the converter works well, but the Bitmap font looks attractive to the eye.

How does one cut and paste it to allegro font?
Many thanks!

Matthew Leverton

Use load_font() on the exported bitmap.

Eman_321

Hi Matthew, thanks for replying.
I don't quite get what you mean. load_font() loads .pcx file not .bmp?

I tried it anyways and it didn't work. Can you explain what you mean a bit clearer? Thanks

Thomas Fjellstrom
Eman_321 said:

I don't quite get what you mean. load_font() loads .pcx file not .bmp?

It doesn't matter. Can be any format allegro supports through its built in image loaders, or through addons that extend load_bitmap to support things like png.

Eman_321

Then I don't understand why I am getting a seg fault.

    FONT* f= load_font("furyfurries.bmp", NULL,NULL) ;

is what I have down. But it doesn't work.

Edgar Reynaldo

The image file that you load with load_font has to have a predefined format. See load_bitmap_font for details.

This is what a bitmap font looks like :
{"name":"603086","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/b\/7b3347e6b61ddbc2b05c03d2f7c4a965.png","w":296,"h":140,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/7\/b\/7b3347e6b61ddbc2b05c03d2f7c4a965"}603086

Eman_321

oh right. I will read about the load_bitmap_font() function thanks.

the link Audric posted before has some of those bitmap files, so will try it out.

Thank you

EDIT:
yeah it works, perfectly with your bitmap file. But when i use the one at this link,
http://www.algonet.se/~guld1/fonts/002.gif
converted to bmp it crashes

Thomas Fjellstrom

That gif is not the right colors. or format. The orange and pink colors are very important.

Eman_321

I tried making one in photoshop, it didn't work. Do I have to have all the letters in it? It is time consuming.

I can't get the bitmap generator to have orange background and letters on pink background.

Anything I can try? Thanks

Edgar Reynaldo
Eman_321 said:

I can't get the bitmap generator to have orange background and letters on pink background.

The space between letters is supposed to be bright yellow (r,g,b)=(255,255,0) and the background for each letter is supposed to be magic pink(255,0,255). Save the file as a 24 bit bitmap. Make sure each row of letters lines up vertically - they all have to have the same height too. I don't think you have to have every character, but it should be at least 96 characters worth (of potentially empty magic pink rectangles).

Eman_321

96 characters!?? wow . OK I'll give it another go. Thanks

Edgar Reynaldo

If you still can't get it to work, post the image that you are using as an attachment.

Tobias Dammers

Two side notes:

  • Fonts are subject to copyright, so if you run TTF2PCX over a font from your Windows install, and distribute it with your game, you may be violating that font's copyright. Best use a font you know to be free.

  • If you use Allegro 5 with the TTF add-on enabled, you can save yourself the hassle and load TTF fonts (and a truckload of other formats) directly.

Eman_321

Well it didn't crash, but I am not seeing anything on the screen at all! :'(
@Tobias thanks for the advice, I am just using this for school project, and will not be distributing it.
http://www.allegro.cc/files/attachment/603088

Edgar Reynaldo

You're probably not seeing anything because you don't have the letters in the correct order. Take another look at the bitmap font I showed you earlier. load_bitmap_font reads from left to right, top to bottom. You have capital A starting in the second position when it should start in the 34th position. Also, you might want to make your magic pink rectangles slightly taller so that no letters fall off the edge. If they even load that way, they will likely be cut off so you only have a partial letter when you print it on the screen. Also, the top of each row has to have the same y value, as well as the bottom of each row. And the height of each row has to be the same.

If you wait a little bit, I'll whip up a font template maker.

Here it is :
FontMaker.zip : source code and win32 static exe (uses Allegro 4)

From the command line, type FontMaker.exe --help or just FontMaker.exe to see the usage information. FontMaker will create a new font template with or without text, with characters any size 4x4 or greater and as .bmp, .pcx, or .tga files.

Eman_321

Sorry for the long reply, I'm a little sick :'(
Thanks for the software and the advice. I will use the bitmap font and the software as a template.
I hope I am successful this time.
Thanks man.

Edgar Reynaldo

Good luck. Let us know how it goes.

Eman_321

Wow, yeah that FontMaker software is handy. Is it possible to change the default font?
I will try with PS (I am terrible using that software).. and see what happens

Edgar Reynaldo
Eman_321 said:

Is it possible to change the default font?

Not at this time, no. I suppose I could add an option to load a bitmap font from a file and use that as the font, but it would only be good for resizing a font, although that might be handy. You could do the same thing within your program though, by calling CreateFontBitmap and specifying a different font, and then saving the resulting bitmap.

Eman_321

oh my G! you developed FontMaker ?
Wow, very cool!

CreateFontBitmap() doesn't appear to be an allegro function..so I am not sure what you mean..

Edgar Reynaldo

Look at the source code that came with FontMaker, CreateFontBitmap is a function I wrote. Feel free to copy it out and use it in your projects. MIT license, if any.

Thread #606083. Printed from Allegro.cc