From d90eb356622931988f4b97c50d42c427f5868f20 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 11 Oct 2018 12:24:33 +0200 Subject: 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. --- source/blender/editors/interface/interface_style.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to '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)); -- cgit v1.2.3