Or even:

#(define (new-centered-mmr-stencil grob)
     (let* ((sys (ly:grob-system grob))
            (X-extent (lambda (q) (ly:grob-extent q sys X)))
            (left-bound (ly:spanner-bound grob LEFT))
            (left-bound-X-length (interval-length (X-extent left-bound)))
            (left-bound-coord (ly:grob-relative-coordinate left-bound sys
X))
            (right-bound (ly:spanner-bound grob RIGHT))
            (right-bound-X-length (interval-length (X-extent right-bound)))
            (right-bound-coord (ly:grob-relative-coordinate right-bound sys
X))
            (new-stil
               (grob-interpret-markup grob
                 #{
                    \markup
                    \concat {
                      \override #'(line-cap-style . square)
                      \path #0.2
                         #'((moveto 0 -0.9)
                            (lineto 0  0.9))
                      \hspace #-.2
                      \pattern #7 #X #-.2
                        \path #0.2
                         #'((moveto 0 0)
                            (lineto 0.5 -0.9)
                            (lineto 1.5 0.9)
                            (lineto 2 0))
                      \hspace #-.2
                      \override #'(line-cap-style . square)
                      \path #0.2
                         #'((moveto 0 -0.9)
                            (lineto 0  0.9))
                    }
                  #}
                 ))
            (new-stil-X-length (interval-length (ly:stencil-extent new-stil
X)))

            (translate-value (- (+ (/ (- right-bound-coord
left-bound-coord) 2)
                                   (/ left-bound-X-length 2))
                                (/ new-stil-X-length 2)
                                (/ right-bound-X-length 2)))
           )

   (ly:grob-set-property! grob 'stencil
     (ly:stencil-translate-axis
       new-stil
       translate-value
       X))))

{
  \compressFullBarRests
  R1*32
  \override MultiMeasureRest.after-line-breaking = #new-centered-mmr-stencil
  R1*71
}

Pierre

2016-09-06 16:03 GMT+02:00 Pierre Perol-Schneider <
pierre.schneider.pa...@gmail.com>:

> Hi Marc,
>
> See: http://lilypond.1069038.n5.nabble.com/How-to-align-a-new-
> MultiMeasureRest-stencil-td142767.html
> How about:
>
> \version "2.19.47"
>
> #(define (new-centered-mmr-stencil grob)
>      (let* ((sys (ly:grob-system grob))
>             (X-extent (lambda (q) (ly:grob-extent q sys X)))
>             (left-bound (ly:spanner-bound grob LEFT))
>             (left-bound-X-length (interval-length (X-extent left-bound)))
>             (left-bound-coord (ly:grob-relative-coordinate left-bound sys
> X))
>             (right-bound (ly:spanner-bound grob RIGHT))
>             (right-bound-X-length (interval-length (X-extent right-bound)))
>             (right-bound-coord (ly:grob-relative-coordinate right-bound
> sys X))
>             (new-stil
>                (grob-interpret-markup grob
>                  #{
>                             \markup
>                             \concat {
>                               \general-align #Y #0
>                               \override #'(thickness . 2)
>                               \draw-line #'(0 . 2)
>                               \hspace #-.2
>                               \pattern #7 #X #-.2
>                                 \path #0.2
>                                  #'((moveto 0 0)
>                                     (lineto 0.5 -1)
>                                     (lineto 1.5 1)
>                                     (lineto 2 0))
>                               \hspace #-.2
>                               \general-align #Y #0
>                               \override #'(thickness . 2)
>                               \draw-line #'(0 . 2)
>                             }
>                           #}
>                  ))
>             (new-stil-X-length (interval-length (ly:stencil-extent
> new-stil X)))
>
>             (translate-value (- (+ (/ (- right-bound-coord
> left-bound-coord) 2)
>                                    (/ left-bound-X-length 2))
>                                 (/ new-stil-X-length 2)
>                                 (/ right-bound-X-length 2)))
>            )
>
>    (ly:grob-set-property! grob 'stencil
>      (ly:stencil-translate-axis
>        new-stil
>        translate-value
>        X))))
>
> {
>   \compressFullBarRests
>   R1*32
>   \override MultiMeasureRest.after-line-breaking =
> #new-centered-mmr-stencil
>   R1*71
> }
>
>
> HTH,
> Cheers,
> Pierre
>
> 2016-09-06 14:28 GMT+02:00 Marc Hohl <m...@hohlart.de>:
>
>> Hi list,
>>
>> I want to change the MultiMeasureRest.stencil to a squiggle as shown in
>> the appendices (quite roughly pasted together in GIMP).
>> Searching the LSR and the web does not give any informations about this
>> topic (the only thing I found was using the percent stencil, which is also
>> hardcoded in the C++ sources).
>>
>> I tried to override the stencil by
>>
>> \override MultiMeasureRest.stencil = #ly:line-spanner::print
>>
>> but this causes errors like
>>
>> "MultiMeasureRest has empty extent and non-empty stencil."
>>
>> Any ideas?
>>
>> Thanks,
>>
>> Marc
>>
>> _______________________________________________
>> lilypond-user mailing list
>> lilypond-user@gnu.org
>> https://lists.gnu.org/mailman/listinfo/lilypond-user
>>
>>
>
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to