]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix 499.
authorJoe Neeman <joeneeman@gmail.com>
Sun, 11 Nov 2007 22:36:01 +0000 (09:36 +1100)
committerJoe Neeman <joeneeman@gmail.com>
Mon, 12 Nov 2007 05:47:52 +0000 (16:47 +1100)
Replace all whitespace characters with spaces in text markup.

lily/text-interface.cc

index e8f5aefdf88c7659b5cdf32741f1934904b9823a..96444e10ab6537319b2471009988fe0eb57998a4 100644 (file)
 #include "output-def.hh"
 #include "modified-font-metric.hh"
 
+static void
+replace_whitespace (string *str)
+{
+  for (vsize i = 0; i < str->size (); i++)
+    if (isspace ((*str)[i]))
+      (*str)[i] = ' ';
+}
+
 MAKE_SCHEME_CALLBACK (Text_interface, interpret_string, 3);
 SCM
 Text_interface::interpret_string (SCM layout_smob,
@@ -31,6 +39,8 @@ Text_interface::interpret_string (SCM layout_smob,
   string str = ly_scm2string (markup);
   Output_def *layout = unsmob_output_def (layout_smob);
   Font_metric *fm = select_encoded_font (layout, props);
+
+  replace_whitespace (&str);
   return fm->word_stencil (str).smobbed_copy ();
 }