]> git.donarmstrong.com Git - lilypond.git/blobdiff - scripts/midi2ly.py
Add '-dcrop' option to ps and svg backends
[lilypond.git] / scripts / midi2ly.py
index 3a29f9aaa1cebe66db1b3c16b770dd7a866b9b58..9c490a5f2caf95bd737fee5046878054f69ab364 100644 (file)
@@ -382,12 +382,21 @@ class Text:
         'INSTRUMENT_NAME',
         'LYRIC',
         'MARKER',
-        'CUE_POINT',)
+        'CUE_POINT',
+        'PROGRAM_NAME',
+        'DEVICE_NAME', )
+
+    @staticmethod
+    def _text_only(chr):
+        if ((' ' <= chr <= '~') or chr in ['\n','\r']):
+            return chr
+        else: 
+            return '~'
 
     def __init__ (self, type, text):
         self.clocks = 0
         self.type = type
-        self.text = text
+        self.text =''.join(map(self._text_only, text))
 
     def dump (self):
         # urg, we should be sure that we're in a lyrics staff