[Bf-blender-cvs] [e6a413b] master: UI: word-wrap for tooltips, broke text alignment

Campbell Barton noreply at git.blender.org
Sat Sep 19 07:27:40 CEST 2015


Commit: e6a413b1ec354dce94c4a42040d15a3191720de4
Author: Campbell Barton
Date:   Sat Sep 19 14:50:35 2015 +1000
Branches: master
https://developer.blender.org/rBe6a413b1ec354dce94c4a42040d15a3191720de4

UI: word-wrap for tooltips, broke text alignment

This wasn't visible with default settings,
but caused problems w/ pie-menu's & manually adjusted theme font-size.

Now only draw from the bound-box top w/ word-wrap enabled.

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

M	source/blender/editors/interface/interface_style.c

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

diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index 5d0d82e..25a187c 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -172,7 +172,14 @@ void UI_fontstyle_draw_ex(
 
 	BLF_enable(fs->uifont_id, font_flag);
 
-	yofs = BLI_rcti_size_y(rect) - BLF_height_max(fs->uifont_id);
+	if (fs->word_wrap == 1) {
+		/* draw from boundbox top */
+		yofs = BLI_rcti_size_y(rect) - BLF_height_max(fs->uifont_id);
+	}
+	else {
+		/* draw from boundbox center */
+		yofs = ceil(0.5f * (BLI_rcti_size_y(rect) - BLF_ascender(fs->uifont_id)));
+	}
 
 	if (fs->align == UI_STYLE_TEXT_CENTER) {
 		xofs = floor(0.5f * (BLI_rcti_size_x(rect) - BLF_width(fs->uifont_id, str, len)));




More information about the Bf-blender-cvs mailing list