Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-09-18 13:21:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-09-18 13:44:06 +0300
commitd435b0d24d389143e766dc7d776760b10315206c (patch)
treefefe3d7c89f408f6f0c4bfbe2346c654a9e3975b /source/blender/editors/interface/interface_style.c
parentf2341f829654c4dc97fcf9fd1f74a6526c4f50ff (diff)
UI: word-wrap support for tooltips
Tooltips will automatically wrap when exceeding UI_TIP_MAXWIDTH.
Diffstat (limited to 'source/blender/editors/interface/interface_style.c')
-rw-r--r--source/blender/editors/interface/interface_style.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index e158b70ac21..5d0d82e3b1e 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -152,7 +152,6 @@ void UI_fontstyle_draw_ex(
const uiFontStyle *fs, const rcti *rect, const char *str,
size_t len, float *r_xofs, float *r_yofs)
{
- float height;
int xofs = 0, yofs;
int font_flag = BLF_CLIPPING;
@@ -167,11 +166,13 @@ void UI_fontstyle_draw_ex(
if (fs->kerning == 1) {
font_flag |= BLF_KERNING_DEFAULT;
}
+ if (fs->word_wrap == 1) {
+ font_flag |= BLF_WORD_WRAP;
+ }
BLF_enable(fs->uifont_id, font_flag);
- height = BLF_ascender(fs->uifont_id);
- yofs = ceil(0.5f * (BLI_rcti_size_y(rect) - height));
+ yofs = BLI_rcti_size_y(rect) - BLF_height_max(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)));