lilypond-user
[Top][All Lists]
Advanced

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

Question about bracketifying rests


From: William Rehwinkel
Subject: Question about bracketifying rests
Date: Wed, 19 Apr 2023 09:44:18 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

Dear list,

I use the following stencil (which is derived the bracketify-stencil procedure from lilypond) to draw editorial brackets around rests.

The output looks very nice and more preferable for my use than using \parenthesize (mainly because it changes in size for quarter note rests). However, I would like to ask if it is possible to modify the \override command to have the brackets account for the dots after the rest? Perhaps a higher level stencil that draws the Rest and dots?

Unfortunately I had trouble finding the source code which handles \parenthesize in the lilypond repository, which probably could have helped me.

Thank you,
-William

%%%%%%%%%%
\version "2.25.2"

#(define (wills-bracketify-stencil stil axis thick protrusion vpadding hpadding)
  (let* ((ext (ly:stencil-extent stil axis))
(lb (ly:bracket axis (cons (- (car ext) hpadding) (+ (cdr ext) hpadding)) thick protrusion)) (rb (ly:bracket axis (cons (- (car ext) hpadding) (+ (cdr ext) hpadding)) thick (- protrusion))))
    (set! stil
(ly:stencil-combine-at-edge stil (other-axis axis) 1 rb vpadding))
    (set! stil
(ly:stencil-combine-at-edge stil (other-axis axis) -1 lb vpadding))
    stil))

\relative a {
\override Rest.stencil = #(lambda (grob) (wills-bracketify-stencil (ly:rest::print grob) Y 0.15 0.5 0.2 0.6))
  r1
  r2. r4
  a1\rest
}
%%%%%%%%%%


--
+ ------------------------------------------- +
|   William Rehwinkel - Oberlin College and   |
|                          Conservatory '24   |
|        william@williamrehwinkel.net         |
| PGP key:                                    |
| https://ftp.williamrehwinkel.net/pubkey.txt |
+ ------------------------------------------- +

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

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