Reviewers: ,
https://codereview.appspot.com/568970043/diff/551000043/scm/define-music-callbacks.scm
File scm/define-music-callbacks.scm (right):
https://codereview.appspot.com/568970043/diff/551000043/scm/define-music-callbacks.scm#newcode87
scm/define-music-callbacks.scm:87: (ly:warning "Could not find
ottavation markup for ~a octaves up." octavation))
Has this to be made translatable? If so, how? I didn’t really understand
the CG here. IIUC, I just could write (ly:warning (_ "Could not find …
~a octaves up") octavation) but that might be wrong. Would I have to add
translations or translation placeholders?
Description:
Add user-definable ottavation markups
The context property ottavationMarkups is an alist containing markups
for different octaves. Entries 22ma, 29ma, 22mb, and 29mb were added.
There is a warning when \ottava uses a number of octaves that has no
corresponding markup (alist entry).
Contains regtest
Please review this at https://codereview.appspot.com/568970043/
Affected files (+49, -7 lines):
A input/regression/ottavation-markups.ly
M ly/engraver-init.ly
M scm/define-context-properties.scm
M scm/define-music-callbacks.scm
Index: input/regression/ottavation-markups.ly
diff --git a/input/regression/ottavation-markups.ly
b/input/regression/ottavation-markups.ly
new file mode 100644
index
0000000000000000000000000000000000000000..ae7e60710e3ee5ed9eaf343e237d0da3dac72a12
--- /dev/null
+++ b/input/regression/ottavation-markups.ly
@@ -0,0 +1,30 @@
+\version "2.21.0"
+
+\header {
+ texidoc = "Ottavation markups can be changed by the user.
+LilyPond warns about missing markups (in this example for
++3 and -3 octaves)."
+}
+
+{
+ \set Staff.ottavationMarkups =
+ #`(( 2 . ,#{ \markup \concat \general-align #Y #UP { "16" \teeny "ma" }
#})
+ ( 1 . ,#{ \markup \concat \general-align #Y #UP { "8" \teeny "va" }
#})
+ (-1 . ,#{ \markup \concat { "8" \teeny "va bassa" } #})
+ (-2 . ,#{ \markup \concat { "16" \teeny "ma bassa" } #}))
+ c''4 4 4 4
+ \ottava 1
+ c'''4 4 4 4
+ \ottava 2
+ c''''4 4 4 4
+ \ottava 3
+ c'''''4 4 4 4
+ \ottava -1
+ c'4 4 4 4
+ \ottava -2
+ c4 4 4 4
+ \ottava -3
+ c,4 4 4 4
+ \ottava 0
+ c''4 4 4 4
+}
Index: ly/engraver-init.ly
diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly
index
52bf183bbc2a48e24d43961f9a8f803285f6879a..a6c50d703e9bc881687366c4d52ec66e012d5fc3
100644
--- a/ly/engraver-init.ly
+++ b/ly/engraver-init.ly
@@ -104,6 +104,15 @@
\description "Handles clefs, bar lines, keys, accidentals. It can
contain
@code{Voice} contexts."
+ ottavationMarkups =
+ #'((4 . "29ma")
+ (3 . "22ma")
+ (2 . "15ma")
+ (1 . "8va")
+ (-1 . "8vb")
+ (-2 . "15mb")
+ (-3 . "22mb")
+ (-4 . "29mb"))
}
\context {
Index: scm/define-context-properties.scm
diff --git a/scm/define-context-properties.scm
b/scm/define-context-properties.scm
index
a5fe725a4136f2f70dcf71b2bf9ca92cfd7cd8b7..120e260e9fbeced8f1a1a07778b15efb5dac5c58
100644
--- a/scm/define-context-properties.scm
+++ b/scm/define-context-properties.scm
@@ -498,6 +498,9 @@ 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.")
+ (ottavationMarkups ,list? "An alist defining the markups used
+for ottava brackets. It contains entrys of the form
+@code{(@var{number of octaves} . @var{markup})}.")
(output ,ly:music-output? "The output produced by a score-level
translator during music interpretation.")
Index: scm/define-music-callbacks.scm
diff --git a/scm/define-music-callbacks.scm b/scm/define-music-callbacks.scm
index
459cb2cdf34bd1725a67b702875ceb0c74c03a0f..be0810ae50473006d072d2be4de063019d8d8582
100644
--- a/scm/define-music-callbacks.scm
+++ b/scm/define-music-callbacks.scm
@@ -77,14 +77,14 @@ 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))
+ (markups (ly:context-property
context 'ottavationMarkups))
+ (ottavation-markup (assoc-get octavation markups)))
(set! (ly:context-property context 'middleCOffset) offset)
- (set! (ly:context-property context 'ottavation) string)
+ (set! (ly:context-property context 'ottavation)
ottavation-markup)
+ (if (and (not (zero? octavation))
+ (not (markup? ottavation-markup)))
+ (ly:warning "Could not find ottavation markup for ~a
octaves up." octavation))
(ly:set-middle-C! context))))
'Staff))))
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel