diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-10-11 13:24:33 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-10-11 15:19:25 +0300 |
commit | d90eb356622931988f4b97c50d42c427f5868f20 (patch) | |
tree | 75c959e33ac7d98eb1a0a9414f5d1581d1f87d7c /source/blender/editors/interface/interface_style.c | |
parent | 3f0873fa1e48e277f85801ca03c344bed4a77320 (diff) |
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.
Diffstat (limited to 'source/blender/editors/interface/interface_style.c')
-rw-r--r-- | source/blender/editors/interface/interface_style.c | 5 |
1 files changed, 3 insertions, 2 deletions
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)); |