|
Loading fonts |
Sylvarant
Member #7,886
October 2006
|
when you want to load a font in Allegro where does he look for the file?
|
miran
Member #2,407
June 2002
|
Quote: when you want to load a font in Allegro where does he look for the file? Wherever you tell it to look. Quote: And what's the difference between registering and loading a font? What do you mean by registering a font? -- |
TeamTerradactyl
Member #7,733
September 2006
|
I don't know about registering fonts or anything, but here's something we've used in a few games that seems to work:
Here, the actual font that you'll use is the bitmap font6x6. Then you would simply use a function like this to actually write the letters onto the screen somewhere:
You call this with a simple writeFont(double_buffer, font6x6, x, y, some_string); It's ugly, I know, but this is ONE way of creating your own custom font. You could take the same data, store it into a DAT file and save a lot more space, but this is just one example. -TeamTerradactyl
|
Sylvarant
Member #7,886
October 2006
|
"What do you mean by registering a font?" Another question were can I find fonts of the correct type?
|
Evert
Member #794
November 2000
|
Quote: Here, the actual font that you'll use is the bitmap font6x6. Then you would simply use a function like this to actually write the letters onto the screen somewhere: Bloody hell. Next time, check the manual before you try to reinvent the wheel. Quote: And what's the difference between registering and loading a font? What the manual says it is: Quote: FONT *load_font(const char *filename, RGB *pal, void *param); Loads a font from a file.
Quote: void register_font_file_type(const char *ext, FONT *(*load)(const char *filename, RGB *pal, void *param)); Informs the load_font() functions of a new file type, providing a routine to read fonts in this format. After registering the FONT type, you can use Allegro's normal load_font() function to load it. |
|