[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
Attached is a patch that adds the often-requested load_font function. The
patch defines the following functions:
void register_font_file_type (AL_CONST char *ext, FONT *(*load)(AL_CONST
char *filename, RGB *pal, void *param))
FONT *load_font (AL_CONST char *filename, RGB *pal, void *param)
These work similar to the normal register_bitmap_file_type/load_bitmap
functions. I have added an extra parameter param to the load_font routine
in case a specific loader wants to do anything with this. Only the dat
loader actually does anything with this currently.
FONT *load_dat_font(AL_CONST char *filename, RGB *pal, void *param))
FONT *load_bios_font(AL_CONST char *filename, RGB *pal, void *param))
FONT *load_grx_font(AL_CONST char *filename, RGB *pal, void *param))
FONT *load_grx_or_bios_font(AL_CONST char *filename, RGB *pal,void *param))
FONT *load_bitmap_font(AL_CONST char *fname, RGB *pal, void *param))
These load fonts from specific types of files. Most of the code was
directly ripped from the dat/grabber plugin. The load_bitmap_font() code
is special in that load_font() calls this to load a font if it doesn't
know the font type. It calls load_bitmap() internally, so it will know how
to load a font from any registered bitmap type without having to be
installed for it.
With this code pulled from the datafile plugin into Allegro, the code from
the plugins can be (and should be) significantly simplified. I haven't
done this yet, nor written documentation for this.
Tested somewhat in Linux.
Evert