Re: [AD] [patch] is_trans_font()

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


Daniel Schlyder wrote:
I'd like to propose a new font function: is_trans_font().

Use case:

if (is_trans_font(my_font))
{
    ... allegro_gl_convert_allegro_font_ex(..., GL_RGBA);
}
else
{
    ... allegro_gl_convert_allegro_font_ex(..., GL_ALPHA8);
}

What do you think?

I think font_has_alpha() would be just enough. It is assumed that you had to determine the font type some way after load_font(). So the complete float loading & conversion code can look like:

FONT *fnt = load_font(...);
FONT *agl_fnt;

if (font_has_alpha(fnt))
{
	make_trans_font(fnt);
	agl_fnt = allegro_gl_convert_allegro_font_ex(..., GL_RGBA);
}
else
{
	agl_fnt = allegro_gl_convert_allegro_font_ex(..., GL_ALPHA8);
}


It would be the best if load_font could determine the font type itself and convert before returning, just like it does for monochrome and color fonts. Too bad that trans font would crash on textout_ex() if trans blender hasn't been set.


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




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