Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Borghetti <bdiego@gmail.com>2009-04-07 12:42:28 +0400
committerDiego Borghetti <bdiego@gmail.com>2009-04-07 12:42:28 +0400
commit59190778a8606079644b91992a3c90b7723e0adf (patch)
tree5c85797ca089fb34bab6ae4edc5f778538636692 /source/blender/blenfont/intern/blf.c
parent44877d0add0101e92bdfc48d065df83a7b541063 (diff)
New Bitmap draw mode for Freetype2 fonts.
The library can load any font supported by the Freetype2 library or used the internal bitmap font. With both types it's possible draw the text as texture or bitmap, and using texture it's possible rotate, scale and clipping text. Still have things to fix/add, but I think it's ready to move-on and start droping the old api, most of (if it's not all) the editors/interface/text.c will be remove, but some things still has to be define, like: * Where is store the fonts ? (default font, panel font, filesel font, etc) I mean, every space have own fonts ? or we keep it on the context ? It's not a really problem from the blenfont side, because every font have reference number, so it's load only the first time. * What we do about gettext ? Keep the old system that call gettext inside the blenfont or replace it for _() in the Blender source ? Also things like pupmen has to be take care, if we want translate the menu. Ok, time to sleep, back tomorrow to start moving the things :)
Diffstat (limited to 'source/blender/blenfont/intern/blf.c')
-rw-r--r--source/blender/blenfont/intern/blf.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index b04e0efe94a..686e54e4986 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -284,14 +284,25 @@ void BLF_draw(char *str)
{
FontBLF *font;
+ /*
+ * The pixmap alignment hack is handle
+ * in BLF_position (old ui_rasterpos_safe).
+ */
+
font= global_font[global_font_cur];
if (font && font->draw) {
if (font->mode == BLF_MODE_BITMAP) {
- /* the pixmap alignment is handle
- * in BLF_position (old ui_rasterpos_safe).
- */
+ glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT);
+ glPushAttrib(GL_ENABLE_BIT);
+ glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE);
+ glPixelStorei( GL_UNPACK_ALIGNMENT, 1);
+ glDisable(GL_BLEND);
glRasterPos3f(font->pos[0], font->pos[1], font->pos[2]);
+
(*font->draw)(font, str);
+
+ glPopAttrib();
+ glPopClientAttrib();
}
else {
glEnable(GL_BLEND);