[Bf-blender-cvs] [84df0ff] temp-blf-wordwrap: expose BLF_height_max as an int

Campbell Barton noreply at git.blender.org
Sun Aug 30 12:41:03 CEST 2015


Commit: 84df0fffd968a8bc902eeb3269590f813bc89c8a
Author: Campbell Barton
Date:   Sun Aug 30 20:35:36 2015 +1000
Branches: temp-blf-wordwrap
https://developer.blender.org/rB84df0fffd968a8bc902eeb3269590f813bc89c8a

expose BLF_height_max as an int

===================================================================

M	source/blender/blenfont/BLF_api.h
M	source/blender/blenfont/intern/blf.c
M	source/blender/editors/interface/interface_style.c

===================================================================

diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index 52de93f..5881191 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -107,7 +107,7 @@ float BLF_height_ex(int fontid, const char *str, size_t len, struct ResultBLF *r
 float BLF_height(int fontid, const char *str, size_t len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
 
 /* Return dimensions of the font without any sample text. */
-float BLF_height_max(int fontid) ATTR_WARN_UNUSED_RESULT;
+int BLF_height_max(int fontid) ATTR_WARN_UNUSED_RESULT;
 float BLF_width_max(int fontid) ATTR_WARN_UNUSED_RESULT;
 float BLF_descender(int fontid) ATTR_WARN_UNUSED_RESULT;
 float BLF_ascender(int fontid) ATTR_WARN_UNUSED_RESULT;
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 0a02395..c41e340 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -764,7 +764,7 @@ float BLF_height(int fontid, const char *str, size_t len)
 	return BLF_height_ex(fontid, str, len, NULL);
 }
 
-float BLF_height_max(int fontid)
+int BLF_height_max(int fontid)
 {
 	FontBLF *font = blf_get(fontid);
 
@@ -772,7 +772,7 @@ float BLF_height_max(int fontid)
 		return font->glyph_cache->max_glyph_height;
 	}
 
-	return 0.0f;
+	return 0;
 }
 
 float BLF_width_max(int fontid)
diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c
index c137a03..c26b850 100644
--- a/source/blender/editors/interface/interface_style.c
+++ b/source/blender/editors/interface/interface_style.c
@@ -172,7 +172,7 @@ void UI_fontstyle_draw_ex(
 
 	BLF_enable(fs->uifont_id, font_flag);
 
-	yofs = ceil(BLI_rcti_size_y(rect) - BLF_height_max(fs->uifont_id));
+	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)));




More information about the Bf-blender-cvs mailing list