Hello Paolo, If you want you can also do something like this to make separately overriding those things easier.
Cheers, Valentin Am Samstag, 20. November 2021, 12:50:11 CET schrieb Paolo Prete: > On Sat, Nov 20, 2021 at 12:48 PM Valentin Petzel <[email protected]> wrote: > > Hello Paolo, > > > > The quick way would be to simply do > > > > dashDash = \tweak font-size #2 \tenuto > > > > The systematic way would be applying these tweaks by type. The method > > linked > > by Kieren is a bit problematic in my opinion, as it applies these tweaks > > after > > the grob is generated. This means that this ignores any further tweaks and > > overrides, also it means that if we ever want to use before-line-breaking > > for > > something else we need to mind that we are using it here. > > I agree, thanks Valentin!
%%% SNIPPET BEGINS
%%% if proc is a procedure evaluate (proc grob), else return proc as value
#(define (eval-if-proc proc grob)
(if (procedure? proc)
(proc grob)
proc))
%%% retrieves overrides from grob.details.path.key where key is some key function or else from
%%% grob.path.default or default parameter if not exists
#(define ((override-by-details tag path . default) grob)
(let* ((key (tag grob))
(tweak (ly:assoc-get key (ly:assoc-get path (ly:grob-property grob 'details) '()) 'pass))
(default (ly:assoc-get 'default
(ly:assoc-get path (ly:grob-property grob 'details) '())
(if (null? default) default (car default)))))
(if (equal? tweak 'pass) default tweak)))
%%% articulation type as tag
#(define (articulation-type grob)
(string->symbol (ly:prob-property (ly:grob-property grob 'cause) 'articulation-type)))
\layout {
\context {
\Score
\override Script.font-size = #(override-by-details articulation-type 'font-size)
\override Script.color = #(override-by-details articulation-type 'color)
% This override is only nescessary as somehow if font-size is a procedure it is not evaluated automatically,
% so we need to manually call (ly:grob-property grob 'font-size) once.
\override Script.stencil = #(lambda (grob)
(ly:grob-property grob 'font-size)
(ly:script-interface::print grob))
}
}
\score
{
{
\textLengthOn
\override Script.details.font-size.tenuto = #2
\override Script.details.font-size.accent = #-5
\override Script.details.color.tenuto = #red
\override Script.details.color.marcato = #blue
c'4->^"-5" c'4--^"+2,red" c'4-\tweak #'font-size #-2 -- ^"manual tweak -2" c'-^^"blue" c'-\tweak #'color #green -^^"manual tweak green"
s4*3 |
c'8-- c'-> c'-! c'-^
\temporary\override Script.details.font-size.default = #4
c'8-- c'-> c'-! c'-^
\temporary\override Script.details.color.default = #yellow
c'8-- c'-> c'-! c'-^
\revert Script.details.font-size.default
\revert Script.details.color.default
c'8-- c'-> c'-! c'-^
\override Script.details.color.tenuto = #green
c'8-- c'-> c'-! c'-^
}
}
%%% SNIPPET ENDS
signature.asc
Description: This is a digitally signed message part.
