Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » How do I get a larger text size and different fonts?

This thread is locked; no one can reply to it. rss feed Print
How do I get a larger text size and different fonts?
blargmob
Member #8,356
February 2007
avatar

Howdy,

How do I get a larger text size and different fonts? I don't like the default font in allegro, so how do I load and/or make new fonts for allegro that I can use? And how do I make a font bigger?
???

---
"No amount of prayer would have produced the computers you use to spread your nonsense." Arthur Kalliokoski

Onewing
Member #6,152
August 2005
avatar

------------
Solo-Games.org | My Tech Blog: The Digital Helm

type568
Member #8,381
March 2007
avatar

I had such a Q too.. what i didn't get there is how to modify the sizes.. or it must be a lrage font itself? :S

Kikaru
Member #7,616
August 2006
avatar

It must be a large font itself. I have considered making something to handle scaling, though I don't know how well it would work...

blargmob
Member #8,356
February 2007
avatar

So how do I make a .fnt file?
???

---
"No amount of prayer would have produced the computers you use to spread your nonsense." Arthur Kalliokoski

Dustin Dettmer
Member #3,935
October 2003
avatar

Quote:

How do I get a larger text size and different fonts? I don't like the default font in allegro, so how do I load and/or make new fonts for allegro that I can use? And how do I make a font bigger?

Allegro is not a font library. If you want to manipulate fonts use a font library.

Matthew Leverton
Supreme Loser
January 1999
avatar

blargmob
Member #8,356
February 2007
avatar

Wait a minute...... I tried calling load_font() and it didn't work.....it said the function didn't exist....

---
"No amount of prayer would have produced the computers you use to spread your nonsense." Arthur Kalliokoski

Matthew Leverton
Supreme Loser
January 1999
avatar

Use version 4.2.1.

blargmob
Member #8,356
February 2007
avatar

Okay, I got 4.2.1 but now my compiler returns a warning that says that some functions are "deprecated". What does that meen?

---
"No amount of prayer would have produced the computers you use to spread your nonsense." Arthur Kalliokoski

BAF
Member #2,981
December 2002
avatar

You need to use textprintf_ex, textout_ex, etc now that the older ones are deprecated. It's just a warning, meaning that those functions aren't supposed to be used anymore and could be removed at anytime.

Matthew Leverton
Supreme Loser
January 1999
avatar

It means that they have been replaced with something better and might go away in the future (like in 1,000 years).

blargmob
Member #8,356
February 2007
avatar

Okay thanks.

---
"No amount of prayer would have produced the computers you use to spread your nonsense." Arthur Kalliokoski

Kirr
Member #5,060
September 2004
avatar

You can also try Glyph Keeper. It can load TTF fonts and render text or create Allegro FONTs from them. It can render angled, italic, bold, translucent, antialiased fonts, etc.. Full list of features is here. :)

--
"Go to the NW of Stonemarket Plaza to the Blue Glyph Keeper Library door and enter."
- Lunabean's Thief Deadly Shadows Walkthrough, day eight

James Stanley
Member #7,275
May 2006
avatar

You could also scale the font by code (I did this for the menu screen of my current game. Then I replaced the code generated one with a bitmap).

blargmob
Member #8,356
February 2007
avatar

I loaded a font with

FONT *myfont;
myfont = load_font("myfont.pcx",NULL,NULL);

What do I do next?

---
"No amount of prayer would have produced the computers you use to spread your nonsense." Arthur Kalliokoski

Onewing
Member #6,152
August 2005
avatar

Quote:

What do I do next?

Use it?

------------
Solo-Games.org | My Tech Blog: The Digital Helm

blargmob
Member #8,356
February 2007
avatar

I tried doing this

FONT *myfont;
myfont = load_font("myfont.pcx",NULL,NULL);

textout_ex(screen,myfont,"Stuff",0,0,makecol(255,255,255),-1);

but it didn't work... am I missing a step? (or 2)

---
"No amount of prayer would have produced the computers you use to spread your nonsense." Arthur Kalliokoski

Kitty Cat
Member #2,815
October 2002
avatar

Define 'didn't work'.

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

blargmob
Member #8,356
February 2007
avatar

When I launched the exe file it crashed in an instant. What's wrong?

---
"No amount of prayer would have produced the computers you use to spread your nonsense." Arthur Kalliokoski

Onewing
Member #6,152
August 2005
avatar

Quote:

What's wrong?

Let me guess...something.

------------
Solo-Games.org | My Tech Blog: The Digital Helm

Kitty Cat
Member #2,815
October 2002
avatar

Maybe trying to use a NULL pointer for the font. Did you check to make sure load_font actually succeeded?

--
"Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham

blargmob
Member #8,356
February 2007
avatar

I fixed. Ha ha. Stupid problem, I accidentely loaded the file with the wrong name.

---
"No amount of prayer would have produced the computers you use to spread your nonsense." Arthur Kalliokoski

Go to: