2013/7/3 Thomas Morley <thomasmorle...@gmail.com>: > 2013/7/3 Kieren MacMillan <kieren_macmil...@sympatico.ca>: >> Hi all, >> >> I want to redefine the way certain Script grobs are padded, independently — >> e.g., I might want >> >> staccato.padding = #0.5 >> tenuto.padding = #0.6 >> fermata.padding = #1.1 >> etc. >> >> Is there an elegant way of doing this? >> >> Thanks, >> Kieren. >> _______________________________________________ >> lilypond-user mailing list >> lilypond-user@gnu.org >> https://lists.gnu.org/mailman/listinfo/lilypond-user > > Hi Kieran, > > sometime ago David Nalesnik and I were working on it. > Originally, it was 2.14.2-code but still works with 2.17.21. > > \version "2.17.21" > > #(define ((custom-script-tweaks ls) grob) > (let* ((type (ly:prob-property (assoc-ref (ly:grob-properties grob) > 'cause) 'articulation-type)) > (tweaks (assoc-ref ls type))) > (if tweaks > (for-each (lambda (x) (ly:grob-set-property! grob (car x) > (cdr x))) tweaks) > '()))) > > % Examples: > > #(define ls-1 '( > ("staccato" . ((color . (0 1 0))(padding . 0.5))) > ("accent" . ((font-size . 4)(color . (1 0 0)))) > ("tenuto" . ((rotation . (45 0 0)) (padding . 2)(font-size . 10))) > ("staccatissimo" . ((padding . -10) (color . (0 0 1)))) > )) > > #(define ls-2 '( > ("staccato" . ((color . (0 1 0)))) > ("accent" . ((font-size . 4)(color . (0 1 0))(padding . 1.5))) > ("tenuto" . ((rotation . (-45 0 0)) (padding . 2)(font-size . 10))) > > ("staccatissimo" . ((padding . -10) (color . (0 0 1)))) > ("coda" . ((color . (0 0 1)))) > )) > > % Kieran's list: > #(define ls-3 '( > ("staccato" . ((padding . 0.5))) > ("tenuto" . ((padding . 0.6))) > ("fermata" . ((padding . 1.1))) > )) > > > one = > \relative c'' { > f1-- > f1-- > \override Voice.Script #'before-line-breaking = #(custom-script-tweaks > ls-1) > f-. f-| f-> f-> f-- f-| > \revert Script #'before-line-breaking > f-> f-. > } > > two = > \relative c' { > f1---> > f1-- > \override Voice.Script #'before-line-breaking = #(custom-script-tweaks > ls-2) > f-. f-| f-> f-> f---> f-| > %\revert Script #'before-line-breaking > f-> f-.\coda > } > > three = > \relative c' { > \override Voice.Script #'before-line-breaking = #(custom-script-tweaks > ls-3) > f1-. f-. f\fermata f \bar "||" > \revert Script #'before-line-breaking > <>^\markup "reverted" > f1-. f-. f\fermata f > } > > > > \new Staff << > \new Voice { \voiceOne \one } > \new Voice { \voiceTwo \two } > >> > > \new Staff = "Kieran" \three > > > > HTH, > Harm
Hi Kieren, sorry having misread and misspelled your name. Please accept my apologies. Seems I need a pair of glasses. -Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user