lilypond-user
[Top][All Lists]
Advanced

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

Re: Accidental in brackets


From: tisimst
Subject: Re: Accidental in brackets
Date: Mon, 5 Dec 2016 09:30:26 -0700 (MST)

Urs,

On Mon, Dec 5, 2016 at 7:54 AM, Mike Solomon [via Lilypond] <[hidden email]> wrote:
Hey!

Total hack, but if you check out scm/stencil.scm, you’ll see how parentheses are made…

(define-public (parenthesize-stencil
                stencil half-thickness width angularity padding)
  "Add parentheses around @var{stencil}, returning a new stencil."
  (let* ((y-extent (ly:stencil-extent stencil Y))
         (lp (make-parenthesis-stencil
              y-extent half-thickness (- width) angularity))
         (rp (make-parenthesis-stencil
              y-extent half-thickness width angularity)))
    (set! stencil (ly:stencil-combine-at-edge stencil X LEFT lp padding))
    (set! stencil (ly:stencil-combine-at-edge stencil X RIGHT rp padding))
    stencil))

So it looks like you can substitute in make-connected-path-stencil for make-parenthesis-stencil, using sensible parameters for the connected path based on the y extent and the width.

Here's another option for you that I created recently that creates brackets roughly the same size as the real parentheses glyphs, so I think it (the second one I describe in that message) tends to look a little better than relying on the stencil of the accidental because, for example, you'll get very different results for a flat glyph vs. a natural glyph (as will Mike's code):
http://lists.gnu.org/archive/html/lilypond-user/2016-11/msg00928.html

Best,
Abraham


View this message in context: Re: Accidental in brackets
Sent from the User mailing list archive at Nabble.com.

reply via email to

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