Hello, all --

First of all, I hope that I'm asking this question on the appropriate list!

I'm trying to simplify the workaround relating to tuplet-number
position on kneed beams
http://lsr.dsi.unimi.it/LSR/Snippet?id=646
and I'm running into an unexpected problem.

My reasoning is that, since the tuplet number is positioned according
to the bracket, a logical first (certainly hacky!) step is to move the
(invisible) bracket to the beam by setting the 'positions property of
the bracket to that of the beam.  Then, the position of the number
could be refined according to its height, the thickness of the beam,
etc.

This works as planned, except that in 2.14.1, the staves are pushed
apart dramatically.  \override Beam #'collision-voice-only has no
effect on the problem.  Manually setting Beam #'positions can be used
to fix the problem, but that is obviously inconvenient.

I've attached an .ly file with the function (stripped down to fit just
this case), and several images of the output (one is produced with
2.12.3, the other two with 2.14.1 -- one with an override of the Beam
#'positions).  There doesn't appear to be any problem in 2.12.3.

Is there anything I can do to fix this problem with the function?  Any
help would be greatly appreciated!

Thanks,
David

<<attachment: function-current-stable.png>>

<<attachment: function-current-stable-positions-override.png>>

<<attachment: function-previous-stable.png>>

\version "2.14.1"

#(define (tuplet-number-to-beam tuplet-number)
  (let* ((tuplet-bracket (ly:grob-object tuplet-number 'bracket))
         (note-column (ly:grob-parent tuplet-number X))
         (stem (ly:grob-object note-column 'stem))
         (beam (ly:grob-object stem 'beam)))

     ;; Move (invisible) TupletBracket to beam, taking number with it
     (ly:grob-set-property! tuplet-bracket 'positions (ly:grob-property beam 'positions))

     ;; Number is now centered on beam.  Offset it based on width of beam and height
     ;; of tuplet number.
     (ly:grob-set-property! tuplet-number 'Y-offset
         (-
           (+
             (ly:grob-property beam 'beam-thickness)
             (/ (interval-length (ly:grob::stencil-height tuplet-number)) 2))))))

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

\new PianoStaff <<
  \new Staff = "1" {
    s4
  }
  \new Staff = "2" {
    \relative c {
      \clef bass
      %% following line has no effect
      \override  Beam #'collision-voice-only = ##t
      %% following line improves situation
      %\override  Beam #'positions = #'(5 . 5)
      \override TupletNumber #'after-line-breaking = #tuplet-number-to-beam
      \times 2/3 {
        c8
        \change Staff = "1"
        c''
        \change Staff = "2"
        c,,
      }
    }
  }
>>


_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to