]> git.donarmstrong.com Git - lilypond.git/commitdiff
MusicXML: Convert <eyeglasses> to lilypond
authorReinhold Kainhofer <reinhold@kainhofer.com>
Fri, 4 Apr 2008 17:39:44 +0000 (19:39 +0200)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Fri, 4 Apr 2008 17:39:44 +0000 (19:39 +0200)
Lilypond does not have its own eyeglasses articulation, but one can simply
draw it in postscript and insert that in musicxml2ly...

scripts/musicxml2ly.py

index e8ae92c2196875e686b41b7f50cc5c60d8aad72e..155697ff3af787b6ec5386b8c46a2da2ce7b0a3d 100644 (file)
@@ -52,14 +52,28 @@ additional_definitions = {
           (make-circle-stencil 0.7 0.1 #f)
           (ly:make-stencil
             (list 'draw-line 0.1 0 0.1 0 1)
-            '(-0.1 . 0.1) '(0.1 . 1)
-          )
-        )
-        0.7 X
-      )
-    )
-  )
-)"""
+            '(-0.1 . 0.1) '(0.1 . 1)))
+        0.7 X))))""",
+  "eyeglasses": """eyeglassesps = #"0.15 setlinewidth
+% 255 0 0 setrgbcolor
+-0.9 0 translate
+1.1 1.1 scale
+1.2 0.7 moveto
+0.7 0.7 0.5 0 361 arc
+stroke
+2.20 0.70 0.50 0 361 arc
+stroke
+1.45 0.85 0.30 0 180 arc
+stroke
+0.20 0.70 moveto
+0.80 2.00 lineto
+0.92 2.26 1.30 2.40 1.15 1.70 curveto
+stroke
+2.70 0.70 moveto
+3.30 2.00 lineto
+3.42 2.26 3.80 2.40 3.65 1.70 curveto
+stroke"
+eyeglasses =  \markup { \with-dimensions #'(0 . 4.4) #'(0 . 2.5) \postscript #eyeglassesps }"""
 }
 
 def round_to_two_digits (val):
@@ -1144,6 +1158,10 @@ def musicxml_rehearsal_to_ly_mark (mxl_event):
     ev = musicexp.MarkEvent ("\\markup { %s }" % text)
     return ev
 
+def musicxml_eyeglasses_to_ly (mxl_event):
+    needed_additional_definitions.append ("eyeglasses")
+    return musicexp.MarkEvent ("\\eyeglasses")
+
 # translate directions into Events, possible values:
 #   -) string  (MarkEvent with that command)
 #   -) function (function(mxl_event) needs to return a full Event-derived object
@@ -1153,7 +1171,7 @@ directions_dict = {
     'coda' : (musicexp.MusicGlyphMarkEvent, "coda"),
 #     'damp' : ???
 #     'damp-all' : ???
-#     'eyeglasses': ??????
+    'eyeglasses': musicxml_eyeglasses_to_ly,
 #     'harp-pedals' : 
 #     'image' : 
 #     'metronome' :