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.c44
1 files changed, 35 insertions, 9 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index d9a02b09336..3ac0b8449b0 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -321,13 +321,16 @@ void BLF_disable_default(int option)
font->flags &= ~option;
}
-void BLF_aspect(int fontid, float aspect)
+void BLF_aspect(int fontid, float x, float y, float z)
{
FontBLF *font;
font= BLF_get(fontid);
- if (font)
- font->aspect= aspect;
+ if (font) {
+ font->aspect[0]= x;
+ font->aspect[1]= y;
+ font->aspect[2]= z;
+ }
}
void BLF_matrix(int fontid, double *m)
@@ -346,23 +349,43 @@ void BLF_position(int fontid, float x, float y, float z)
{
FontBLF *font;
float remainder;
+ float xa, ya, za;
font= BLF_get(fontid);
if (font) {
+ if (font->flags & BLF_ASPECT) {
+ xa= font->aspect[0];
+ ya= font->aspect[1];
+ za= font->aspect[2];
+ }
+ else {
+ xa= 1.0f;
+ ya= 1.0f;
+ za= 1.0f;
+ }
+
remainder= x - floor(x);
if (remainder > 0.4 && remainder < 0.6) {
if (remainder < 0.5)
- x -= 0.1 * font->aspect;
+ x -= 0.1 * xa;
else
- x += 0.1 * font->aspect;
+ x += 0.1 * xa;
}
remainder= y - floor(y);
if (remainder > 0.4 && remainder < 0.6) {
if (remainder < 0.5)
- y -= 0.1 * font->aspect;
+ y -= 0.1 * ya;
else
- y += 0.1 * font->aspect;
+ y += 0.1 * ya;
+ }
+
+ remainder= z - floor(z);
+ if (remainder > 0.4 && remainder < 0.6) {
+ if (remainder < 0.5)
+ z -= 0.1 * za;
+ else
+ z += 0.1 * za;
}
font->pos[0]= x;
@@ -406,6 +429,7 @@ void BLF_draw_default(float x, float y, float z, const char *str, size_t len)
BLF_position(global_font_default, x, y, z);
BLF_draw(global_font_default, str, len);
}
+
/* same as above but call 'BLF_draw_ascii' */
void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t len)
{
@@ -434,7 +458,6 @@ void BLF_rotation_default(float angle)
font->angle= angle;
}
-
static void blf_draw__start(FontBLF *font)
{
/*
@@ -452,11 +475,14 @@ static void blf_draw__start(FontBLF *font)
glMultMatrixd((GLdouble *)&font->m);
glTranslatef(font->pos[0], font->pos[1], font->pos[2]);
- glScalef(font->aspect, font->aspect, 1.0);
+
+ if (font->flags & BLF_ASPECT)
+ glScalef(font->aspect[0], font->aspect[1], font->aspect[2]);
if (font->flags & BLF_ROTATION)
glRotatef(font->angle, 0.0f, 0.0f, 1.0f);
}
+
static void blf_draw__end(void)
{
glPopMatrix();