lilypond-user
[Top][All Lists]
Advanced

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

Re: Winged repeat bar line unique over multiple staves


From: Alexis Maleval
Subject: Re: Winged repeat bar line unique over multiple staves
Date: Tue, 22 Mar 2016 22:53:26 +0100

Hi Klaus,
thank you so much, it works fine without any heigh adjustment.
Many thanks to Schneidy.
it's really nice to have effective support.

Best regards,
Alexis.


> Le 22 mars 2016 à 21:57, Klaus Blum <address@hidden> a écrit :
> 
> Hi Alexis, 
> 
> Schneidy has created a snippet for that issue:
> http://lsr.di.unimi.it/LSR/Item?id=991
> 
> There's a little drawback: You have to (manually) adjust the bracket height
> to match the staff group height. 
> I've tried a little modification to avoid this: You can add the wings to the
> topmost and lowermost staff in the group: 
> 
> %
> -----------------------------------------------------------------------------------
> 
> \version "2.18.2"
> 
> #(define-markup-command (staff-group-bracket-upper layout props
> bracket-height)(number?)
>   "Draw upper wing for StaffGroup bracket."
>   (interpret-markup layout props
>     (markup
>      (#:with-dimensions (cons -0.001 0) (cons 0.001 0)
>        (#:override (cons (quote filled) #t)
>          (#:path 0.01 `(
>                          (moveto  0.00  ,(+ bracket-height 0.35))
>                          (curveto  0.00  ,(+ bracket-height 0.43)  0.07 ,(+
> bracket-height 0.42)  0.10 ,(+ bracket-height 0.42))
>                          (curveto  0.70  ,(+ bracket-height 0.42)  1.10 ,(+
> bracket-height 0.60)  1.76 ,(+ bracket-height 1.50))
>                          (curveto  1.82  ,(+ bracket-height 1.58)  1.89 ,(+
> bracket-height 1.50)  1.85 ,(+ bracket-height 1.45))
>                          (curveto  1.14  ,(+ bracket-height 0.40)  0.93 ,(+
> bracket-height 0.18)  0.45 ,bracket-height)
>                          (lineto   0.00  ,bracket-height)
>                          (closepath)
>                          )))))))
> 
> #(define-markup-command (staff-group-bracket-lower layout props
> bracket-height)(number?)
>   "Draw lower wing for StaffGroup bracket."
>   (interpret-markup layout props
>     (markup
>      (#:with-dimensions (cons -0.001 0) (cons 0.001 0)
>        (#:override (cons (quote filled) #t)
>          (#:path 0.01 `(
>                          (moveto   0.00  ,(* bracket-height -1))
>                          (curveto  0.00  ,(+ (* bracket-height -1) -0.43) 
> 0.07 ,(+ (* bracket-height -1) -0.42)  0.10 ,(+ (* bracket-height -1)
> -0.42))
>                          (curveto  0.70  ,(+ (* bracket-height -1) -0.42) 
> 1.10 ,(+ (* bracket-height -1) -0.60)  1.76 ,(+ (* bracket-height -1)
> -1.50))
>                          (curveto  1.82  ,(+ (* bracket-height -1) -1.58) 
> 1.89 ,(+ (* bracket-height -1) -1.50)  1.85 ,(+ (* bracket-height -1)
> -1.45))
>                          (curveto  1.14  ,(+ (* bracket-height -1) -0.40) 
> 0.93 ,(+ (* bracket-height -1) -0.18)  0.45 ,(* bracket-height -1))
>                          (closepath))))))))
> 
> addUpperWing =
> #(define-music-function
>  (parser location repeat-bar-type)
>  (string?)
>  (cond
>   ((string=? repeat-bar-type "[")
>    #{
>      \once \override Staff.BarLine.stencil =
>      #(lambda (grob)
>         (ly:stencil-combine-at-edge
>          (ly:bar-line::print grob)
>          X LEFT
>          (grob-interpret-markup grob
>            #{
>              \markup
>              % \translate #(cons 0 repeat-bar-translate)
>              \staff-group-bracket-upper #1.8
>            #})))
>    #})
>   ((string=? repeat-bar-type "]")
>    #{
> 
>      \once \override Staff.BarLine.stencil =
>      #(lambda (grob)
>         (ly:stencil-combine-at-edge
>          (ly:bar-line::print grob)
>          X RIGHT
>          (grob-interpret-markup grob
>            #{
>              \markup
>              \rotate #180
>              % \translate #(cons 0 repeat-bar-translate)
>              \staff-group-bracket-lower #1.8
>            #})))
>    #})
>   (else
>    #{
>      \once \override Staff.BarLine.stencil = #ly:bar-line::print
>    #})))
> 
> addLowerWing =
> #(define-music-function
>  (parser location repeat-bar-type)
>  (string?)
>  (cond
>   ((string=? repeat-bar-type "[")
>    #{
>      \once \override Staff.BarLine.stencil =
>      #(lambda (grob)
>         (ly:stencil-combine-at-edge
>          (ly:bar-line::print grob)
>          X LEFT
>          (grob-interpret-markup grob
>            #{
>              \markup
>              \staff-group-bracket-lower #1.8
>            #})))
>    #})
>   ((string=? repeat-bar-type "]")
>    #{
> 
>      \once \override Staff.BarLine.stencil =
>      #(lambda (grob)
>         (ly:stencil-combine-at-edge
>          (ly:bar-line::print grob)
>          X RIGHT
>          (grob-interpret-markup grob
>            #{
>              \markup
>              \rotate #180
>              \staff-group-bracket-upper #1.8
>            #})))
>    #})
>   (else
>    #{
>      \once \override Staff.BarLine.stencil = #ly:bar-line::print
>    #})))
> 
> %%% Test:
> \new StaffGroup <<
>  \new Staff \relative c' {
>    c4 d e f
>    \repeat volta 2 {
>      \addUpperWing #"["
>      g a b c
>      d e f g
>      \addUpperWing #"]"
>    }
>    s8
>  }
>  \new Staff \relative c {
>    \clef F
>    c4 d e f
>    \repeat volta 2 {
>      g a b c
>      d e f g
>    }
>    s8
>  }
>  \new Staff \relative c, {
>    \clef F
>    c4 d e f
>    \repeat volta 2 {
>      \addLowerWing #"["
>      g a b c
>      d e f g
>      \addLowerWing #"]"
>    }
>    s8
>  }
>>> 
> 
> %
> -----------------------------------------------------------------------------------
> 
> Cheers, 
> Klaus
> 
> 
> 
> --
> View this message in context: 
> http://lilypond.1069038.n5.nabble.com/Winged-repeat-bar-line-unique-over-multiple-staves-tp188804p188828.html
> Sent from the User mailing list archive at Nabble.com.
> 
> _______________________________________________
> lilypond-user mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/lilypond-user




reply via email to

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