lilypond-user
[Top][All Lists]
Advanced

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

Re: How to tweak X-Y-offset of left Fingerings in a chord


From: Thomas Morley
Subject: Re: How to tweak X-Y-offset of left Fingerings in a chord
Date: Wed, 14 Apr 2021 11:58:21 +0200

Am Mi., 14. Apr. 2021 um 11:48 Uhr schrieb Thomas Morley
<thomasmorley65@gmail.com>:
>
> Am Mi., 14. Apr. 2021 um 10:30 Uhr schrieb Jean Abou Samra 
> <jean@abou-samra.fr>:
> >
> >
> > Le 13/04/2021 à 23:18, Thomas Morley a écrit :
> >
> > Hi,
> >
> > let's say I've a chord with Fingerings left.
> > Now I want to tweak a certain Fingering a little bit up/down and left/right.
> >
> > How to do so?
> >
> > Here a minimal to play with:
> >
> > {
> >   \set fingeringOrientations = #'(left)
> >   <c'-3 e'-2>
> >
> >   %% below does not work
> >   \once \override Fingering.Y-offset = 10
> >   \once \override Fingering.X-offset = 10
> >   <c'-3 e'-2>
> >
> >   <c'-\tweak Y-offset #-10 -3 e'-\tweak Y-offset #10 -2>
> > }
> >
> > Changing fingeringOrientations is not an option.
> > Using extra-offset neither, because the Fingering will be the right
> > bound of the FigerGlideSpanner, which would look misplaced then.
> >
> >
> > Any hints?
> >
> >
> > Thanks,
> >   Harm
> >
> >
> > Hi,
> >
> > Something very weird seems to be going
> > on. Try:
> >
> > {
> >   \set fingeringOrientations = #'(left)
> >   \once \override Staff.FingeringColumn.positioning-done =
> >     #(lambda (grob)
> >        (let* ((fingering-array (ly:grob-object grob 'fingerings))
> >               (fingerings (ly:grob-array->list fingering-array)))
> >          (for-each
> >            (lambda (fingering x)
> >              (ly:message "Before: ~s" (ly:grob-property-data fingering 
> > 'X-offset))
> >              (ly:grob-set-property! fingering 'X-offset x)
> >              (ly:message "After: ~s" (ly:grob-property-data fingering 
> > 'X-offset)))
> >            fingerings
> >            '(0 -10))
> >          #t))
> >   <c'\tweak X-offset -4 -3 e'-2>
> > }
> >
> > This displays
> >
> > Before: ()
> >
> > After: 0
> >
> > Before: ()
> >
> > After: -10
> >
> > No X-offset before seems somewhat odd, but why
> > not. Maybe something that I haven't yet understood
> > is setting it.
> >
> > However, the values 0 and -10 have no effect.
> > Instead, the \tweak takes effect (try changing
> > the -4), even though the value it gives to the
> > property is supposed to be overwritten.
> >
> > This very much reminds me of
> > https://lists.gnu.org/archive/html/bug-lilypond/2021-01/msg00014.html ...
> >
> > For X-offset, the following seems to do the trick
> > as long as the values are negative:
> >
> > {
> >   \set fingeringOrientations = #'(left)
> >   \once \override Staff.FingeringColumn.positioning-done = ##t
> >   <c'\tweak X-offset -4 -3 e'\tweak X-offset -2 -2>
> > }
> >
> > For Y-offset, I haven't found a workaround yet.
> >
> >
> > Cheers,
> > Jean
>
> I had a look at fingering-column.cc. While my C++-knowledge is aprox.
> zero, It seems that X/Y-offset is simply ignored, and positioning is
> done via the C++ version of ly:grob-translate-axis!, I could be wrong,
> though.
>
> Nevertheless, using it like below seems to work:
>
> \version "2.23.2"
>
> moveColumnedFinger =
> #(define-music-function (finger x-y-move)(index? pair?)
> #{
>   \override Staff.FingeringColumn.positioning-done =
>   #(lambda (grob)
>     (let* ((fingers-array (ly:grob-object grob 'fingerings))

Btw, 'fingerings as a pointer from FingeringColumn to its containing
Fingerings is completely undocumented, afaict.

>            (fingers
>              (if (ly:grob-array? fingers-array)
>                  (ly:grob-array->list fingers-array)
>                  '()))
>            (digit-grob-alist
>              (map
>                (lambda (finger)
>                  (cons
>                    (ly:event-property (event-cause finger) 'digit)
>                    finger))
>                fingers)))
>
>     (ly:grob-set-property!
>       (assoc-get finger digit-grob-alist) 'color red)
>     (ly:grob-translate-axis!
>       (assoc-get finger digit-grob-alist) (car x-y-move) X)
>     (ly:grob-translate-axis!
>       (assoc-get finger digit-grob-alist) (cdr x-y-move) Y)
>     (ly:fingering-column::calc-positioning-done grob)))
> #})
>
>
> {
>   \set fingeringOrientations = #'(right)
>   < c'\glide-3 e'\glide-2 >2
>   s1*2
>   \set fingeringOrientations = #'(left)
>   \once \moveColumnedFinger 2 #'(-1 . 1)
>   < d'-3 fis'-2 >2
> }
>
> Ofcourse only one Fingering can be moved with this code.
> While it is not too hard to extend this coding for moving multiple
> Fingerings at once, it would be inconveniant calling it in a .ly-file.
> Itw ould result in something at the lines of:
>
> \moveColumnedFingers
>   #(list
>     '(1 . (x1 . y1))
>     '(2 . (x2 . y2))
>     '(3 ... )
>     ...)
>
> Not a nice user-interface, I'd say.
>
> Additional, it would not work with only one Fingering present in chord
> like <c'-3 e'>
> Thus. I wonder, if it would be better toalways create a FingerigColumn.
>
> Thanks,
>   Harm



reply via email to

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