bug-lilypond
[Top][All Lists]
Advanced

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

Re: \omit dynamic occupies space


From: Thomas Morley
Subject: Re: \omit dynamic occupies space
Date: Wed, 27 Apr 2016 12:22:00 +0200

2016-04-27 11:25 GMT+02:00 Graham King <address@hidden>:
> thanks Harm,
>
> On Wed, 2016-04-27 at 01:18 +0200, Thomas Morley wrote:
>
> Hi Graham,
>
> I guess at the point of time \omit DynamicText is applied the bounds
> of the Hairpin (and so the extension of it) is already calculated.
>
> So \omit DynamicText works, but the Hairpin still keeps it's extension.
>
>
> You know the internals and I don't, but this doesn't seem quite right.
> \omit DynamicText seems to produce a hairpin that is slightly longer than
> the hairpin produced in the presence of dynamics:

Well, obviously I was wrong or at least not entirely correct.
The Hairpin, bound by DynamicText, is calculated in a complex manner.
I ran against walls before ...

Looks like the already established bounds are respected in some way
even if their stencil is set #f

>
> \version "2.19.40"
>
> {
>   <>^\markup "no dynamics"
>   c'2\< 2\! 2\> 2\!
>   <>^\markup "with dynamics"
>   c'2\p\< 2\f 2\f\> 2\p
>   <>^\markup "\omit dynamics"
>   c'2-\omit\p\< 2-\omit\f 2-\omit\f\> 2-\omit\p
> }
>
>
>
> Not sure if this should count as an enhancement, but at least it's a
> documentation issue.
>
> Please test this workaround to reset the bounds of the Hairpin:
>
> \version "2.19.40"
>
> resetBounds =
> \override Hairpin.after-line-breaking =
>   #(lambda (grob)
>     (let ((bound-left (ly:spanner-bound grob LEFT))
>           (bound-right (ly:spanner-bound grob RIGHT)))
>       (if (eq? (grob::name bound-left) 'DynamicText)
>           (ly:spanner-set-bound! grob LEFT
>             (ly:grob-parent bound-left X)))
>       (if (eq? (grob::name bound-right) 'DynamicText)
>           (ly:spanner-set-bound! grob RIGHT
>             (ly:grob-parent bound-right X)))))
>
> {
>   <>^\markup "no dynamics"
>   c'2\< c'2\! c'2\> c'2\!
>   <>^\markup "\omit dynamics"
>   \omit DynamicText
>   \resetBounds
>   c'2\p\< c'2\f c'2\f\> c'2\p
> }
>
> This looks very promising.  However, I can't switch off the effect, in order
> to print the dynamics which bound subsequent hairpins in the score.  Any
> idea how I can apply something like \temporary ... \revert to your
> technique?  I've tried some variations on the following (which throws
> errors), but I'm shooting in the dark...
>
> \version "2.19.40"
>
> resetBounds =
>   \temporary \override Hairpin.after-line-breaking =
>    #(lambda (grob)
>      (let ((bound-left (ly:spanner-bound grob LEFT))
>            (bound-right (ly:spanner-bound grob RIGHT)))
>        (if (eq? (grob::name bound-left) 'DynamicText)
>            (ly:spanner-set-bound! grob LEFT
>              (ly:grob-parent bound-left X)))
>        (if (eq? (grob::name bound-right) 'DynamicText)
>            (ly:spanner-set-bound! grob RIGHT
>              (ly:grob-parent bound-right X)))))
>
> {
>   <>^\markup "Harm-fu :-)"
>   \temporary \omit DynamicText
>   \resetBounds
>   c'2\p\< c'2\f c'2\f\> c'2\p
>   \revert DynamicText
>   \revert Hairpin.after-line-breaking
>   <>^\markup "no dynamics"
>   c'2\< 2\! 2\> 2\!
>   <>^\markup "with dynamics"
>   c'2\p\< 2\f 2\f\> 2\p
>   <>^\markup "\omit dynamics"
>   c'2-\omit\p\< 2-\omit\f 2-\omit\f\> 2-\omit\p
> }

Try:

resetBounds =
  \temporary \override Hairpin.after-line-breaking =
   #(lambda (grob)
     (let ((bound-left (ly:spanner-bound grob LEFT))
           (bound-right (ly:spanner-bound grob RIGHT)))
       (if (eq? (grob::name bound-left) 'DynamicText)
           (ly:spanner-set-bound! grob LEFT
             (ly:grob-parent bound-left X)))
       (if (eq? (grob::name bound-right) 'DynamicText)
           (ly:spanner-set-bound! grob RIGHT
             (ly:grob-parent bound-right X)))))

{
  <>^\markup "Harm-fu :-)"
  \temporary \omit DynamicText
  \resetBounds
  c'2\p\< c'2\f c'2\f\> c'2\p
  %\revert DynamicText.stencil
  %\revert Hairpin.after-line-breaking
  %% or:
  \undo \omit DynamicText
  \undo \resetBounds
  <>^\markup "no dynamics"
  c'2\< 2\! 2\> 2\!
  <>^\markup "with dynamics"
  c'2\p\< 2\f 2\f\> 2\p
  <>^\markup "\omit dynamics"
  c'2-\omit\p\< 2-\omit\f 2-\omit\f\> 2-\omit\p
}

>
>
> I guess this discussion should be made visible to either the bug list or the
> user list.  Any preference / objection?

bug list for now.
This may result in an issue on the bug-tracker.

>
> all the best
> -- Graham
>

Cheers,
  Harm



reply via email to

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