[AD] New FONT structure - any objections?

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hi,

Would anybody object to having a new FONT structure, along the line of:

FONT_VTABLE
  int text_length(void* data, const char* text);
  void text_out(void* data, int height, const char* text, BITMAP* bmp,
                int x, y, fg, bg);
  void destroy(void* data);

FONT
  void* data;
  int height;
  FONT_VTABLE* vtable;

This system requires a minor rewrite of some of the library itself, just
to understand the new format, and also of some of the utilities
(grabber, etc).

The advantages are:

- We can now support any arbitrary font through Allegro's textout() 
  routines; for instance, we can interface with FreeType to allow
  loading of .ttf files.

- Font output is probably quicker, since we have one call to the FONT 
  vtable entry text_out(), followed by (probably) one call to an entry
  in the BITMAP vtable per character, as opposed to one call to
  render_glyph() per character, followed by one call to an entry in the
  BITMAP vtable per character.

- The code is simpler, FONT objects are smaller.

- We can now do things we couldn't do before, like rendering text
  with a shadow. Previously, because it was output on a char-by-char
  basis, the shadow of one char could overwrite the previously drawn
  char, etc.

- As long as the data remains in the same format, we can replace the
  vtable entry in FONT to render our font in a different fashion.

The disadvantages are:

- Any addons which directly interfaced with FONT will have to be
  rewritten.

  However, this also presents an advantage, in that their interfaces
  with Allegro will probably be simpler; they can design their own
  format for storing data, and they also get passed a whole string to
  render at once, rather than character by character.

  Also, this new interface would be more `future-proof', since it is
  more flexible than the current one.

I am happy to code it, which would probably take a couple of days, but
somebody would have to help me with the `dat2s' utility.

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/