Re: [AD] Adding save/load font functions |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
In reply to Bob <ohannessian@xxxxxxxxxx>: >I think it would be a good idea to have save/load FONT functions in Allegro. >Although for most cases it'll default to load_datafile_object(), it would help >add-ons that use their own special font formats. Your reasoning is fair, but consider that to add load/save functions, we would need to add these to the font vtable (since fonts are loaded/saved in different ways): struct FONT_VTABLE { /* ... */ int (*save)(FONT*, const char*); FONT* (*load)(const char*); }; and then the implementation would be: int save_font(FONT* f, const char* fname) { return f->vtable->save(f, fname); } FONT* load_font(const char* name) { /* iterate through vtables till we find one which can load the font in question; requires registering vtables which can load with Allegro, which we currently don't bother with. */ } So why can't we just keep these in add-ons that support them? The two vtables that ship with Allegro (color and mono) don't need to support load/save, since we have the packfile functions, so only font add-ons will find load/save useful. I would suggest that there is nothing wrong with: int agl_save_font(FONT*, const char*); FONT* agl_load_font(const char*); (or using a PACKFILE pointer, or a pointer to RAM, or whatever). Bye for now, -- Laurence Withers, lwithers@xxxxxxxxxx http://www.lwithers.demon.co.uk/
Attachment:
signature.asc
Description: PGP signature
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |