lilypond-user
[Top][All Lists]
Advanced

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

Re: fingering


From: Gianmaria Lari
Subject: Re: fingering
Date: Mon, 21 Jan 2019 15:04:15 +0100



On Fri, 23 Feb 2018 at 08:43, Gianmaria Lari <address@hidden> wrote:

On 23 February 2018 at 00:53, Thomas Morley <address@hidden> wrote:
2018-02-22 11:03 GMT+01:00 Thomas Morley <address@hidden>:
> 2018-02-22 10:58 GMT+01:00 Gianmaria Lari <address@hidden>:
>> Dear Harm,
>>
>> thank you for your really nice help. Your fix worked well and now your
>> example is perfect!
>>
>> I hope others will take advantage of it.
>>
>> I copy here the final working code with a screenshot.
>
> Glad you like it :)
>
> This morning I observed a certain weakness in the code, a missing
> safety net to be more precise.
> I'll have a deeper look this evening. Now I have to run for my regular job ...
>
> Cheers,
>   Harm

Likely safer to check whether a stencil is present before trying to
change it. At least it calms down my paranoia ...

adjustFC =
  \override Staff.FingeringColumn.before-line-breaking =
    #(lambda (grob)
       "Sets @code{snap-radius} of @code{FingeringColumn} to @code{3} and
        applies @code{centered-stencil} to every fingering-stencil"
       (let*  ((fingerings (ly:grob-object grob 'fingerings))
               (fingering-ls
                 (if (ly:grob-array? fingerings)
                     (ly:grob-array->list fingerings)
                     '())))
         (ly:grob-set-property! grob 'snap-radius 3)
         (for-each
           (lambda (f)
             (let ((f-stil (ly:grob-property f 'stencil)))
               (if (ly:stencil? f-stil)
                   (ly:grob-set-property! f 'stencil
                     (centered-stencil f-stil)))))
           fingering-ls)))

Cheers,
  Harm

Ciao Harm,

tried your new safer code: it works perfectly like the previous :)
I update my snippet database :))

Thanks a lot, Gianmaria

Hi Tomas,
Using your old code to draw a circle around finger number on the left of the note today I found a problem. When I use "\omit Fingering" the compilation report me the error:

programming error: Infinity or NaN encountered

\omit Fingering <g'

-2 c''-\cFS-4>


Here it is a simple code showing the problem:

\version "2.19.82"
%% returns a stencil (created by `ly:text-interface::print') within a circle
circledFingerStil =
#(lambda (grob)
   (circle-stencil (ly:text-interface::print grob) 0.1 0.1))

%% tweak-short-cut
cFS =
\tweak stencil \circledFingerStil
\etc

adjustFC =
\override Staff.FingeringColumn.before-line-breaking =
#(lambda (grob)
   "Sets @code{snap-radius} of @code{FingeringColumn} to @code{3} and
        applies @code{centered-stencil} to every fingering-stencil"
   (let*  ((fingerings (ly:grob-object grob 'fingerings))
           (fingering-ls
            (if (ly:grob-array? fingerings)
                (ly:grob-array->list fingerings)
                '())))
     (ly:grob-set-property! grob 'snap-radius 3)
     (for-each
      (lambda (f)
        (let ((f-stil (ly:grob-property f 'stencil)))
          (if (ly:stencil? f-stil)
              (ly:grob-set-property! f 'stencil
                (centered-stencil f-stil)))))
      fingering-ls)))


\score 
 { \set fingeringOrientations = #'(left) \adjustFC
  \omit Fingering <g'-2 c''-\cFS-4> 
  \undo \omit Fingering
 }
  \layout {}
}

Do you know how to fix it?

Thank you, g.

reply via email to

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