[Bf-blender-cvs] [c3e2faaad5] blender2.8: BLF: simplify API for default font

Mike Erwin noreply at git.blender.org
Sun Feb 5 07:17:14 CET 2017


Commit: c3e2faaad540c130b9ff92217a753ef24cb19fed
Author: Mike Erwin
Date:   Sun Feb 5 01:01:41 2017 -0500
Branches: blender2.8
https://developer.blender.org/rBc3e2faaad540c130b9ff92217a753ef24cb19fed

BLF: simplify API for default font

We had two versions of several BLF functions -- one for a specific font ID & another for the default font.

New BLF_default function lets us simplify this API & delete the redundant code.

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

M	source/blender/blenfont/BLF_api.h
M	source/blender/blenfont/intern/blf.c

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

diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h
index e6d48d82a3..649ec9c5a4 100644
--- a/source/blender/blenfont/BLF_api.h
+++ b/source/blender/blenfont/BLF_api.h
@@ -136,27 +136,11 @@ void BLF_width_and_height(int fontid, const char *str, size_t len, float *r_widt
  */
 float BLF_fixed_width(int fontid) ATTR_WARN_UNUSED_RESULT;
 
-/* and this two function return the width and height
- * of the string, using the default font and both value
- * are multiplied by the aspect of the font.
- */
-void  BLF_width_and_height_default(const char *str, size_t len, float *r_width, float *r_height) ATTR_NONNULL();
-float BLF_width_default(const char *str, size_t len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
-float BLF_height_default(const char *str, size_t len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
-
-/* Set rotation for default font. */
-void BLF_rotation_default(float angle);
-
-/* Enable/disable options to the default font. */
-void BLF_enable_default(int option);
-void BLF_disable_default(int option);
-
 /* By default, rotation and clipping are disable and
  * have to be enable/disable using BLF_enable/disable.
  */
 void BLF_rotation(int fontid, float angle);
 void BLF_clipping(int fontid, float xmin, float ymin, float xmax, float ymax);
-void BLF_clipping_default(float xmin, float ymin, float xmax, float ymax);
 void BLF_wordwrap(int fontid, int wrap_width);
 
 #if BLF_BLUR_ENABLE
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c
index 87e56d55ee..04b6eb0ad3 100644
--- a/source/blender/blenfont/intern/blf.c
+++ b/source/blender/blenfont/intern/blf.c
@@ -364,24 +364,6 @@ void BLF_disable(int fontid, int option)
 	}
 }
 
-void BLF_enable_default(int option)
-{
-	FontBLF *font = blf_get(global_font_default);
-
-	if (font) {
-		font->flags |= option;
-	}
-}
-
-void BLF_disable_default(int option)
-{
-	FontBLF *font = blf_get(global_font_default);
-
-	if (font) {
-		font->flags &= ~option;
-	}
-}
-
 void BLF_aspect(int fontid, float x, float y, float z)
 {
 	FontBLF *font = blf_get(fontid);
@@ -554,15 +536,6 @@ void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t l
 	BLF_draw_ascii(global_font_default, str, len); /* XXX, use real length */
 }
 
-void BLF_rotation_default(float angle)
-{
-	FontBLF *font = blf_get(global_font_default);
-
-	if (font) {
-		font->angle = angle;
-	}
-}
-
 static void blf_draw_gl__start(FontBLF *font)
 {
 	/*
@@ -763,14 +736,6 @@ void BLF_width_and_height(int fontid, const char *str, size_t len, float *r_widt
 	}
 }
 
-void BLF_width_and_height_default(const char *str, size_t len, float *r_width, float *r_height)
-{
-	ASSERT_DEFAULT_SET;
-
-	BLF_size(global_font_default, global_font_points, global_font_dpi);
-	BLF_width_and_height(global_font_default, str, len, r_width, r_height);
-}
-
 float BLF_width_ex(
         int fontid, const char *str, size_t len,
         struct ResultBLF *r_info)
@@ -801,14 +766,6 @@ float BLF_fixed_width(int fontid)
 	return 0.0f;
 }
 
-float BLF_width_default(const char *str, size_t len)
-{
-	ASSERT_DEFAULT_SET;
-
-	BLF_size(global_font_default, global_font_points, global_font_dpi);
-	return BLF_width(global_font_default, str, len);
-}
-
 float BLF_height_ex(
         int fontid, const char *str, size_t len,
         struct ResultBLF *r_info)
@@ -872,15 +829,6 @@ float BLF_ascender(int fontid)
 	return 0.0f;
 }
 
-float BLF_height_default(const char *str, size_t len)
-{
-	ASSERT_DEFAULT_SET;
-
-	BLF_size(global_font_default, global_font_points, global_font_dpi);
-
-	return BLF_height(global_font_default, str, len);
-}
-
 void BLF_rotation(int fontid, float angle)
 {
 	FontBLF *font = blf_get(fontid);
@@ -902,18 +850,6 @@ void BLF_clipping(int fontid, float xmin, float ymin, float xmax, float ymax)
 	}
 }
 
-void BLF_clipping_default(float xmin, float ymin, float xmax, float ymax)
-{
-	FontBLF *font = blf_get(global_font_default);
-
-	if (font) {
-		font->clip_rec.xmin = xmin;
-		font->clip_rec.ymin = ymin;
-		font->clip_rec.xmax = xmax;
-		font->clip_rec.ymax = ymax;
-	}
-}
-
 void BLF_wordwrap(int fontid, int wrap_width)
 {
 	FontBLF *font = blf_get(fontid);




More information about the Bf-blender-cvs mailing list