Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Font Dealing

This thread is locked; no one can reply to it. rss feed Print
Font Dealing
hossein
Member #7,312
June 2006

hi professional friends!
i have faced a problem which i cant set size of my font in allegro programming.
nor i havent property to justify text as horizontal or vertical ....
generally there are a lot of problem working with text so...
waiting for your helpful response..
bye.

miran
Member #2,407
June 2002

What's the problem exactly?

Quote:

i have faced a problem which i cant set size of my font in allegro programming.

Plain Allegro supports only fixed size bitmap fonts. You can only change the size of those fonts in your bitmap editor. If you want to use TTF, then use a TTF addon library, such as AllegroFont or GlyphKeeper.

Quote:

nor i havent property to justify text as horizontal or vertical ....

Text print functions in allegro take x and y coordinate parameters. Set them as you wish. There are also special functions for printing text right aligned and centre aligned.

Read the manual and check the examples...

--
sig used to be here

Tobias Dammers
Member #2,604
August 2002
avatar

...and for y alignment, subtract the full (bottom-aligned) or half (centered) height of the font from the y coordinate you pass to the text output function, like so:

textprintf_ex(bmp, font, x, y - text_height(font), makecol(255, 255, 255), -1, "Hello!");

Note that the bitmap fonts supported by allegro do not contain any baseline information, so you cannot easily align fonts along their baseline.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Go to: