[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54683] trunk/blender/source/blender/ editors: Fix drawing of translated strings (can' t use _ascii version of BLF_draw in these cases, when WITH_INTERNATIONAL is defined we need unicode support).

Bastien Montagne montagne29 at wanadoo.fr
Wed Feb 20 09:39:32 CET 2013


Revision: 54683
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54683
Author:   mont29
Date:     2013-02-20 08:39:31 +0000 (Wed, 20 Feb 2013)
Log Message:
-----------
Fix drawing of translated strings (can't use _ascii version of BLF_draw in these cases, when WITH_INTERNATIONAL is defined we need unicode support).

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
    trunk/blender/source/blender/editors/transform/transform.c

Modified: trunk/blender/source/blender/editors/space_view3d/view3d_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2013-02-20 01:36:35 UTC (rev 54682)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_draw.c	2013-02-20 08:39:31 UTC (rev 54683)
@@ -854,8 +854,13 @@
 {
 	RegionView3D *rv3d = ar->regiondata;
 	const char *name = view3d_get_name(v3d, rv3d);
+	/* XXX 24 may be a bit small for unicode languages (Chinese in utf-8...) */
+#ifdef WITH_INTERNATIONAL
+	char tmpstr[32];
+#else
 	char tmpstr[24];
-	
+#endif
+
 	if (v3d->localvd) {
 		BLI_snprintf(tmpstr, sizeof(tmpstr), IFACE_("%s (Local)"), name);
 		name = tmpstr;
@@ -863,7 +868,11 @@
 
 	if (name) {
 		UI_ThemeColor(TH_TEXT_HI);
+#ifdef WITH_INTERNATIONAL
+		BLF_draw_default(U.widget_unit + rect->xmin,  rect->ymax - U.widget_unit, 0.0f, name, sizeof(tmpstr));
+#else
 		BLF_draw_default_ascii(U.widget_unit + rect->xmin,  rect->ymax - U.widget_unit, 0.0f, name, sizeof(tmpstr));
+#endif
 	}
 }
 
@@ -2854,8 +2863,12 @@
 		UI_ThemeColor(TH_TEXT_HI);
 		BLI_snprintf(printable, sizeof(printable), IFACE_("fps: %i"), (int)(fps + 0.5f));
 	}
-	
+
+#ifdef WITH_INTERNATIONAL
+	BLF_draw_default(rect->xmin + U.widget_unit,  rect->ymax - U.widget_unit, 0.0f, printable, sizeof(printable));
+#else
 	BLF_draw_default_ascii(rect->xmin + U.widget_unit,  rect->ymax - U.widget_unit, 0.0f, printable, sizeof(printable));
+#endif
 }
 
 static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const char **grid_unit);

Modified: trunk/blender/source/blender/editors/transform/transform.c
===================================================================
--- trunk/blender/source/blender/editors/transform/transform.c	2013-02-20 01:36:35 UTC (rev 54682)
+++ trunk/blender/source/blender/editors/transform/transform.c	2013-02-20 08:39:31 UTC (rev 54683)
@@ -1686,7 +1686,11 @@
 	 * - original color was red to match the icon, but that clashes badly with a less nasty border
 	 */
 	UI_ThemeColorShade(TH_TEXT_HI, -50);
+#ifdef WITH_INTERNATIONAL
+	BLF_draw_default(xco, ar->winy - 17, 0.0f, printable, sizeof(printable));
+#else
 	BLF_draw_default_ascii(xco, ar->winy - 17, 0.0f, printable, sizeof(printable));
+#endif
 	
 	/* autokey recording icon... */
 	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);




More information about the Bf-blender-cvs mailing list