Malte Meyn wrote:
How can this made be top- or bottom-aligned (or aligned depending
according to the 'direction property)?
Inside a #(define-markup-command (command-name layout props arg1 arg2 …)
you can collect 'direction as follows:
(let* ((dir-prop (chain-assoc-get 'direction props 1)))
P. S.: I tried Scheme syntax for the markups in the code above but
#(markup #:concat #:general-align Y UP ("16" #:teeny "ma"))
doesn’t work. What am I doing wrong?
Well, you get the error:
warning: cannot find property type-check for `ottavationMarkups'
It seems that 2.21.0 doesn't know about ottavaText either.
So, referring to
https://lists.gnu.org/archive/html/lilypond-user/2017-02/msg00406.html
you could try
- including Harm's code from there (see attachment)
- renaming ottavationMarkups to ottavaText
Cheers,
Robin
% Harm's ottavation code, lifted from
% https://lists.gnu.org/archive/html/lilypond-user/2017-02/msg00406.html
\version "2.19.52"
%% Define new context-property 'ottavaText'
#(define (define-translator-property symbol type? description)
(if (not (and (symbol? symbol)
(procedure? type?)
(string? description)))
(ly:error "error in call of define-translator-property"))
(if (not (equal? (object-property symbol 'translation-doc) #f))
(ly:error (_ "symbol ~S redefined") symbol))
(set-object-property! symbol 'translation-type? type?)
(set-object-property! symbol 'translation-doc description)
symbol)
#(for-each
(lambda (x)
(apply define-translator-property x))
`((ottavaText
,list?
"An alist of pairs with ottavation-number and markup.")))
%% Redefine 'make-ottava-set'
#(define (make-ottava-set music)
"Set context properties for an ottava bracket."
(let ((octavation (ly:music-property music 'ottava-number))
(labels
'((2 . "15ma")
(1 . "8va")
(0 . #f)
(-1 . "8vb")
(-2 . "15mb"))))
(list (context-spec-music
(make-apply-context
(lambda (context)
(let* ((offset (* -7 octavation))
(ctx-label-list
(ly:context-property context 'ottavaText))
(string
(assoc-get octavation
(if (null? ctx-label-list)
labels
ctx-label-list))))
(set! (ly:context-property context 'middleCOffset) offset)
(set! (ly:context-property context 'ottavation) string)
(ly:set-middle-C! context))))
'Staff))))
%% Redefine 'ottava'
ottava =
#(define-music-function (octave) (integer?)
(_i "Set the octavation.")
(make-music 'OttavaMusic
'elements-callback make-ottava-set
'ottava-number octave))
%%%%%%%%%%%%%%%%%%%%%
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user