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.

\version "2.19.81"
%% 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)
                     '())))
                     (write grob)
         (ly:grob-set-property! grob 'snap-radius 3)
         (for-each
           (lambda (f)
             (ly:grob-set-property! f 'stencil
               (centered-stencil ((ly:grob-property-data f 'stencil) f))))
           fingering-ls)))

{
  %% NB FingeringColumn is created _only_ if `fingeringOrientations'
contains
  %% 'left or 'right _and_ more than one Fingering has to be placed there
  \set fingeringOrientations = #'(left)

  %% default
  <c'-1 d'-22 e'-333 f'-4444>1

  %% some circles around Fingerings
  <c'-1 d'-\cFS-22 e'-\cFS-333 f'-4444>1

  %% some circles around Fingerings plus adjusted FingeringColumn
  \once \adjustFC
  <c'-1 d'-\cFS-22 e'-\cFS-333 f'-4444>1
}

On 22 February 2018 at 01:09, Thomas Morley <thomasmorle...@gmail.com>
wrote:

> 2018-02-22 0:15 GMT+01:00 Gianmaria Lari <gianmarial...@gmail.com>:
> >
> >
> > On 21 February 2018 at 23:15, Thomas Morley <thomasmorle...@gmail.com>
> > wrote:
> >>
> >> 2018-02-21 9:29 GMT+01:00 Gianmaria Lari <gianmarial...@gmail.com>:
> >> >
> >> > On 20 February 2018 at 22:30, Thomas Morley <thomasmorle...@gmail.com
> >
> >> > wrote:
> >> >>
> >> >> 2018-02-20 18:42 GMT+01:00 Gianmaria Lari <gianmarial...@gmail.com>:
> >> >> > On 20 February 2018 at 17:10, Robin Bannister <r...@dabble.ch>
> wrote:
> >> >> >>
> >> >> >>  DJF wrote:
> >> >> >>
> >> >> >>>  perhaps someone else knows if it’s possible to control the
> >> >> >>> vertical
> >> >> >>> spacing within the staff;
> >> >> >>
> >> >> >>
> >> >> >> You can splay it out using Y-offset:
> >> >> >>  <d'-\tweak Y-offset 0.7 \4   b \3   g-\tweak Y-offset -0.9 -2 >1
> >> >> >
> >> >> >
> >> >> > Do you know Robin, if there is any way to avoid the "\tweak ..."
> and
> >> >> > make
> >> >> > Lilypond automatically spacing the fingering/stringNumber elements?
> >> >> >
> >> >> > Thank you, g.
> >> >>
> >> >>
> >> >>
> >> >> How about:
> >> >>
> >> >> \version "2.19.81"
> >> >>
> >> >> circledFingerStil =
> >> >>   #(lambda (grob)
> >> >>      (circle-stencil (ly:text-interface::print grob) 0.1 0.1))
> >> >>
> >> >> \fixed c' {
> >> >>   \set fingeringOrientations = #'(left)
> >> >>
> >> >>   <g-\tweak stencil \circledFingerStil -2
> >> >>    b-\tweak stencil \circledFingerStil-3
> >> >>    d'-4>1
> >> >>
> >> >>   \override Fingering.stencil = \circledFingerStil
> >> >>   <g-2 b-3 d'-4>1
> >> >> }
> >> >>
> >> >> There _is_ some buit-in code which avoids collisions of Fingering,
> but
> >> >>  it does not work for StringNumbers or a mix of Fingerings and
> >> >> StringNumbers, afaik.
> >> >>
> >> >> Cheers,
> >> >>   Harm
> >> >
> >> >
> >> > Ciao Harm,
> >> > thanks a lot for your code! It works very well.
> >> >
> >> > But I also have some questions.
> >> >
> >> > The circled and uncircled fingering are not horizontally aligned. Is
> >> > there
> >> > any way to align them?
> >> >
> >> > Is there any way to make the more easy to manage? I can write
> something
> >> > like
> >> > this
> >> >
> >> >   <g-\tweak stencil \circledFingerStil -2
> >> >    b-\tweak stencil \circledFingerStil-3
> >> >    d'-4>1
> >> >
> >> > just to test an idea but I don't want to use it in a real score.
> >> > Is there any way to reduce/encapsulate it to something less intrusive?
> >> >
> >> > Thank you!
> >> > G.
> >>
> >> Hi,
> >>
> >> try:
> >>
> >> \version "2.19.81"
> >>
> >> %% 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)
> >>                      '())))
>
> Please delete next line, it was a debugging aid
> >>                      (write grob)
> >>          (ly:grob-set-property! grob 'snap-radius 3)
> >>          (for-each
> >>            (lambda (f)
> >>              (ly:grob-set-property! f 'stencil
> >>                (centered-stencil ((ly:grob-property-data f 'stencil)
> f))))
> >>            fingering-ls)))
> >>
> >> {
> >>
> >>   %% NB FingeringColumn is created _only_ if `fingeringOrientations'
> >> contains
> >>   %% 'left or 'right _and_ more than one Fingering has to be placed
> there
> >>   \set fingeringOrientations = #'(left)
> >>
> >>   %% default
> >>   <c'-1 d'-22 e'-333 f'-4444>1
> >>
> >>   %% some circles around Fingerings
> >>   <c'-1 d'\cFS-22 e'\cFS-333 f'-4444>1
> >>
> >>   %% some circles around Fingerings plus adjusted FingeringColumn
> >>   \once \adjustFC
> >>   <c'-1 d'\cFS-22 e'\cFS-333 f'-4444>1
> >> }
> >>
> >> HTH,
> >>   Harm
> >
> >
> > Ciao Harm
> >
> > I just tried it (tomorrow I will try to see if I can understand how does
> it
> > work) but I get some compilation error:
> >
> > Starting lilypond-windows.exe 2.19.81 [Untitled]...
> >
> > Processing
> > `C:/Users/GIANMA~1/AppData/Local/Temp/frescobaldi-u4n32kzb/tmpi018rw4w/
> document.ly'
> >
> > Parsing...
> >
> > C:/Users/GIANMA~1/AppData/Local/Temp/frescobaldi-
> u4n32kzb/tmpi018rw4w/document.ly:41:11:
> > error: not a rhythmic event
> >
> > <c'-1 d'
> >
> > \cFS-22 e'\cFS-333 f'-4444>1
> [...]
>
> Hmm, I used selfcompiled 2.21.0. The relevant features are obviously
> not in 2.18.1.
> To make it work use a - before \cFS
>
> <c'-1 d'-\cFS-22 e'-\cFS-333 f'-4444>1
> etc
>
> Now tested with with 2.19.65
>
> Sorry,
>   Harm
>
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to