[AD] [patch] is_trans_font() |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
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?
Index: include/allegro/font.h
===================================================================
--- include/allegro/font.h (revision 7542)
+++ include/allegro/font.h (working copy)
@@ -43,6 +43,7 @@
AL_FUNC(void, make_trans_font, (FONT *f));
+AL_FUNC(int, is_trans_font, (FONT *f));
AL_FUNC(int, is_color_font, (FONT *f));
AL_FUNC(int, is_mono_font, (FONT *f));
AL_FUNC(int, is_compatible_font, (FONT *f1, FONT *f2));
Index: src/font.c
===================================================================
--- src/font.c (revision 7542)
+++ src/font.c (working copy)
@@ -1458,6 +1458,19 @@
+/* is_trans_font:
+ * Returns non-zero if the font passed is a bitmapped colour font using
+ * draw_trans_sprite to render glyphs.
+ */
+int is_trans_font(FONT *f)
+{
+ ASSERT(f);
+
+ return (f->vtable == font_vtable_trans);
+}
+
+
+
/* is_color_font:
* returns non-zero if the font passed is a bitmapped colour font
*/