lilypond-user-fr
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ledger-extra plus courte que les autres


From: Jean Abou Samra
Subject: Re: ledger-extra plus courte que les autres
Date: Sat, 27 Feb 2021 19:55:59 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1

Le 27/02/2021 à 18:25, joel.gauvrit@free.fr a écrit :

Merci beaucoup Pierre,

J’espérais pouvoir automatiser cela mais cela fonctionne bien et de toute 
manière le cas reste rare.

Bonjour,

Éventuellement, on peut automatiser un peu plus :

\version "2.22.0"

#(set-object-property! 'extra-ledger-shorten 'backend-type? number?)

#(define add-shorter-ledger
   (grob-transformer 'stencil
     (lambda (grob original)
       (let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
              (line-count (ly:grob-property staff-symbol 'line-count))
              (staff-position (ly:grob-property grob 'staff-position))
              (x-extent (ly:stencil-extent original X))
              (shorten (ly:grob-property grob 'extra-ledger-shorten))
              (line-x-extent (interval-widen x-extent (- shorten)))
              (line-abs-y-position (if (equal? (modulo staff-position 2)
                                               (modulo line-count 2))
                                       1/2
                                       1))
              (line-y-position (* line-abs-y-position
                                  (sign staff-position))))
         (if (< (abs staff-position)
                 line-count)
             original
             (ly:stencil-add
               original
               (ly:line-interface::line
                 grob
                 (car line-x-extent)
                 line-y-position
                 (cdr line-x-extent)
                 line-y-position)))))))


\layout {
  \override NoteHead.stencil = #add-shorter-ledger
  \override NoteHead.thickness = 2
  \override NoteHead.extra-ledger-shorten = 0.25 % à ajuster
}


\relative {
  \autoBeamOff
  \override NoteHead.style = #'petrucci
  \omit Staff.Clef
  \omit Staff.TimeSignature
  c'''16 b a g f e d c b8 a g f |
  e4 d c b |
  a2 g |
  f1
}

Cordialement,
Jean




reply via email to

[Prev in Thread] Current Thread [Next in Thread]