[Bf-blender-cvs] [8826db8f030] master: Fix T97310: BLF Line Height While Text Wrapping

Harley Acheson noreply at git.blender.org
Thu Apr 14 02:46:28 CEST 2022


Commit: 8826db8f0300cdc60b985ce9b05f2338c20ac411
Author: Harley Acheson
Date:   Wed Apr 13 17:45:32 2022 -0700
Branches: master
https://developer.blender.org/rB8826db8f0300cdc60b985ce9b05f2338c20ac411

Fix T97310: BLF Line Height While Text Wrapping

Fix word-wrapped tooltip text not showing by aligning to pixel grid.

See D14639 for more details.

Differential Revision: https://developer.blender.org/D14639

Reviewed by Campbell Barton

===================================================================

M	source/blender/blenfont/intern/blf_font.c
M	source/blender/blenfont/intern/blf_internal_types.h

===================================================================

diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c
index 51b65dab8fc..f93cb8b2d64 100644
--- a/source/blender/blenfont/intern/blf_font.c
+++ b/source/blender/blenfont/intern/blf_font.c
@@ -921,6 +921,9 @@ static void blf_font_wrap_apply(FontBLF *font,
   int lines = 0;
   ft_pix pen_x_next = 0;
 
+  /* Space between lines needs to be aligned to the pixel grid (T97310). */
+  ft_pix line_height = FT_PIX_FLOOR(blf_font_height_max_ft_pix(font));
+
   GlyphCacheBLF *gc = blf_glyph_cache_acquire(font);
 
   struct WordWrapVars {
@@ -978,7 +981,7 @@ static void blf_font_wrap_apply(FontBLF *font,
       wrap.start = wrap.last[0];
       i = wrap.last[1];
       pen_x = 0;
-      pen_y -= blf_font_height_max_ft_pix(font);
+      pen_y -= line_height;
       g_prev = NULL;
       lines += 1;
       continue;
diff --git a/source/blender/blenfont/intern/blf_internal_types.h b/source/blender/blenfont/intern/blf_internal_types.h
index 79388752969..62bce36dda0 100644
--- a/source/blender/blenfont/intern/blf_internal_types.h
+++ b/source/blender/blenfont/intern/blf_internal_types.h
@@ -76,7 +76,6 @@ BLI_INLINE ft_pix ft_pix_round_advance(ft_pix v, ft_pix step)
   return FT_PIX_DEFAULT_ROUNDING(v) + FT_PIX_DEFAULT_ROUNDING(step);
 }
 
-#undef FT_PIX_FLOOR
 #undef FT_PIX_ROUND
 #undef FT_PIX_CEIL
 #undef FT_PIX_DEFAULT_ROUNDING



More information about the Bf-blender-cvs mailing list