lilypond-user
[Top][All Lists]
Advanced

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

Re: Size of the arpeggio's arrow


From: Thomas Morley
Subject: Re: Size of the arpeggio's arrow
Date: Thu, 5 Dec 2019 19:02:37 +0100

Am Do., 5. Dez. 2019 um 18:17 Uhr schrieb Thomas Morley
<address@hidden>:
>
> Am Do., 5. Dez. 2019 um 17:57 Uhr schrieb Paolo Prete <address@hidden>:
> >
> >
> > Hi Thomas.
> > Yes, I'm interested. I could not find any snippet for that, nor a 
> > corresponding property for "Arpeggio" in the "Lilypond Internals Reference"
> > Thanks.
> >
> > Il giovedì 5 dicembre 2019, 16:22:12 GMT, Thomas Morley <address@hidden> ha 
> > scritto:
> >
> >
> > Am Do., 5. Dez. 2019 um 15:07 Uhr schrieb Paolo Pr <address@hidden>:
> >
> > >
> > > (I re-post this because it seems that mails from Yahoo services, like 
> > > some of my previous posts, are filtered as spam)
> > >
> > > Hello,
> > >
> > > how can I modify the size of the arrow of an \arpeggioArrowUp/Down object?
> > >
> > > Thanks
> >
> > >
> >
> > There is no builtin method to do so.
> > You could create your own stencil, though.
> >
> > Interested in learning howto?
> >
> >
> > Cheers,
> >   Harm
> >
> >
>
> Ok :)
> So what do we want?
> While applying \arpeggioArrowUp we want the usual arpeggio, but the
> added arrow-head should be sized as we want.
>
> Alas, as soon as we set \arpeggioArrowUp the default is there.
> Mmhh, what exactly does \arpeggioArrowUp?
> Looking into property-init.ly (found by some search-functions of your
> editor or some grepping):
>
> arpeggioArrowUp = {
>   \revert Arpeggio.stencil
>   \revert Arpeggio.X-extent
>   \override Arpeggio.arpeggio-direction = #UP
> }
>
> Interesting is arpeggio-direction, looks like it triggers the arrowed 
> arpeggio.
> Let's proof:
>
> {
>   \arpeggioArrowUp
>   R1
>   \override Arpeggio.arpeggio-direction = #'()
>   <b d' f' b'>\arpeggio
> }
>
> And indeed the arrow-head is gone.
>
> Now we can recreate the _default_-stencil explicitely, using the
> default-stencil, found in IR.
> I.e. the procedure ly:arpeggio::print
> NB, although we've set \arpeggioArrowUp
>
> {
>   \arpeggioArrowUp
>   R1
>   \override Arpeggio.arpeggio-direction = #'()
>   \override Arpeggio.stencil =
>   #(lambda (grob)
>      (ly:arpeggio::print grob))
>   <b d' f' b'>\arpeggio
> }
>
> Let us put the arpeggio-direction into the stencil-override for conveniance:
>
> {
>   \arpeggioArrowUp
>   R1
>   \override Arpeggio.stencil =
>   #(lambda (grob)
>      (ly:grob-set-property! grob 'arpeggio-direction '())
>      (ly:arpeggio::print grob))
>   <b d' f' b'>\arpeggio
> }
>
> Now we only need to add a suitable arrowhead to the stencil and are done.
>
>
> So I need a little break, I'm cooking right now ;)
>
>
> Cheers,
>   Harm

Now let's care about the arrow-head.
Probably you noticed the arrow-heads in A.8 "The Emmentaler font" of NR:
"scripts.arpeggio.arrow.1" and "scripts.arpeggio.arrow.M1"

Likely it's best to select the arrow-head depending on the direction, with

  (format #f
    "scripts.arpeggio.arrow.~a1"
    (if (negative? arp-dir)
        "M"
        ""))

where arp-dir is the arpeggio-direction, i.e. for no we disregard what
I said earlier.

Now we have the glyph and we need to look it up in the font.
Ok, so we need to get the font.

Maybe you stumbled across ly:grob-default-font already, with this one
we get the font.
Now we can lookup, using ly:font-get-glyph.

ly:grob-default-font and ly:font-get-glyph can be found in IR.
To learn how to use them you will need to look throuw our source-code, though.
I don't know much examples for it.

Disregarding the arpeggio, only putting out the arrow-head it makes for:


myArpeggio =
  \override Arpeggio.stencil =
  #(lambda (grob)
    (let* ((arp-dir (ly:grob-property grob 'arpeggio-direction))
           (arrow-glyph
             (format #f
               "scripts.arpeggio.arrow.~a1"
               (if (negative? arp-dir)
                   "M"
                   ""))))

     (ly:font-get-glyph (ly:grob-default-font grob) arrow-glyph)))

{
  \arpeggioArrowUp
  \myArpeggio
  <b d' f' b'>\arpeggio


  \arpeggioArrowDown
  \myArpeggio
  <b d' f' b'>\arpeggio
}

Now we've created single arrow-heads depending on the direction.


TODO:
Adjust size of the arrow-heads
Move them to the place where they should be
Combine it with the usual trill-like arpeggio-line


Laters,
  Harm



reply via email to

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