lilypond-user
[Top][All Lists]
Advanced

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

Re: Left-hand end of tuplet bracket sometimes wrong


From: Aaron Hill
Subject: Re: Left-hand end of tuplet bracket sometimes wrong
Date: Fri, 03 Jun 2022 13:33:59 -0700

On 2022-06-03 10:10 am, Paul Hodges wrote:
I find that even using shorten-pair (with a negative first value)
fails to do this as I expected.  So now I don't know any way to print
the bracket with the preferred layout...

You would want to adjust the X-positions, so that the TupletNumber is centered properly. See the difference:

%%%%
\version "2.22.0"

{
  \offset shorten-pair #'(-1 . 0)
  \tuplet 3/2 \relative { f'4 g a }

  \offset X-positions #'(-1 . 0)
  \tuplet 3/2 \relative { f'4 g a }
}
%%%%

Since an offset of one staff space is only approximate, you would need to consult the bounds of the NoteColumns directly:

%%%%
{
  \override TupletBracket.X-positions =
  #(lambda (grob)
    ;; NOTE: The logic here does not fully replace
    ;;       ly:tuplet-bracket::calc-x-positions
    (let* ((nc (ly:grob-object grob 'note-columns))
           (xref (ly:grob-common-refpoint-of-array grob nc X))
           (lb (ly:spanner-bound grob LEFT))
           (lbex (ly:generic-bound-extent lb xref))
           (lbrc (ly:grob-relative-coordinate lb xref X))
           (rb (ly:spanner-bound grob RIGHT))
           (rbex (ly:generic-bound-extent rb xref)))
    (cons (- (car lbex) lbrc) (- (cdr rbex) lbrc))))

  \tuplet 3/2 \relative c' { <e fis>4 g <a b> }
  \tuplet 3/2 \relative c'' { <ees f>4 d <b c> }
}
%%%%

Tuplet_Bracket::calc_x_positions relies on Item::get_x_bound_item, which includes the logic to prefer using the Stem of a NoteColumn as the bound item if the direction matches.

The code above simply ignores that behavior and computes X-positions purely based on the extents of the NoteColumns. Mind you, Tuplet_Bracket::calc_x_positions does more work to account for properties like connect-to-neighbor, break-overshoot, and full-length-to-extent, so this is not a true replacement/fix.


-- Aaron Hill



reply via email to

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