From dfa574353db72775a028f172da6f5c5009c5f69d Mon Sep 17 00:00:00 2001 From: Thomas Morley Date: Tue, 28 Feb 2017 18:48:27 +0000 Subject: [PATCH] Introduce context-property ottavaText --- ly/engraver-init.ly | 7 +++++++ scm/define-context-properties.scm | 2 ++ scm/define-music-callbacks.scm | 13 +++++++------ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 693f9eb..41665df 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -768,6 +768,13 @@ automatically when an output definition (a @code{\\score} or topLevelAlignment = ##t timing = ##t + + ottavaText = + #'((2 . "15ma") + (1 . "8va") + (0 . #f) + (-1 . "8vb") + (-2 . "15mb")) } diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index 75f1807..dd362fe 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -494,6 +494,8 @@ any effect the note would have had on accidentals in other voices.") (ottavation ,markup? "If set, the text for an ottava spanner. Changing this creates a new text spanner.") + (ottavaText ,list? "An alist containing pairs of ottava-number and markup. +Used to get the text for @code{OttavaBracket}.") (output ,ly:music-output? "The output produced by a score-level translator during music interpretation.") diff --git a/scm/define-music-callbacks.scm b/scm/define-music-callbacks.scm index 5cc1db1..d8150cb 100644 --- a/scm/define-music-callbacks.scm +++ b/scm/define-music-callbacks.scm @@ -77,12 +77,13 @@ to be used by the sequential-iterator" (list (context-spec-music (make-apply-context (lambda (context) - (let ((offset (* -7 octavation)) - (string (assoc-get octavation '((2 . "15ma") - (1 . "8va") - (0 . #f) - (-1 . "8vb") - (-2 . "15mb"))))) + (let* ((offset (* -7 octavation)) + (ottava-label-list + (ly:context-property context 'ottavaText)) + (string + (if (pair? ottava-label-list) + (assoc-get octavation ottava-label-list) + #f))) (set! (ly:context-property context 'middleCOffset) offset) (set! (ly:context-property context 'ottavation) string) (ly:set-middle-C! context)))) -- 2.1.4