[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58165] trunk/blender/source/blender/ blenkernel/intern/unit.c: fix [#36090] Blender displays strange symbol in edge length

Campbell Barton ideasman42 at gmail.com
Thu Jul 11 07:11:10 CEST 2013


Revision: 58165
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58165
Author:   campbellbarton
Date:     2013-07-11 05:11:10 +0000 (Thu, 11 Jul 2013)
Log Message:
-----------
fix [#36090] Blender displays strange symbol in edge length

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/unit.c

Modified: trunk/blender/source/blender/blenkernel/intern/unit.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/unit.c	2013-07-11 04:38:47 UTC (rev 58164)
+++ trunk/blender/source/blender/blenkernel/intern/unit.c	2013-07-11 05:11:10 UTC (rev 58165)
@@ -95,6 +95,11 @@
 #define B_UNIT_DEF_SUPPRESS 1 /* Use for units that are not used enough to be translated into for common use */
 #define B_UNIT_DEF_TENTH 2 /* Display a unit even if its value is 0.1, eg 0.1mm instead of 100um */
 
+/* workaround encoding issue with "µm", bug [#36090] */
+#define B_UNIT_CHAR_MICRO "\xb5"
+#define UM B_UNIT_CHAR_MICRO"m"
+#define US B_UNIT_CHAR_MICRO"s"
+
 /* define a single unit */
 typedef struct bUnitCollection {
 	struct bUnitDef *units;
@@ -116,7 +121,7 @@
 	{"decimeter", "decimeters",     "dm",  NULL, "10 Centimeters", UN_SC_DM, 0.0, B_UNIT_DEF_SUPPRESS},
 	{"centimeter", "centimeters",   "cm",  NULL, "Centimeters", UN_SC_CM, 0.0,    B_UNIT_DEF_NONE},
 	{"millimeter", "millimeters",   "mm",  NULL, "Millimeters", UN_SC_MM, 0.0,    B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH},
-	{"micrometer", "micrometers",   "µm",  "um", "Micrometers", UN_SC_UM, 0.0,    B_UNIT_DEF_NONE},     // micron too?
+	{"micrometer", "micrometers",   UM,    "um", "Micrometers", UN_SC_UM, 0.0,    B_UNIT_DEF_NONE},     // micron too?
 
 	/* These get displayed because of float precision problems in the transform header,
 	 * could work around, but for now probably people wont use these */
@@ -149,7 +154,7 @@
 	{"square decimeter",  "square decimetees",  "dm²", "dm2",   "Square Decimeters", UN_SC_DM * UN_SC_DM, 0.0,    B_UNIT_DEF_SUPPRESS},
 	{"square centimeter", "square centimeters", "cm²", "cm2",   "Square Centimeters", UN_SC_CM * UN_SC_CM, 0.0,   B_UNIT_DEF_NONE},
 	{"square millimeter", "square millimeters", "mm²", "mm2",   "Square Millimeters", UN_SC_MM * UN_SC_MM, 0.0,   B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH},
-	{"square micrometer", "square micrometers", "µm²", "um2",   "Square Micrometers", UN_SC_UM * UN_SC_UM, 0.0,   B_UNIT_DEF_NONE},
+	{"square micrometer", "square micrometers", UM"²", "um2",   "Square Micrometers", UN_SC_UM * UN_SC_UM, 0.0,   B_UNIT_DEF_NONE},
 	{NULL, NULL, NULL,  NULL, NULL, 0.0, 0.0}
 };
 static struct bUnitCollection buMetricAreaCollection = {buMetricAreaDef, 3, 0, sizeof(buMetricAreaDef) / sizeof(bUnitDef)};
@@ -175,7 +180,7 @@
 	{"cubic decimeter",  "cubic decimeters",  "dm³",  "dm3",  "Cubic Decimeters", UN_SC_DM * UN_SC_DM * UN_SC_DM, 0.0,    B_UNIT_DEF_SUPPRESS},
 	{"cubic centimeter", "cubic centimeters", "cm³",  "cm3",  "Cubic Centimeters", UN_SC_CM * UN_SC_CM * UN_SC_CM, 0.0,   B_UNIT_DEF_NONE},
 	{"cubic millimeter", "cubic millimeters", "mm³",  "mm3",  "Cubic Millimeters", UN_SC_MM * UN_SC_MM * UN_SC_MM, 0.0,   B_UNIT_DEF_NONE | B_UNIT_DEF_TENTH},
-	{"cubic micrometer", "cubic micrometers", "µm³",  "um3",  "Cubic Micrometers", UN_SC_UM * UN_SC_UM * UN_SC_UM, 0.0,   B_UNIT_DEF_NONE},
+	{"cubic micrometer", "cubic micrometers", UM"³",  "um3",  "Cubic Micrometers", UN_SC_UM * UN_SC_UM * UN_SC_UM, 0.0,   B_UNIT_DEF_NONE},
 	{NULL, NULL, NULL,  NULL, NULL, 0.0, 0.0}
 };
 static struct bUnitCollection buMetricVolCollection = {buMetricVolDef, 3, 0, sizeof(buMetricVolDef) / sizeof(bUnitDef)};
@@ -253,7 +258,7 @@
 	{"minute", "minutes",           "min", "m", "Minutes",      60.0, 0.0,      B_UNIT_DEF_NONE},
 	{"second", "seconds",           "sec", "s", "Seconds",      1.0, 0.0,       B_UNIT_DEF_NONE}, /* base unit */
 	{"millisecond", "milliseconds", "ms", NULL, "Milliseconds", 0.001, 0.0,     B_UNIT_DEF_NONE},
-	{"microsecond", "microseconds", "µs", "us", "Microseconds", 0.000001, 0.0,  B_UNIT_DEF_NONE},
+	{"microsecond", "microseconds", US,   "us", "Microseconds", 0.000001, 0.0,  B_UNIT_DEF_NONE},
 	{NULL, NULL, NULL, NULL, NULL, 0.0, 0.0}
 };
 static struct bUnitCollection buNaturalTimeCollection = {buNaturalTimeDef, 3, 0, sizeof(buNaturalTimeDef) / sizeof(bUnitDef)};
@@ -273,7 +278,7 @@
 	{"decimeter", "decimeters",     "dm",  NULL, "10 Centimeters", UN_SC_HM, 0.0, B_UNIT_DEF_SUPPRESS},
 	{"centimeter", "centimeters",   "cm",  NULL, "Centimeters", UN_SC_DAM, 0.0,    B_UNIT_DEF_SUPPRESS},
 	{"millimeter", "millimeters",   "mm",  NULL, "Millimeters", UN_SC_M, 0.0,    B_UNIT_DEF_NONE},
-	{"micrometer", "micrometers",   "µm",  "um", "Micrometers", UN_SC_MM, 0.0,    B_UNIT_DEF_SUPPRESS},     // micron too?
+	{"micrometer", "micrometers",   UM,    "um", "Micrometers", UN_SC_MM, 0.0,    B_UNIT_DEF_SUPPRESS},     // micron too?
 	{NULL, NULL, NULL,	NULL, NULL, 0.0, 0.0}
 };
 static struct bUnitCollection buCameraLenCollection = {buCameraLenDef, 3, 0, sizeof(buCameraLenDef) / sizeof(bUnitDef)};




More information about the Bf-blender-cvs mailing list