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:
Diffstat (limited to 'source/blender/blenfont/intern/blf.c')
-rw-r--r--source/blender/blenfont/intern/blf.c121
1 files changed, 77 insertions, 44 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 9dad5a4bfa0..db88d84d0b5 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -102,7 +102,7 @@ void BLF_exit(void)
blf_font_exit();
}
-int blf_search(char *name)
+static int blf_search(char *name)
{
FontBLF *font;
int i;
@@ -321,6 +321,18 @@ void BLF_draw_default(float x, float y, float z, char *str)
}
}
+void BLF_default_rotation(float angle)
+{
+
+ if (global_font_default>=0) {
+ global_font[global_font_default]->angle= angle;
+ if(angle)
+ global_font[global_font_default]->flags |= BLF_ROTATION;
+ else
+ global_font[global_font_default]->flags &= ~BLF_ROTATION;
+ }
+}
+
void BLF_draw(char *str)
{
FontBLF *font;
@@ -329,40 +341,24 @@ void BLF_draw(char *str)
* The pixmap alignment hack is handle
* in BLF_position (old ui_rasterpos_safe).
*/
-
font= global_font[global_font_cur];
if (font) {
- if (font->mode == BLF_MODE_BITMAP) {
- 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]);
-
- blf_font_draw(font, str);
-
- glPopAttrib();
- glPopClientAttrib();
- }
- else {
- glEnable(GL_BLEND);
- glEnable(GL_TEXTURE_2D);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glEnable(GL_TEXTURE_2D);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- glPushMatrix();
- glTranslatef(font->pos[0], font->pos[1], font->pos[2]);
- glScalef(font->aspect, font->aspect, 1.0);
+ glPushMatrix();
+ glTranslatef(font->pos[0], font->pos[1], font->pos[2]);
+ glScalef(font->aspect, font->aspect, 1.0);
- if (font->flags & BLF_ROTATION)
- glRotatef(font->angle, 0.0f, 0.0f, 1.0f);
+ if (font->flags & BLF_ROTATION)
+ glRotatef(font->angle, 0.0f, 0.0f, 1.0f);
- blf_font_draw(font, str);
+ blf_font_draw(font, str);
- glPopMatrix();
- glDisable(GL_BLEND);
- glDisable(GL_TEXTURE_2D);
- }
+ glPopMatrix();
+ glDisable(GL_BLEND);
+ glDisable(GL_TEXTURE_2D);
}
}
@@ -375,6 +371,15 @@ void BLF_boundbox(char *str, rctf *box)
blf_font_boundbox(font, str, box);
}
+void BLF_width_and_height(char *str, float *width, float *height)
+{
+ FontBLF *font;
+
+ font= global_font[global_font_cur];
+ if (font)
+ blf_font_width_and_height(font, str, width, height);
+}
+
float BLF_width(char *str)
{
FontBLF *font;
@@ -385,6 +390,16 @@ float BLF_width(char *str)
return(0.0f);
}
+float BLF_fixed_width(void)
+{
+ FontBLF *font;
+
+ font= global_font[global_font_cur];
+ if (font)
+ return(blf_font_fixed_width(font));
+ return(0.0f);
+}
+
float BLF_width_default(char *str)
{
FontBLF *font;
@@ -483,45 +498,63 @@ void BLF_clipping(float xmin, float ymin, float xmax, float ymax)
}
}
-void BLF_mode(int mode)
+void BLF_shadow(int level, float r, float g, float b, float a)
{
FontBLF *font;
font= global_font[global_font_cur];
- if (font)
- font->mode= mode;
+ if (font) {
+ font->shadow= level;
+ font->shadow_col[0]= r;
+ font->shadow_col[1]= g;
+ font->shadow_col[2]= b;
+ font->shadow_col[3]= a;
+ }
}
-void BLF_kerning(float space)
+void BLF_shadow_offset(int x, int y)
{
FontBLF *font;
font= global_font[global_font_cur];
- if (font)
- font->kerning= space;
+ if (font) {
+ font->shadow_x= x;
+ font->shadow_y= y;
+ }
}
-void BLF_shadow(int level, float r, float g, float b, float a)
+void BLF_buffer(float *fbuf, unsigned char *cbuf, unsigned int w, unsigned int h, int nch)
{
FontBLF *font;
font= global_font[global_font_cur];
if (font) {
- font->shadow= level;
- font->shadow_col[0]= r;
- font->shadow_col[1]= g;
- font->shadow_col[2]= b;
- font->shadow_col[3]= a;
+ font->b_fbuf= fbuf;
+ font->b_cbuf= cbuf;
+ font->bw= w;
+ font->bh= h;
+ font->bch= nch;
}
}
-void BLF_shadow_offset(int x, int y)
+void BLF_buffer_col(float r, float g, float b, float a)
{
FontBLF *font;
font= global_font[global_font_cur];
if (font) {
- font->shadow_x= x;
- font->shadow_y= y;
+ font->b_col[0]= r;
+ font->b_col[1]= g;
+ font->b_col[2]= b;
+ font->b_col[3]= a;
}
}
+
+void BLF_draw_buffer(char *str)
+{
+ FontBLF *font;
+
+ font= global_font[global_font_cur];
+ if (font)
+ blf_font_buffer(font, str);
+}