Drat. I can't get anything right today. Yes that's a personal scheme library for formatting diagnostic print output. I try to purge this stuff before posting but I have failed miserably. Below is the public MWE I meant to send.
Andrew -----Original Message----- From: Simon Albrecht [mailto:[email protected]] Sent: Saturday, 12 November 2016 9:05 PM To: Andrew Bernard <[email protected]>; [email protected] Subject: Re: Pedal cautionary continuations and other bracket decorations Hi Andrew, On 12.11.2016 04:19, Andrew Bernard wrote: > > \include "scheme.ily" > That seems to be a library file of your own, isnt it? > #(use-modules (srfi srfi-1)) > You neednt explicitly load that one, IIRC its available by default in LilyPond. Best, Simon == snip \version "2.19.50" #(define (make-arrow-path arrow-length arrowhead-height arrowhead-width) "Arrow with triangular arrowhead." (list 'moveto 0 0 'lineto arrow-length 0 'lineto arrow-length (/ arrowhead-width 2) 'lineto (+ arrow-length arrowhead-height) 0 'lineto arrow-length (- (/ arrowhead-width 2)) 'lineto arrow-length 0 'closepath )) pedalWithArrowsAndText = \override Score.PianoPedalBracket.after-line-breaking = #(lambda (grob) ;; function to modify the individual grob part (define add-decorations (lambda (g list-length) (let* ( ;; unpack the argument (index (car g)) (grobber (cadr g)) (last (= index list-length)) ;; Get the default-stencil and its x-dimension and x-length. (stil (ly:piano-pedal-bracket::print grobber)) (stil-x-extent (ly:stencil-extent stil X)) (stil-x-length (interval-length stil-x-extent)) ;; make arrow for the rhs end (thickness 0.1) (arrowhead-height 1.0) (arrowhead-width 1.0) (arrow-length 1.0) (arrow (make-path-stencil (make-arrow-path arrow-length arrowhead-height arrowhead-width) thickness 1 1 #t)) (new-stil (if (not last) (ly:stencil-combine-at-edge stil X RIGHT arrow -2) stil)) ;; make text for the lhs end (text-stil (grob-interpret-markup grobber (markup #:line (#:abs-fontsize 6 (#:sans (#:upright (#:whiteout (#:box (#:pad-markup 0.3 "½ ped"))))))))) (new-stil (ly:stencil-stack new-stil X LEFT text-stil -6))) (ly:grob-set-property! grobber 'stencil new-stil)))) (let* ( (stil (ly:piano-pedal-bracket::print grob)) (orig (ly:grob-original grob)) (pieces (if (ly:grob? orig) (ly:spanner-broken-into orig) '())) (pieces-indexed-list (zip (iota (length pieces) 1) pieces)) (pieces-length (length pieces))) ;; We want arrows on all segments but the last, and text on all segments, so ;; we have to pass some notion of list index to the function doing the ;; decorating. Hence the ziplist combining grob segment and index in pairs. (let loop ((x 1) (count 0)) (if (< count pieces-length) (begin (add-decorations (list-ref pieces-indexed-list count) pieces-length) (loop x (+ count 1)) ))) #t )) %=========================================================================== ================ treble = { \clef treble \time 4/4 c'4 c' c' c' c' c' c' c' } bass = { \clef bass \time 4/4 c4 \pedalWithArrowsAndText c\sustainOn c c c c c c \break c c c c \break c c c^\sustainOff\sustainOn c \break c c c c \break c c\sustainOff\sustainOn c c \break c c c c \break c c c c\sustainOff } \score { \new PianoStaff << \new Staff = "treble" { \treble } \new Staff = "bass" { \bass } >> \layout { \context { \Score pedalSustainStyle = #'bracket } } } == snip _______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
