From 26f073b327ac31d683e1719ce8371b6e28bf01d6 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 20 Aug 2012 15:29:02 +0000 Subject: macros for rectangle center and size --- source/blender/blenfont/intern/blf_font.c | 6 +++--- source/blender/blenfont/intern/blf_glyph.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/blenfont') diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index dcefcc68d23..751c2f5043b 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -425,8 +425,8 @@ void blf_font_width_and_height(FontBLF *font, const char *str, float *width, flo } blf_font_boundbox(font, str, &box); - *width = ((box.xmax - box.xmin) * xa); - *height = ((box.ymax - box.ymin) * ya); + *width = (BLI_RCT_SIZE_X(&box) * xa); + *height = (BLI_RCT_SIZE_Y(&box) * ya); } float blf_font_width(FontBLF *font, const char *str) @@ -440,7 +440,7 @@ float blf_font_width(FontBLF *font, const char *str) xa = 1.0f; blf_font_boundbox(font, str, &box); - return (box.xmax - box.xmin) * xa; + return BLI_RCT_SIZE_X(&box) * xa; } float blf_font_height(FontBLF *font, const char *str) diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 39945bf19b0..3e871fefff8 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -412,7 +412,7 @@ int blf_glyph_render(FontBLF *font, GlyphBLF *g, float x, float y) g->uv[1][1] = ((float)(g->yoff + g->height)) / ((float)gc->p2_height); /* update the x offset for the next glyph. */ - gc->x_offs += (int)(g->box.xmax - g->box.xmin + gc->pad); + gc->x_offs += (int)(BLI_RCT_SIZE_X(&g->box) + gc->pad); gc->rem_glyphs--; g->build_tex = 1; -- cgit v1.2.3