lilypond-user
[Top][All Lists]
Advanced

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

Re: Moving tuplet number


From: David Nalesnik
Subject: Re: Moving tuplet number
Date: Mon, 30 Mar 2015 11:13:13 -0500

Hi Harm, Andrew--

On Mon, Mar 30, 2015 at 10:45 AM, Thomas Morley <address@hidden> wrote:
Hi Andrew,

2015-03-30 17:06 GMT+02:00 David Nalesnik <address@hidden>:
> Hi Andrew,
>
> On Mon, Mar 30, 2015 at 9:11 AM, Andrew Bernard <address@hidden>
> wrote:
>>
>> How can you move a tuplet number to a different position relative to the
>> centre of the bracket, say 75% along rather than 50%?
>>
>> I can use X-offset for the TupletNumber, but this reveals the gap in the
>> bracket that is the room for the number. How does one move that as well?
>
>
> Sorry, I don't believe that this is possible in any convenient way.   The
> routine that draws the tuplet bracket simply puts the gap halfway along,
> regardless of the number's position.  Fixing this would involve patching the
> C++ code.
>
> You could instead write a Scheme callback for TupletBracket.stencil which
> would use the tuplet number's X-extent to determine the gap's position.
> You'd of course have to reconstruct the bracket from scratch.
>
> --David

not sure what you aim at. An example is always helpful, especially for
a none native speaker like me. ;)

He's wanting to move the number along the bracket and have the gap go with it.  Right now the gap is always dead center.
 

Though, maybe the following may help:

\version "2.19.17"

\relative c' {
    \override TupletNumber.Y-offset =
    #(lambda (grob)
      (let ((dir (ly:grob-property grob 'direction)))
       (+ (ly:tuplet-number::calc-y-offset grob)
          (* dir 0.75))))

    \override TupletNumber.X-extent = #empty-interval

    %\voiceTwo
    %\voiceOne
    \times 2/3 {
        c2 c c
    }
}

Thanks, Harm--this gives me an idea!  Draw an unbroken bracket as you do above, then add a whiteout box to the TupletNumber:

 \version "2.19.17"

\relative c' {
  \override TupletNumber.X-extent = #empty-interval
  \override TupletNumber.stencil =
  #(lambda (grob)
     (let* ((stil (ly:tuplet-number::print grob))
            (stil-X (ly:stencil-extent stil X))
            (stil-X (interval-widen stil-X 0.5))
            (stil-Y (ly:stencil-extent stil Y))
            (box (make-transparent-box-stencil stil-X stil-Y))
            (whiteout (stencil-whiteout box)))
       (ly:stencil-add whiteout stil)))

  \offset X-offset 1 TupletNumber
  \times 2/3 {
    c2 c c
  }
  \offset X-offset -1 TupletNumber
  \times 2/3 {
    c2 c' e
  }
}

%%
--David

reply via email to

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