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-02-20 08:42:44 +0300
committerDiego Borghetti <bdiego@gmail.com>2009-02-20 08:42:44 +0300
commit8145489a7dc2889bc0fa61f0e23c4dc0f7b300be (patch)
treebcf58e46a5844e2b3852576578a4e8aaa3b716fd /source/blender/blenfont/intern/blf_glyph.c
parent72e99d918215ed549a84e360530fc99d1caf56a1 (diff)
Add clipping text option to blenfont also add an enable/disable
function for aspect and rotation (and the new clipping). Update source/Makefile to point to the new libed_sculpt_paint.
Diffstat (limited to 'source/blender/blenfont/intern/blf_glyph.c')
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 3918be3d469..2bbdeb9ad32 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -53,6 +53,7 @@
#include "BLI_string.h"
#include "BIF_gl.h"
+#include "BLF_api.h"
#include "blf_internal_types.h"
#include "blf_internal.h"
@@ -293,29 +294,47 @@ void blf_glyph_free(GlyphBLF *g)
MEM_freeN(g);
}
-void blf_glyph_render(GlyphBLF *g, float x, float y)
+int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y)
{
GLint cur_tex;
- float dx;
+ float dx, dx1;
+ float y1, y2;
+
+ dx= floor(x + g->pos_x);
+ dx1= dx + g->width;
+ y1= y + g->pos_y;
+ y2= y + g->pos_y - g->height;
+
+ if (font->flags & BLF_CLIPPING) {
+ if (!BLI_in_rctf(&font->clip_rec, dx + font->pos[0], y1 + font->pos[1]))
+ return(0);
+ if (!BLI_in_rctf(&font->clip_rec, dx + font->pos[0], y2 + font->pos[1]))
+ return(0);
+ if (!BLI_in_rctf(&font->clip_rec, dx1 + font->pos[0], y2 + font->pos[1]))
+ return(0);
+ if (!BLI_in_rctf(&font->clip_rec, dx1 + font->pos[0], y1 + font->pos[1]))
+ return(0);
+ }
glGetIntegerv(GL_TEXTURE_2D_BINDING_EXT, &cur_tex);
if (cur_tex != g->tex)
glBindTexture(GL_TEXTURE_2D, g->tex);
- dx= floor(x + g->pos_x);
glBegin(GL_QUADS);
glTexCoord2f(g->uv[0][0], g->uv[0][1]);
- glVertex2f(dx, y + g->pos_y);
+ glVertex2f(dx, y1);
glTexCoord2f(g->uv[0][0], g->uv[1][1]);
- glVertex2f(dx, y + g->pos_y - g->height);
+ glVertex2f(dx, y2);
glTexCoord2f(g->uv[1][0], g->uv[1][1]);
- glVertex2f(dx + g->width, y + g->pos_y - g->height);
+ glVertex2f(dx1, y2);
glTexCoord2f(g->uv[1][0], g->uv[0][1]);
- glVertex2f(dx + g->width, y + g->pos_y);
+ glVertex2f(dx1, y1);
glEnd();
+
+ return(1);
}
#endif /* WITH_FREETYPE2 */