diff --git a/source/blender/blenfont/intern/blf_glyph.c b/source/blender/blenfont/intern/blf_glyph.c index 67418644fea..1990b43122c 100644 --- a/source/blender/blenfont/intern/blf_glyph.c +++ b/source/blender/blenfont/intern/blf_glyph.c @@ -1212,8 +1212,19 @@ void blf_glyph_draw(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, const int x, } if (font->flags & BLF_CLIPPING) { + float xa, ya; + + if (font->flags & BLF_ASPECT) { + xa = font->aspect[0]; + ya = font->aspect[1]; + } + else { + xa = 1.0f; + ya = 1.0f; + } + rcti rect_test; - blf_glyph_calc_rect_test(&rect_test, g, x, y); + blf_glyph_calc_rect_test(&rect_test, g, x * xa, y * ya); BLI_rcti_translate(&rect_test, font->pos[0], font->pos[1]); if (!BLI_rcti_inside_rcti(&font->clip_rec, &rect_test)) { return; diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index ef943ea30ba..b25f97c9c54 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -2845,7 +2845,7 @@ static void frame_node_draw_label(TreeDrawContext &tree_draw_ctx, const Text *text = (const Text *)node.id; const int line_height_max = BLF_height_max(fontid); const float line_spacing = (line_height_max * aspect); - const float line_width = (BLI_rctf_size_x(&rct) - margin) / aspect; + const float line_width = (BLI_rctf_size_x(&rct) - 2 * margin) / aspect; /* 'x' doesn't need aspect correction. */ x = rct.xmin + margin; @@ -2854,12 +2854,7 @@ static void frame_node_draw_label(TreeDrawContext &tree_draw_ctx, int y_min = y + ((margin * 2) - (y - rct.ymin)); BLF_enable(fontid, BLF_CLIPPING | BLF_WORD_WRAP); - BLF_clipping(fontid, - rct.xmin, - /* Round to avoid clipping half-way through a line. */ - y - (floorf(((y - rct.ymin) - (margin * 2)) / line_spacing) * line_spacing), - rct.xmin + line_width, - rct.ymax); + BLF_clipping(fontid, rct.xmin, rct.ymin + margin, rct.xmax, rct.ymax); BLF_wordwrap(fontid, line_width);