diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-09-19 07:50:35 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-09-19 08:22:03 +0300 |
commit | e6a413b1ec354dce94c4a42040d15a3191720de4 (patch) | |
tree | 22f4b9c435e8eb75393fd17d434e01dbf8852e8a /source/blender/editors/interface/interface_style.c | |
parent | 36d64240e6898a5372a072f36a9ef30152e260fc (diff) |
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.
Diffstat (limited to 'source/blender/editors/interface/interface_style.c')
-rw-r--r-- | source/blender/editors/interface/interface_style.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 5d0d82e3b1e..25a187c43ad 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))); |