lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Deprecate \fermataMarkup for full-bar rests. (issue4672059)


From: n . puttock
Subject: Deprecate \fermataMarkup for full-bar rests. (issue4672059)
Date: Sun, 07 Aug 2011 15:24:42 +0000

Reviewers: ,

Message:
Hi,

I've always been a bit annoyed by this, so I though it would be a nice
enhancement to allow scripts to work on full-bar rests just like
ordinary markup.

The syntax constructor already makes a half-hearted attempt to add
scripts, but fails in trying to set the 'text property, since it doesn't
extract the useful information from an ArticulationEvent.  By accessing
all-script-definitions, it now caters for all types of fermata without
having to define them manually:

{
  R1\fermata
  R1\longfermata
}

As an added bonus, \displayLilyMusic works properly with the above,
whereas the original \fermataMarkup caused it to crash.

Cheers,
Neil


Description:
Deprecate \fermataMarkup for full-bar rests.

Please review this at http://codereview.appspot.com/4672059/

Affected files:
  M ly/property-init.ly
  M scm/ly-syntax-constructors.scm


Index: ly/property-init.ly
diff --git a/ly/property-init.ly b/ly/property-init.ly
index 0175bb798fe405134afd05236f81f182001af729..176ade98eb1508ce55edb44e8d8aae0ba419bfe5 100644
--- a/ly/property-init.ly
+++ b/ly/property-init.ly
@@ -186,16 +186,7 @@ endincipit = \context Staff {

 %% fermata markup

-fermataMarkup =
-#(make-music 'MultiMeasureTextEvent
-             'tweaks (list
-                      ;; Set the 'text based on the 'direction
-                      (cons 'text (lambda (grob)
- (if (eq? (ly:grob-property grob 'direction) DOWN) - (markup #:musicglyph "scripts.dfermata") - (markup #:musicglyph "scripts.ufermata"))))
-                      (cons 'outside-staff-priority 40)
-                      (cons 'outside-staff-padding 0)))
+fermataMarkup = \fermata

 %% font sizes

Index: scm/ly-syntax-constructors.scm
diff --git a/scm/ly-syntax-constructors.scm b/scm/ly-syntax-constructors.scm
index 171cee12407e8bbb2ebf1f0c87b25d3ed3e0ce3f..d6e915957637795263cb77086070f03b4f7fab78 100644
--- a/scm/ly-syntax-constructors.scm
+++ b/scm/ly-syntax-constructors.scm
@@ -126,17 +126,37 @@
   (make-repeat type num body alts))

 (define (script-to-mmrest-text music)
- "Extract @code{'direction} and @code{'text} from @var{music}, and transform
-into a @code{MultiMeasureTextEvent}."
-
-  (if (memq 'script-event (ly:music-property music 'types))
+ "Extract @code{TextScriptEvent} and @code{ArticulationEvent} from @var{music}
+ and transform into @code{MultiMeasureTextEvent}s."
+  (if (music-has-type music 'script-event)
       (let* ((location (ly:music-property music 'origin))
             (dir (ly:music-property music 'direction))
             (tags (ly:music-property music 'tags))
+            (tweaks (ly:music-property music 'tweaks))
+            (text (cond
+                   ((music-has-type music 'text-script-event)
+                    (ly:music-property music 'text))
+                   ((music-has-type music 'articulation-event)
+                    (let* ((script (assoc-get
+                                    (ly:music-property music 
'articulation-type)
+                                    default-script-alist))
+                           (stencil-names (cdr (assoc-get 'script-stencil 
script))))
+                      (set! tweaks
+                            (append (list
+                                     (cons 'outside-staff-priority 40)
+                                     (cons 'outside-staff-padding 0))
+                                    tweaks))
+                      (make-musicglyph-markup
+                       (string-append "scripts."
+                                      (if (ly:dir? dir)
+                                          (index-cell stencil-names dir)
+                                          (cdr stencil-names))))))))
             (p (make-music 'MultiMeasureTextEvent
                            'origin location
                            'tags tags
-                           'text (ly:music-property music 'text))))
+                           'tweaks tweaks
+                           'text text)))
+
        (if (ly:dir? dir)
            (set! (ly:music-property p 'direction) dir))
        p)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]