Fix T62678: better glyph clipping test

Reviewers: billreynish, brecht

Differential Revision: https://developer.blender.org/D4550
This commit is contained in:
Jacques Lucke 2019-03-20 13:33:08 +01:00
parent d6bf6744fc
commit 1b1b604596
Notes: blender-bot 2023-02-14 05:01:20 +01:00
Referenced by issue #62678, The Transform 'Y' label has gone missing
1 changed files with 7 additions and 5 deletions

View File

@ -439,11 +439,13 @@ static void blf_glyph_calc_rect(rctf *rect, GlyphBLF *g, float x, float y)
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 + MIN2(0.0f, g->pos_x);
rect->ymin = floorf(y + MAX2(0.0f, g->pos_y));
rect->ymax = rect->ymin - (float)g->height - MIN2(0.0f, g->pos_y);
/* Intentionally check with g->advance, because this is the
* width used by BLF_width. This allows that the text slightly
* overlaps the clipping border to achieve better alignment. */
rect->xmin = floorf(x);
rect->xmax = rect->xmin + MIN2(g->advance, (float)g->width);
rect->ymin = floorf(y);
rect->ymax = rect->ymin - (float)g->height;
}
static void blf_glyph_calc_rect_shadow(rctf *rect, GlyphBLF *g, float x, float y, FontBLF *font)