fix [#27218] Tooltip text renders incorrectly.
authorCampbell Barton <ideasman42@gmail.com>
Tue, 3 May 2011 13:12:47 +0000 (13:12 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 3 May 2011 13:12:47 +0000 (13:12 +0000)
source/blender/editors/interface/interface_regions.c

index aa5499110e6082e3ffdcbbcdf7ae3c4e324fa2d3..c3ecbd6929cb8ab7eeb2739b5e344360226d1d70 100644 (file)
@@ -485,7 +485,13 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but)
        data->fstyle.align= UI_STYLE_TEXT_CENTER;
        uiStyleFontSet(&data->fstyle);
 
        data->fstyle.align= UI_STYLE_TEXT_CENTER;
        uiStyleFontSet(&data->fstyle);
 
-       h= BLF_height(data->fstyle.uifont_id, data->lines[0]);
+       /* clipping is very strict & gives problems in some cases [#27218]
+        * use the tallest line height. */
+       h= 0;
+       for(a=0; a<data->totline; a++) {
+               int h_tmp= BLF_height(data->fstyle.uifont_id, data->lines[a]);
+               h= MAX2(h, h_tmp);
+       }
 
        for(a=0, fontw=0, fonth=0; a<data->totline; a++) {
                w= BLF_width(data->fstyle.uifont_id, data->lines[a]);
 
        for(a=0, fontw=0, fonth=0; a<data->totline; a++) {
                w= BLF_width(data->fstyle.uifont_id, data->lines[a]);