[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: angle of a tuplet bracket
From: |
Thomas Morley |
Subject: |
Re: angle of a tuplet bracket |
Date: |
Thu, 5 Jan 2012 16:20:30 +0100 |
Hi Paolo,
2012/1/5 address@hidden <address@hidden>:
>
> On Jan 5, 2012, at 2:31 PM, Paolo Prete wrote:
>
> ... is there a way to specify the angle of a tuplet bracket?
>
> In addition, how can I force the bracket of the following tuplet:
>
> \times 2/3 {c' c'' c'''}
>
> so to be horizontal? (0 °)
>
>
> thanks!
>
>
> Hey Paolo,
>
> You can set the positions property.
>
> http://lilypond.org/doc/v2.15/Documentation/internals/tupletbracket
>
> To force it to be horizontal, just use the same two numbers.
>
> Cheers,
> MS
if you want to get explicit control about the angle of the
TupletBracket, you could try the function below. Sometimes there's
need of an offset in Y-direction depending on the angle you've chosen.
So I integrated the possibility to do so.
\version "2.15.20"
tupletAngles =
#(define-music-function (parser location y-off angl)(number? number?)
"
angl is supposed to be the angle of the TupletBracket in degrees,
y-off a (possible) offset in Y-direction
"
#{
\once\override TupletBracket #'after-line-breaking =
#(lambda (grob)
(let* ((pos (ly:grob-property grob 'positions))
(y-length (interval-length pos))
(st (ly:tuplet-bracket::print grob))
(st-x-ext (ly:stencil-extent st X))
(st-x-length (interval-length st-x-ext))
(alpha (degrees->radians angl))
(new-start (+ (car pos) y-off))
(new-y (* st-x-length (tan alpha))))
(ly:grob-set-property! grob 'positions (cons new-start (+ new-start new-y)))))
#})
%----- test
\relative c' {
\tupletAngles #-0.3 #15
\times 2/3 {c c' c'}
\tupletUp
\tupletAngles #0.9 #-30
\times 2/3 {c c, c,}
}
Cheers,
Harm