lilypond-user
[Top][All Lists]

## Re: Square bracket version of \left-brace markup

 From: Torsten Hämmerle Subject: Re: Square bracket version of \left-brace markup Date: Sat, 21 Apr 2018 04:49:36 -0700 (MST)

Aaron Hill wrote
> However, I would prefer to use a square bracket instead of the
> curly brace.  It seems like I will have to manually "draw" the bracket
> using markup functions and/or custom PostScript.

Hi Aaron,

Braces are very special animals because they can't just be scaled up and
down (at least that would look terrible).
That's the only reason why there even is a special encoding ("FetaBrace")
and a special lookup command.
There are lots and lots of differently sized braces in the Feta/Emmentaler
font.

Brackets are much easier to achieve (there even is a \bracket markup
command).
This, however, is quite useless in your case because it creates two brackets
around a given markup.

But looking into the code and seeing how these brackets are being
constructed, there is a ly:bracket command that can be used for creating a
bracket stencil quite easily and putting this into a custom markup command

%%%%
\version "2.19.80"

#(define-markup-command (left-bracket layout props ext)
(pair?)
#:category graphic
#:properties ((thickness 2.0)
(protrusion 0.5))
(let ((th (* (ly:output-def-lookup layout 'line-thickness)
thickness)))
(ly:bracket Y ext th protrusion)))

lyricBracket = \markup {
\hspace #0.5 \left-bracket #'(-3.5 . 5)
}

\relative c' { c4 d e2 | g8 f e4 c2 }
\repeat unfold 3 \skip 1
Mul -- ti -- ple lines
}
Sin -- gle line
\set stanza = \lyricBracket
Mul -- ti -- ple lines
}
\repeat unfold 3 \skip 1
Mul -- ti -- ple lines
}
%%%%

The markup command \left-bracket does nothing but draw a bracket and the
only parameter is a pair for setting its dimension in Y direction (down and
up) so that it can quite used quite conveniently by directly stating how far
it should reach down and up (with the baseline as a reference).

There are two properties (thickness and protrusion) that can be manipulated
by applying, say, \override #'(thickness . 3) etc.

<http://lilypond.1069038.n5.nabble.com/file/t3887/left-bracket-markup.png>

HTH
Torsten

--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html