lilypond-user
[Top][All Lists]
Advanced

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

Re: vertical half-brackets


From: delfink .
Subject: Re: vertical half-brackets
Date: Tue, 31 May 2022 14:19:12 -0400

> On May 31, 2022, at 4:39 AM, Werner LEMBERG <wl@gnu.org> wrote:
> 
> 
> * Has someone coded this already?  I couldn't find code in the LSR.
> 

I don't know if this is still the most ideal way, but it works. Someone on this 
list coded all of this many years ago ... unfortunately, I'm unable to remember 
who it was to give them proper attribution. I use this snippet all the time to 
make various brackets in organ music. (The bracket names are my own; I wanted 
to use something clear & descriptive.) The #s at the end of the lines dictate 
the size (length) of the brackets. Like any markup, fine-tune the positioning 
of the brackets with something like \once \override TextScript.Y-offset = #5

The only drawback is when there is competing markup which needs to be 
positioned separately ... getting that worked out takes some creativity.

Hope this helps.

— Dan


\version "2.23.6"

%%% SINGLE BRACKET SNIPPET: 

#(define-markup-command (topNotchOpenBracket layout props heitgh) (number?)
  (interpret-markup layout props
    (markup #:line (#:with-dimensions (cons 0 0) (cons 0 0)
      (#:path 0.25
        (list (list (quote moveto) 0 0)
        (list (quote lineto) -1 0)
        (list (quote lineto) -1 (* heitgh -1))
        (list (quote lineto) -1 (* heitgh -1))))))))

#(define-markup-command (bottomNotchOpenBracket layout props heitgh) (number?)
  (interpret-markup layout props
    (markup #:line (#:with-dimensions (cons 0 0) (cons 0 0)
      (#:path 0.25
        (list (list (quote moveto) -1 0)
        (list (quote lineto) -1 0)
        (list (quote lineto) -1 (* heitgh -1))
        (list (quote lineto) 0 (* heitgh -1))))))))

#(define-markup-command (topNotchCloseBracket layout props heitgh) (number?)
  (interpret-markup layout props
    (markup #:line (#:with-dimensions (cons 0 0) (cons 0 0)
      (#:path 0.25
        (list (list (quote moveto) 1.3 0)
        (list (quote lineto) 2.3 0)
        (list (quote lineto) 2.3 (* heitgh -1))
        (list (quote lineto) 2.3 (* heitgh -1))))))))

#(define-markup-command (bottomNotchCloseBracket layout props heitgh) (number?)
  (interpret-markup layout props
    (markup #:line (#:with-dimensions (cons 0 0) (cons 0 0)
      (#:path 0.25
        (list (list (quote moveto) 2.3 0)
        (list (quote lineto) 2.3 0)
        (list (quote lineto) 2.3 (* heitgh -1))
        (list (quote lineto) 1.3 (* heitgh -1))))))))

#(define-markup-command (openBracket layout props heitgh) (number?)
  (interpret-markup layout props
    (markup #:line (#:with-dimensions (cons 0 0) (cons 0 0)
      (#:path 0.25
        (list (list (quote moveto) 0 0)
        (list (quote lineto) -1 0)
        (list (quote lineto) -1 (* heitgh -1))
        (list (quote lineto) 0 (* heitgh -1))))))))

#(define-markup-command (closeBracket layout props heitgh) (number?)
  (interpret-markup layout props
    (markup #:line (#:with-dimensions (cons 0 0) (cons 0 0)
      (#:path 0.25
        (list (list (quote moveto) 1.3 0)
        (list (quote lineto) 2.3 0)
        (list (quote lineto) 2.3 (* heitgh -1))
        (list (quote lineto) 1.3 (* heitgh -1))))))))

\score {
  \new Staff { \relative c' {
    a4_\markup\openBracket #6 
    a4^\markup\closeBracket #6
    s4
    <c e g c>4^\markup\topNotchOpenBracket #7
    s4
    <e g c e>4^\markup\topNotchCloseBracket #6 
    s4
    <g c e g>4^\markup\bottomNotchOpenBracket #8
    s4
    <c e g c>4^\markup\bottomNotchCloseBracket #6
               }
  }
}

Attachment: test-bracket.ly
Description: Binary data

Attachment: test-bracket.pdf
Description: Adobe PDF document



reply via email to

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