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:
authorJacques Lucke <mail@jlucke.com>2019-03-17 16:15:26 +0300
committerJacques Lucke <mail@jlucke.com>2019-03-17 16:15:26 +0300
commitcfd909f184ccd87ed6dcfa45a5ab93d8fc5cb742 (patch)
tree2b9673770f4cdc33634e16113252c06712844e3a /source/blender/blenfont
parentb28bd7c5a4c6fa66f6e54ffb9f186617f2d5a533 (diff)
Fix T62678: Wrong text clipping
There are two issues at play here. First, BLF_width computed a width that was not wide enough to actually hold the text. Second, blf_glyph_calc_rect_test computed an incorrect rect->xmax when the glyph was moved to the left a bit. We ignore the overlap on the left, but the right side should still be adjusted accordingly.
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r--source/blender/blenfont/intern/blf_glyph.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c
index 4c5f598ffeb..45761a3f319 100644
--- a/source/blender/blenfont/intern/blf_glyph.c
+++ b/source/blender/blenfont/intern/blf_glyph.c
@@ -441,9 +441,9 @@ static void blf_glyph_calc_rect_test(rctf *rect, GlyphBLF *g, float x, float y)
{
/* intentionally check clipping without shadow offset and negative kerning */
rect->xmin = floorf(x + MAX2(0.0f, g->pos_x));
- rect->xmax = rect->xmin + (float)g->width;
+ rect->xmax = rect->xmin + (float)g->width + MIN2(0.0f, g->pos_x);
rect->ymin = floorf(y + MAX2(0.0f, g->pos_y));
- rect->ymax = rect->ymin - (float)g->height;
+ rect->ymax = rect->ymin - (float)g->height - MIN2(0.0f, g->pos_y);
}
static void blf_glyph_calc_rect_shadow(rctf *rect, GlyphBLF *g, float x, float y, FontBLF *font)