Josh,

On 6/13/16, Joshua Nichols [via Lilypond]
<ml-node+s1069038n191584...@n5.nabble.com> wrote:
>
>
> ​> ​
> The only way I know is to use a dynamics context and vary the length of the
> spacer rests the occur between the start and end of the hairpin.
>
> ​Thanks.​

Without direct access to the right side's anchor (BTW, you can change
the left side's position with X-offset), you can always override the
'stencil by scaling/translating the original. It's not the cleanest
method, but if it doesn't need to change too much then you might be
able to get away with something like the following:

%%%%%%%%%%%%%%%%%%%%%%

\version "2.19.36"

#(define ((adjust-endpoints offsets) grob)
  (let* ((stil (ly:hairpin::print grob))
         (xext (ly:stencil-extent stil 0))
         (dx (interval-length xext))
         ;; positive values move the end-points right
         ;; negative values move the end-points left
         (left (car offsets))
         (right (cdr offsets))
         ;; a scaling factor to resize the hairpin with the desired offsets
         (sc (+ 1 (/ (- right left) dx)))
         (newstil
           (ly:stencil-translate
             (ly:stencil-scale stil sc 1.0)
             (cons left 0))))
    newstil
    ))

music = {
  c'1\< ~ c' ~ c'\!
  c'1\p\< ~ c' ~ c'\f\> ~ c'1 ~ c' ~ c'\pp
}

{
  <>^"Default hairpins"
  \music
}

{
  <>^"Left side moved left 1 staff-space"
  \override Hairpin.stencil = #(adjust-endpoints '(-1 . 0))
  \music
}

{
  <>^"Right side moved right 2 staff-spaces"
  \override Hairpin.stencil = #(adjust-endpoints '(0 . 2))
  \music
}

{
  <>^"Both sides moved right 1.5 staff-spaces"
  \override Hairpin.stencil = #(adjust-endpoints '(1.5 . 1.5))
  \music
}

{
  <>^"Both sides moved inward by 1 staff-space"
  \override Hairpin.stencil = #(adjust-endpoints '(1 . -1))
  \music
}

%%%%%%%%%%%%%%%%%%%%%%

NOTE: This doesn't give you control over the individual pieces of
broken hairpins (yet), but that can be done if needed. I just didn't
have the time to work that out at the moment.

Anyway, give it a try. When other dynamic text is involved, I noticed
that the adjustments are a little off, but it still might do what you
need for now.

HTH,
Abraham


hairpin-finetune-endpoints.png (72K) 
<http://lilypond.1069038.n5.nabble.com/attachment/191588/0/hairpin-finetune-endpoints.png>




--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Re-hairpin-length-tp191580p191588.html
Sent from the User mailing list archive at Nabble.com.
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to