[Bf-blender-cvs] [d90eb356622] blender2.8: UI: tweak vertical centering of text in buttons.

Brecht Van Lommel noreply at git.blender.org
Thu Oct 11 14:20:44 CEST 2018


Commit: d90eb356622931988f4b97c50d42c427f5868f20
Author: Brecht Van Lommel
Date:   Thu Oct 11 12:24:33 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBd90eb356622931988f4b97c50d42c427f5868f20

UI: tweak vertical centering of text in buttons.

This effectively moves up the text by one pixel to make it look more
centered in the button and relative to the icon.

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

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 16c3e01e7aa..47d105efd5f 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -179,7 +179,8 @@ void UI_fontstyle_draw_ex(
 	}
 	else {
 		/* draw from boundbox center */
-		yofs = ceil(0.5f * (BLI_rcti_size_y(rect) - BLF_ascender(fs->uifont_id)));
+		float height = BLF_ascender(fs->uifont_id) + BLF_descender(fs->uifont_id);
+		yofs = ceil(0.5f * (BLI_rcti_size_y(rect) - height));
 	}
 
 	if (fs->align == UI_STYLE_TEXT_CENTER) {
@@ -225,7 +226,7 @@ void UI_fontstyle_draw_rotated(const uiFontStyle *fs, const rcti *rect, const ch
 
 	UI_fontstyle_set(fs);
 
-	height = BLF_ascender(fs->uifont_id);
+	height = BLF_ascender(fs->uifont_id) + BLF_descender(fs->uifont_id);
 	/* becomes x-offset when rotated */
 	xofs = ceil(0.5f * (BLI_rcti_size_y(rect) - height));



More information about the Bf-blender-cvs mailing list