for UI text drawing use BLF_ascender(fs->uifont_id) rather then BLF_height(fs->uifont...
[blender.git] / source / blender / editors / interface / interface_style.c
index 5f2a757d2e36732392acdc5847753c8da83e2c13..8d4b42091207f9c6b705249bf5d31ae60efd03db 100644 (file)
@@ -149,9 +149,9 @@ void uiStyleFontDrawExt(uiFontStyle *fs, rcti *rect, const char *str,
        int xofs=0, yofs;
        
        uiStyleFontSet(fs);
-       
-       height= BLF_height(fs->uifont_id, "2"); /* correct offset is on baseline, the j is below that */
-       yofs= floor( 0.5f*(rect->ymax - rect->ymin - height));
+
+       height= BLF_ascender(fs->uifont_id);
+       yofs= ceil( 0.5f*(rect->ymax - rect->ymin - height));
 
        if(fs->align==UI_STYLE_TEXT_CENTER) {
                xofs= floor( 0.5f*(rect->xmax - rect->xmin - BLF_width(fs->uifont_id, str)));
@@ -206,9 +206,9 @@ void uiStyleFontDrawRotated(uiFontStyle *fs, rcti *rect, const char *str)
 
        uiStyleFontSet(fs);
 
-       height= BLF_height(fs->uifont_id, "2"); /* correct offset is on baseline, the j is below that */
+       height= BLF_ascender(fs->uifont_id);
        /* becomes x-offset when rotated */
-       xofs= floor( 0.5f*(rect->ymax - rect->ymin - height)) + 1;
+       xofs= ceil( 0.5f*(rect->ymax - rect->ymin - height));
 
        /* ignore UI_STYLE, always aligned to top */