On Tue, Nov 22, 2016 at 1:25 PM, Abraham Lee <[email protected]>
wrote:
>
>
> On Tue, Nov 22, 2016 at 12:05 PM, Benjamin Strecker [via Lilypond] <
> [email protected]> wrote:
>
>> Hello!
>>
>> I am working from an edition that uses square brackets for items added
>> by the editors. I was able to change the stencils property for
>> \parenthesize for most of these, but there are some accidentals that
>> have been added. Currently, I'm using the following to produce a
>> reasonable approximation, but are there any simpler ways to do this?
>>
>> \version "2.19.50"
>>
>> %% Set of overrides to approximate a cautionary natural inside square
>> brackets instead of parentheses
>> brackNat = {
>> \once\override AccidentalCautionary.stencil = #ly:text-interface::print
>> \once\override AccidentalCautionary.text = \markup {
>> \concat{\translate #'(0.0 . -0.7) [
>> \musicglyph #"accidentals.natural"
>> \translate #'(0.0 . -0.7) ]}
>> }
>> }
>>
>> \score {
>> \new Staff {
>> c''4 c''? \brackNat c''? c''
>> }
>> }
>>
>> Thanks for any advice you can offer!
>>
>
> Here's how you can use the same functionality as the markup macro
> "bracket" to do the job:
>
> %%%%%%%%%%%%%%%
>
> \version "2.19.36"
>
> bracketAcc = {
> \once \override AccidentalCautionary.parenthesized = ##f
> \once \override AccidentalCautionary.stencil =
> #(lambda (grob)
> (let ((stil (ly:accidental-interface::print grob))
> (th 0.1))
> (bracketify-stencil stil Y th (* 2.5 th) th)))
> }
>
> \score {
> \new Staff {
> c''4 c''? \bracketAcc c''? c''
> }
> }
>
> %%%%%%%%%%%%%%%
>
> An unfortunate side-effect of this is that each accidental's brackets will
> look different because it draws brackets that span the accidental's exact
> vertical extent (e.g., compare a flat vs. a natural). So, here's another
> variant that I cobbled together based on the same macro and the underlying
> "bracketify-stencil" command. It works better because it makes the brackets
> *act like the normal parentheses* so you get a more consistent look for any
> accidental:
>
> %%%%%%%%%%%%%%%
>
> \version "2.19.36"
>
> bracketAcc = {
> \once \override AccidentalCautionary.parenthesized = ##f
> \once \override AccidentalCautionary.stencil =
> #(lambda (grob)
> (let* ((paren-stil
> (grob-interpret-markup grob
> (markup #:musicglyph "accidentals.leftparen")))
> (axis Y)
> (other-axis (lambda (a) (remainder (+ a 1) 2)))
> (ext (ly:stencil-extent paren-stil axis))
> (stil (ly:accidental-interface::print grob))
> (thick
> (ly:output-def-lookup (ly:grob-layout grob) 'line-thickness
> 0.1))
> (padding thick)
> (protrusion (* 2.5 thick))
> (lb (ly:bracket axis ext thick protrusion))
> (rb (ly:bracket axis ext thick (- protrusion))))
> (set! stil
> (ly:stencil-combine-at-edge stil (other-axis axis) 1 rb
> padding))
> (set! stil
> (ly:stencil-combine-at-edge stil (other-axis axis) -1 lb
> padding))
> stil))
> }
>
> \score {
> \new Staff {
> c''4 c''? \bracketAcc c''? c''
> }
> }
>
> %%%%%%%%%%%%%%%
>
> HTH,
> Abraham
>
For completeness, here's another approach from the LSR:
http://lsr.di.unimi.it/LSR/Item?id=564
Best,
Abraham
--
View this message in context:
http://lilypond.1069038.n5.nabble.com/Cautionary-Accidental-Stencil-tp197011p197013.html
Sent from the User mailing list archive at Nabble.com._______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user