From cda5d1769d71832a6b04ed6c91bac101c482e5f7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 11 Jan 2012 05:45:39 +0000 Subject: minor changes to BLF api use - replace calls to BLF_width & BLF_height --> BLF_width_and_height - no need to call strlen() on length value passed to BLF_draw(). this already checks for \0 char. --- source/blender/editors/interface/interface_widgets.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source/blender/editors/interface/interface_widgets.c') diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index d8a34262e81..5618d37712a 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -3264,7 +3264,7 @@ void ui_draw_menu_item(uiFontStyle *fstyle, rcti *rect, const char *name, int ic void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int iconid, int state) { rcti trect = *rect; - + float font_dims[2] = {0.0f, 0.0f}; uiWidgetType *wt= widget_type(UI_WTYPE_MENU_ITEM); wt->state(wt, state); @@ -3276,10 +3276,12 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int glColor3ubv((unsigned char*)wt->wcol.text); else glColor3ubv((unsigned char*)wt->wcol.text_sel); - + + BLF_width_and_height(fstyle->uifont_id, name, &font_dims[0], &font_dims[1]); + trect.xmin += 0; - trect.xmax = trect.xmin + BLF_width(fstyle->uifont_id, name) + 10; + trect.xmax = trect.xmin + font_dims[0] + 10; trect.ymin += 10; - trect.ymax = trect.ymin + BLF_height(fstyle->uifont_id, name); + trect.ymax = trect.ymin + font_dims[1]; uiStyleFontDraw(fstyle, &trect, name); } -- cgit v1.2.3