]> git.donarmstrong.com Git - lilypond.git/commitdiff
Implement \eyeglasses as markup command
authorReinhold Kainhofer <reinhold@kainhofer.com>
Fri, 30 Jan 2009 20:30:24 +0000 (21:30 +0100)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Sun, 8 Mar 2009 00:33:35 +0000 (01:33 +0100)
-) implement \eyeglasses as markup command, using the postscript stored
   in the eyeglassesps variable
-) Use this markup command in musicxml2ly, too
-) Add regtest for \eyeglasses (in a \markup and as a markup attached to
   a note)
-) Remove the eyeglasses example from the postscript command and
   replace it by two rings (the stereo symbol) written in postscript

Documentation/topdocs/NEWS.tely
input/regression/markup-eyeglasses.ly [new file with mode: 0644]
scm/define-markup-commands.scm
scripts/musicxml2ly.py

index 99089a1782208374477e5aa17212fc91c7e2c6d2..cc07cd31a4018dc9050b819e351bbbf0f9256247 100644 (file)
@@ -62,6 +62,15 @@ which scares away people.
 
 @end ignore
 
+@item An eyeglasses markup was added, incidating strongly to look at the 
+conductor for instructions:
+@lilypond[quote]
+\relative c'' {
+  \mark \markup {\eyeglasses}
+  c4_\markup{\eyeglasses}
+}
+@end lilypond
+
 @item
 A snap-pizzicato (also known as Bartok-pizzicato) articulation was added:
 @lilypond[quote]
diff --git a/input/regression/markup-eyeglasses.ly b/input/regression/markup-eyeglasses.ly
new file mode 100644 (file)
index 0000000..6b47237
--- /dev/null
@@ -0,0 +1,6 @@
+\header {
+  texidoc = "The eyeglasses markup function prints out eyeglasses."
+}
+\version "2.12.3"
+
+\relative c'' { \mark \markup{ \eyeglasses } c4_\markup{ \eyeglasses } }
index 9b5c5c5c82ac75bfb74b7994ff06b40c7a2ee9cf..e9537744660d4b3623341c44f27c1b716f834d4b 100644 (file)
@@ -470,34 +470,23 @@ This inserts @var{str} directly into the output as a PostScript
 command string.
 
 @lilypond[verbatim,quote]
-eyeglassesps = #\"
+ringsps = #\"
   0.15 setlinewidth
-  -0.9 0 translate
-  1.1 1.1 scale
-  1.2 0.7 moveto
-  0.7 0.7 0.5 0 361 arc
+  0.9 0.6 moveto
+  0.4 0.6 0.5 0 361 arc
   stroke
-  2.20 0.70 0.50 0 361 arc
+  1.0 0.6 0.5 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
+rings = \\markup {
+  \\with-dimensions #'(-0.2 . 1.6) #'(0 . 1.2)
+  \\postscript #ringsps
 }
 
 \\relative c'' {
-  c2^\\eyeglasses
-  a2_\\eyeglasses
+  c2^\\rings
+  a2_\\rings
 }
 @end lilypond"
   ;; FIXME
@@ -2579,6 +2568,36 @@ figured bass notation.
 @end lilypond"
   (slashed-digit-internal layout props num #f font-size thickness))
 
+;; eyeglasses
+(define eyeglassesps 
+     "0.15 setlinewidth
+      -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")
+
+(define-builtin-markup-command (eyeglasses layout props) () other ()
+  "Prints out eyeglasses, indicating strongly to look at the conductor.
+@lilypond[verbatim,quote]
+\\markup { \\eyeglasses }
+@end lilypond"
+  (interpret-markup layout props
+    (make-with-dimensions-markup '(-0.55 . 2.9) '(0.4 . 2.4)
+      (make-postscript-markup eyeglassesps))))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; the note command.
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
index b8e11f7233bd3b13a4404a9e53081091cbde917a..52e697148786be8a306b4a50bd964bacfbd86e10 100644 (file)
@@ -45,26 +45,6 @@ def error_message (str):
 needed_additional_definitions = []
 additional_definitions = {
 
-  "eyeglasses": """eyeglassesps = #"0.15 setlinewidth
-      -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 }""",
-
   "tuplet-note-wrapper": """      % a formatter function, which is simply a wrapper around an existing 
       % tuplet formatter function. It takes the value returned by the given
       % function and appends a note of given length. 
@@ -1431,7 +1411,7 @@ def musicxml_harp_pedals_to_ly (mxl_event):
 
 def musicxml_eyeglasses_to_ly (mxl_event):
     needed_additional_definitions.append ("eyeglasses")
-    return musicexp.MarkEvent ("\\eyeglasses")
+    return musicexp.MarkEvent ("\\markup { \\eyeglasses }")
 
 def next_non_hash_index (lst, pos):
     pos += 1