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.
This commit is contained in:
parent
b28bd7c5a4
commit
cfd909f184
Notes:
blender-bot
2023-02-14 04:10:15 +01:00
Referenced by issue #62678, The Transform 'Y' label has gone missing
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue