2016-06-26 14:24 GMT+02:00 David Nalesnik <david.nales...@gmail.com>: > Hi Harm, > > On Sun, Jun 26, 2016 at 3:53 AM, Thomas Morley <thomasmorle...@gmail.com> > wrote: >> 2016-06-26 5:00 GMT+02:00 Andrew Bernard <andrew.bern...@gmail.com>: >>> Hi Matteo, >>> >>> I have a tuplet angle function that somebody (I cannot recall who) >>> sent me some time ago. I use it heavily and extensively and I can say >>> it has been tested by me to the limit - it works well. >>> >>> Using this code you just say \tupletAngles 1 0 or similar and that's >>> all you need. Put it is a file tuplet-angles.ily and include it. Using >>> \tupletAngles 0 0 is very handy for straigthening up tuplets when you >>> don't want lilypond to angle them. >>> >>> Here it is. [Surprised this is not more well known.] >>> >>> Andrew >> >> Looking in the archives: >> http://lilypond.1069038.n5.nabble.com/angle-of-a-tuplet-bracket-td55019.html#a55023 >> :) >> > > A very useful function!
Glad it's still of some use. > It occurs to me that you could override 'positions directly without > consulting the stencil, instead of as a side-effect: Indeed, much more elegant. > > %% =========================================== > tupletAngles = > #(define-music-function (y-off angl)(number? number?) > " > y-off a (possible) offset in Y-direction > angl is supposed to be the angle of the TupletBracket in degrees, > " > #{ > \once\override TupletBracket #'positions = > #(lambda (grob) > (let* ((pos (ly:tuplet-bracket::calc-positions grob)) > (y-length (interval-length pos)) > (x-length (interval-length > (ly:tuplet-bracket::calc-x-positions grob))) > (alpha (degrees->radians angl)) > (dir (ly:grob-property grob 'direction)) > (new-start (+ (if (= dir 1) > (max (car pos)(cdr pos)) > (min (car pos)(cdr pos))) > y-off)) > (new-y (* x-length (tan alpha)))) > (cons new-start (+ new-start new-y)))) > #}) > > horizontalTuplets = > \override TupletBracket #'positions = > #(lambda (grob) > (let* ((pos (ly:tuplet-bracket::calc-positions grob)) > (dir (ly:grob-property grob 'direction)) > (new-pos (if (= dir 1) > (max (car pos)(cdr pos)) > (min (car pos)(cdr pos))))) > (cons new-pos new-pos))) > > %% =========================================== > > (For newer versions, maybe it would be helpful to work in the > grob-transformer function?) > > --DN I've to admit I forgot about grob-transformer, before you mentioned it. David K put up some examples replying to user requests, but I think it should be documented more widely, maybe a snippet in /Documentation/snippets will do it already or additionally(?) an entry in the extending-manual. Thanks for the reminder, Harm _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user