ab75c96867eb — Chris Cannam 3 months ago
Add "figure space" before zero - but it's not rendering as expected in my use case...
1 files changed, 11 insertions(+), 10 deletions(-)

M scale-intervals.sml
M scale-intervals.sml +11 -10
@@ 185,18 185,19 @@ structure ScaleIntervals : SCALE_INTERVA
                           | "Inf" => infinity
                           | label => label
             fun replaceNegative label =
-                String.implode
-                    (ListMisc.concatMap
-                         (fn #"~" => (* true minus sign *)
-                             [chr 0xe2, chr 0x88, chr 0x92]
-                          | c => [c])
-                         (String.explode label))
+                implode (ListMisc.concatMap
+                             (fn #"~" => (* true minus sign *)
+                                 [chr 0xe2, chr 0x88, chr 0x92]
+                             | c => [c])
+                             (explode label))
             fun removeNegative label =
-                String.implode
-                    (ListMisc.concatMap (fn #"~" => [] | c => [c])
-                                        (String.explode label))
+                implode (ListMisc.concatMap (fn #"~" => [] | c => [c])
+                                            (explode label))
             fun addPositive label =
-                if Real.> (x, 0.0)
+                if label = "0.0" orelse Real.== (x, 0.0)
+                then implode [chr 0xe2, chr 0x80, chr 0x87] (* figure space *)
+                     ^ label
+                else if Real.> (x, 0.0)
                 then "+" ^ label
                 else label
             val label = case signs of