bug-lilypond
[Top][All Lists]
Advanced

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

Re: Parenthesis issue with cross staff beaming


From: Thomas Morley
Subject: Re: Parenthesis issue with cross staff beaming
Date: Sun, 1 Jan 2017 11:39:53 +0100

2017-01-01 2:17 GMT+01:00 Andrew Bernard <address@hidden>:
> Hi All,
>
>
>
> Here is an MWE showing an issue I encounter regularly with the
> parenthesizing of accents. It only occurs when using cross staff beaming
> which I use a lot.
>
>
>
> The reported error is:
>
> .
>
> programming error: Improbable offset for stencil: inf staff space
>
> Setting to zero.
>
> continuing, cross fingers
>
> .
>
>
>
> The output is unsatisfactory and I am unable to use parentheses in this
> situation, but I need them.
>
>
>
> A bug?
>
>
>
> Andrew
>
>
>
> == snip
>
>
>
> \version "2.19.53"
>
>
>
>
>
> treble = {
>
>   \clef treble
>
>   \time 1/4
>
>   \override Beam.positions = #'(-4 . -4)
>
>   \tuplet 5/4 {
>
>     \stemDown
>
>     c''8.
>
>     \change Staff = bass
>
>     \stemUp
>
>     c32 e cis'16-\parenthesize ^>
>
>   } |
>
> }
>
>
>
> bass = {
>
>   \clef bass
>
>   \time 1/4
>
>   s4
>
> }
>
>
>
> \score {
>
>   \new PianoStaff
>
>   <<
>
>     \new Staff = "treble" \treble
>
>     \new Staff = "bass" \bass
>
>   >>
>
>
>
>   \layout {
>
>   }
>
> }
>
>
>
> == snip
>
>
>
>
>
>
>
>
>
> _______________________________________________
> bug-lilypond mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/bug-lilypond

Hi Andrew,

no idea for a proper fix. Though, below a hacky workaround.

The override of ParenthesesItem returns the Script.stencil, with
`parenthesize-stencil' applied.
The original Script.stencil is set to point-stencil.
You need to move the result a bit in X-axis.
I didn't manage to do it automagically, thus the function.
See the comment how to check a bit easier which value is needed.

\version "2.19.52"

foo =
#(define-music-function (x-off)(number?)
#{
  \override ParenthesesItem.after-line-breaking =
    #(lambda (grob)
      (let* ((par-Y (ly:grob-parent grob Y))  ;; Script
             (script-stil (ly:grob-property par-Y 'stencil)))
        (ly:grob-set-property! grob 'stencil
          (ly:stencil-translate-axis
             (parenthesize-stencil
                script-stil
                0.05 ;; half-thickness
                0.2 ;; width
                0   ;; angularity
                0.2 ;; padding
                )
                x-off
                X))
        ;; To check the needed offset uncomment next line and comment last line:
        ;(ly:grob-set-property! par-Y 'color red)
        (ly:grob-set-property! par-Y 'stencil point-stencil)
        ))
#})

treble = {
  \clef treble
  \time 1/4
  \override Beam #'positions = #'(-4 . -4)
  \times 4/5 {
    \stemDown
    c''8.
    \change Staff = bass
    \stemUp
    c32 e
    c32-\single\foo #0.64 -\parenthesize ^>
    c32-\single\foo #1.23 -\parenthesize ^.
  }
    %% Comparing with
    c32-\parenthesize ^>
    c32-\parenthesize ^.
    %% shows the parenthesis have different height.
    %% Need to fix?
}

bass = {
  \clef bass
  \time 1/4
  s4
}

\score {
  \new PianoStaff
  <<
    \new Staff = "treble" \treble
    \new Staff = "bass" \bass
  >>
  \layout {
  }
}

Happy New Year,
 Harm



reply via email to

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