Re: [AD] [patch] is_trans_font()

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


Daniel Schlyder wrote:

make_trans_font() triggers an assertion when passed a font that already uses the trans vtable. This becomes a problem when I want to keep the Allegro font in memory after creating the AllegroGL copy so I can restore the latter faster after texture memory has been lost. Of course, I can use a variable to keep track of whether make_trans_font() has been called on the font, but that's a bit ugly, isn't it? I'd prefer either to have is_trans_font() or patch make_trans_font() to do nothing if the font is already using the trans vtable. I suppose the latter is the way to go since it only introduces one new API function. Then again, it seems natural to add is_trans_font() to complement the existing is_mono_font, is_color_font and is_compatible_font functions.

What do we do with is_color_font()? Currently it returns TRUE for color and trans fonts. Is that still OK? Afterall, trans fonts are a kind of color fonts (from user view) and differ very slightly in internals. There are many occurrences in AGL code where a ugly:

#if GET_ALLEGRO_VERSION() >= MAKE_VER(4, 2, 1)
else if (f->vtable == font_vtable_color || f->vtable == font_vtable_trans)
#else
    else if (f->vtable == font_vtable_color)
#endif

can be replaced with a simple:

    else if (is_color_font(f))

I'm looking forward to make a patch for this if is_color_font() doesn't change. I have nothing against is_trans_font() in that case. And font_has_alpha() can be very handy.


--
Milan Mimica
http://sparklet.sf.net




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/