]> git.donarmstrong.com Git - lilypond.git/commitdiff
format-metronome-mark and metronome-markup don't support styles other than default
authorThomas Morley <thomasmorley65@gmail.com>
Wed, 16 Oct 2013 19:39:57 +0000 (21:39 +0200)
committerThomas Morley <thomasmorley65@gmail.com>
Tue, 29 Oct 2013 19:05:54 +0000 (20:05 +0100)
issue 3096

- introducing 'styled-metronome-markup' with the (currently quite
theoretical) possibility to use another font here. For now
the font-argument is used only to make
  \override MetronomeMark #'font-name = ...
possible.

- adding 'flag-style to define-grob-properties.scm, the
MetronomeMark-properties in define-grobs.scm and in text-interface.cc

- adding a regtest for different 'metronomeMarkFormatter'.

It's now possible to override MetronomeMark with 'style, 'flag-style and
'font-name to customize the appearance.

input/regression/metronome-mark-formatter.ly [new file with mode: 0644]
lily/text-interface.cc
scm/define-grob-properties.scm
scm/define-grobs.scm
scm/translation-functions.scm

diff --git a/input/regression/metronome-mark-formatter.ly b/input/regression/metronome-mark-formatter.ly
new file mode 100644 (file)
index 0000000..480429f
--- /dev/null
@@ -0,0 +1,108 @@
+\version "2.17.27"
+
+\header {
+  texidoc = "@code{metronomeMarkFormatter} supports
+all note head styles and flags styles. Setting @code{font-name} for
+@code{MetronomeMark} does not disturb the glyphs for note-head and flag.
+"
+}
+
+\paper {
+        ragged-right = ##f
+        indent = 30
+}
+
+mus =
+\relative c'' {
+        \tempo "Allegro" 8=120-140
+        a8 b c d a b c d
+        \override Score.MetronomeMark.font-name = "Times New Roman"
+        \tempo "Allegro" 8=140
+        a b c d a b c d
+}
+
+%% Some Examples:
+\score {
+  \new Staff
+  \with {
+          instrumentName = "default"
+  }
+  \mus
+  \layout {}
+}
+
+\score {
+  \new Staff
+  \with {
+          instrumentName =
+            \markup \column { "default-note-head" "old-straight-flag" }
+  }
+  \mus
+  \layout {
+    \context {
+      \Score
+      \override MetronomeMark.flag-style = #'old-straight-flag
+    }
+  }
+}
+
+\score {
+  \new Staff
+  \with {
+          instrumentName =
+            \markup \column { "default-note-head" "modern-straight-flag" }
+  }
+  \mus
+  \layout {
+    \context {
+      \Score
+      \override MetronomeMark.flag-style = #'modern-straight-flag
+    }
+  }
+}
+
+\score {
+  \new Staff
+  \with {
+          instrumentName =
+            \markup \column { "default-note-head" "flat-flag" }
+  }
+  \mus
+  \layout {
+    \context {
+      \Score
+      \override MetronomeMark.flag-style = #'flat-flag
+    }
+  }
+}
+
+\score {
+  \new Staff
+  \with {
+          instrumentName =
+            \markup \column { "diamond-note-head" "modern-straight-flag" }
+  }
+  \mus
+  \layout {
+    \context {
+      \Score
+      \override MetronomeMark.style = #'diamond
+      \override MetronomeMark.flag-style = #'modern-straight-flag
+    }
+  }
+}
+
+\score {
+  \new MensuralStaff
+  \with {
+          instrumentName =
+            \markup \column { "mensural-note-head" "mensural-flag" }
+  }
+  \mus
+  \layout {
+    \context {
+      \Score
+      \override MetronomeMark.style = #'mensural
+    }
+  }
+}
index c406beaab5436a9a053883651ff02d1b5364ed87..936a7488e2810a001e42c8b87896e35c1a12f202 100644 (file)
@@ -207,5 +207,6 @@ ADD_INTERFACE (Text_interface,
                "text "
                "word-space "
                "text-direction "
+               "flag-style "
               );
 
index 00cbaeb55c67c33cce65e628a8a07050c10f02d9..a5b0895c9bbfea3ccc2e23d9bfa26204d6c82e54 100644 (file)
@@ -283,6 +283,10 @@ set this to @code{(+inf.0 . -inf.0)}.")
 ;;; f
 ;;;
      (flag-count ,number? "The number of tremolo beams.")
+     (flag-style ,symbol? "The style of the flag to be used with
+@code{MetronomeMark}. Available are @code{'modern-straight-flag},
+@code{'old-straight-flag}, @code{flat-flag}, @code{mensural} and
+@code{'default}")
      (flat-positions ,list? "Flats in key signatures are placed
 within the specified ranges of staff-positions.  The general form
 is a list of pairs, with one pair for each type of clef, in order
index b415cee9d61cfcd304b4318dd60ed453b35505d8..a4e0d52a760b45a237b12438cae84932586fbd1f 100644 (file)
         (break-visibility . ,end-of-line-invisible)
         (direction . ,UP)
         (extra-spacing-width . (+inf.0 . -inf.0))
+        (flag-style . default)
         (outside-staff-horizontal-padding . 0.2)
         (outside-staff-priority . 1000)
         (padding . 0.8)
index 9bc12cc53c170745b4c5011cfb3b72b059a4d6e9..fa3426ff0a42658aeb5a0d1640fe24234096149b 100644 (file)
@@ -38,33 +38,53 @@ way the transposition number is displayed."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; metronome marks
 
-(define-public (format-metronome-markup event context)
-  (let ((hide-note (ly:context-property context 'tempoHideNote #f))
-        (text (ly:event-property event 'text))
-        (dur (ly:event-property event 'tempo-unit))
-        (count (ly:event-property event 'metronome-count)))
-
-    (metronome-markup text dur count hide-note)))
-
-(define-public (metronome-markup text dur count hide-note)
-  (let* ((note-mark (if (and (not hide-note) (ly:duration? dur))
-                        (make-smaller-markup
-                         (make-note-by-number-markup (ly:duration-log dur)
-                                                     (ly:duration-dot-count dur)
-                                                     1))
-                        #f))
+;; We give 'styled-metronome-markup' an optional argument, 'glyph-font', to
+;; prepare using other fonts than 'fetaMusic.
+;; Currently it ensures that the default-fonts are used by the
+;; markup-command 'note-by-number' in 'metronome-markup' (see below).
+(define*-public
+  ((styled-metronome-markup #:optional (glyph-font 'default))
+                            event context)
+   (let ((hide-note (ly:context-property context 'tempoHideNote #f))
+         (text (ly:event-property event 'text))
+         (dur (ly:event-property event 'tempo-unit))
+         (count (ly:event-property event 'metronome-count)))
+
+   (metronome-markup glyph-font text dur count hide-note)))
+
+(define-public format-metronome-markup
+  (styled-metronome-markup))
+
+(define (metronome-markup glyph-font text dur count hide-note)
+  (let* ((note-mark
+            (if (and (not hide-note) (ly:duration? dur))
+                (make-smaller-markup
+                   ;; We insert the (default)-font for flag-glyphs and
+                   ;; note-head-glyphs to prepare the possibility to use
+                   ;; other fonts and to make possible using
+                   ;; \override MetronomeMark #'font-name = #<font-name>
+                   ;; without affecting the note/flag-glyphs.
+                   (make-override-markup (cons 'font-name glyph-font)
+                    (make-note-by-number-markup
+                        (ly:duration-log dur)
+                        (ly:duration-dot-count dur)
+                        UP)))
+                      #f))
          (count-markup (cond ((number? count)
                               (if (> count 0)
-                                  (make-simple-markup (number->string count))
+                                  (make-simple-markup
+                                          (number->string count))
                                   #f))
                              ((pair? count)
                               (make-concat-markup
                                (list
-                                (make-simple-markup (number->string (car count)))
+                                (make-simple-markup
+                                        (number->string (car count)))
                                 (make-simple-markup " ")
                                 (make-simple-markup "–")
                                 (make-simple-markup " ")
-                                (make-simple-markup (number->string (cdr count))))))
+                                (make-simple-markup
+                                        (number->string (cdr count))))))
                              (else #f)))
          (note-markup (if (and (not hide-note) count-markup)
                           (make-concat-markup