Dear Thomas,
thanks for Your reply!
Unfortunately the code doesn't work for me, I get the error message:

> Processing `/tmp/lyp/wrappers/bendbefore.ly'
>
> Parsing...
>
> Interpreting music...
>
> Preprocessing graphical objects...
>
> Finding the ideal number of pages...
>
> Fitting music on 1 page...
>
> Drawing systems...
>
> Layout output to `/tmp/lilypond-TlFzo5'...<unnamed port>: In expression
> (rmoveto 12.500042 -2.5 ...):
>
> <unnamed port>: Unbound variable: rmoveto
>
Is Your code written for 2.20.0?
Thanks,
Stefan

Am Do., 3. Dez. 2020 um 23:13 Uhr schrieb Thomas Morley <
thomasmorle...@gmail.com>:

> Am Mi., 2. Dez. 2020 um 17:10 Uhr schrieb Stefan Thomas
> <kontrapunktste...@gmail.com>:
> >
> > Dear community,
> > I found a  working code for a bend-before command. I would like to know,
> how I could increase the distance between the bending-sign and the
> accidental.
> > Thanks for your help.
> > Stefan
> > %%%%%%%%%% SNIPPPET %%%%%%%%%%%%%%%%%
> >   #(define (scp-stencil grob)
> >     (ly:stencil-combine-at-edge
> >      (ly:note-head::print grob) 0 -1
> >      (grob-interpret-markup grob
> >       #{
> >          \markup
> >          \with-dimensions-from \null
> >          \path #0.2 #'((moveto -2 -1.8)(curveto -1.2 -1.8 -.5 -1.28 -.3
> -.3))
> >        #} ) 0 ))
> >
> >   scp = \once \override NoteHead.stencil = #scp-stencil
> >
> >   {
> >     \clef F
> >     \key g\major
> >     bes4 \scp a g fis
> >     \repeat unfold 4 { r8 \scp gis' }
> >     \repeat unfold 3 { \scp g'!4 }
> >     \scp  g' fis'!
> >   }
> >   %%% END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> > (copied from
> https://lists.gnu.org/archive/html/lilypond-user/2020-06/msg00000.html )
>
> How about below?
> It uses the logic of BendAfter.stencil in a modified way.
> The argument of \bendBefore is the vertical start relative to the NoteHead.
> The width is determined by left and right bound.
> Both like for \bendAfter.
> Here the _left_ bound is the previous (NonMusical)PaperColumn, _right_
> bound the NoteHead.
> This causes 'minimum-length to be useless, to lengthen the bend-curve
> move the NoteColumn of the target NoteHead.
>
> %% DISCLAIMER
> %% This is a very fast first sketch, don't use it for serious work before
> %% having tested it thoroughly
>
> %% c/p from output-lib.scm and modified
> #(define-public (bend::print-harm spanner)
>   (define (close  a b)
>     (< (abs (- a b)) 0.01))
>
>   (let* ((lb (ly:spanner-bound spanner LEFT))
>          (left-col (ly:item-get-column lb))
>          (left-neighbor (ly:grob-object left-col 'left-neighbor)))
>     (ly:spanner-set-bound! spanner LEFT left-neighbor)
>     (ly:spanner-set-bound! spanner RIGHT lb)
>
>     (let* ((delta-y (* 0.5 (ly:grob-property spanner 'delta-position)))
>            (left-span left-neighbor)
>            (right-span lb)
>            (thickness (* (ly:grob-property spanner 'thickness)
>                          (ly:output-def-lookup (ly:grob-layout spanner)
>                                                'line-thickness)))
>            (padding (ly:grob-property spanner 'padding 0.5))
>            (common
>              (ly:grob-common-refpoint
>                right-span
>                (ly:grob-common-refpoint spanner left-span X)
>                X))
>            (common-y (ly:grob-common-refpoint spanner left-span Y))
>            (minimum-length (ly:grob-property spanner 'minimum-length 0.5))
>            (left-x
>              (+ padding
>                 (interval-end
>                   (ly:generic-bound-extent left-span common))))
>            (acc (ly:grob-object right-span 'accidental-grob))
>            (right-x
>              (max (- (interval-start
>                        (if (ly:grob? acc)
>                            (ly:generic-bound-extent acc common)
>                            (ly:generic-bound-extent right-span common)))
>                      padding)
>                   (+ left-x minimum-length)))
>            (self-x (ly:grob-relative-coordinate spanner common X))
>            (dx (- right-x left-x))
>            (exp (list 'path thickness
>                       `(rmoveto
>                         ,(- left-x self-x) ,(- delta-y)
>                         rcurveto
>                         ,(/ dx 3) 0
>                         ,dx ,(* 0.66 delta-y)
>                         ,dx ,delta-y))))
>
>       (ly:make-stencil
>        exp
>        (cons (- left-x self-x) (- right-x self-x))
>        (ordered-cons 0 (- delta-y))))))
>
> bendBefore =
>   -\tweak stencil #bend::print-harm
>   -\bendAfter \etc
>
> %%%%%%%%%%%%%%%%%%%%%%%%
> %% EXAMPLES
> %%%%%%%%%%%%%%%%%%%%%%%%
>
> %% DISADVANTAGE
> %% Using minimum-length will lead to undesired results
> %% Instead, move the NoteColumn
>
>
> \relative c'' {
>   \omit Staff.TimeSignature
>   \key cis \major
>   \override Score.SpacingSpanner.shortest-duration-space = #4.0
>   %\override BendAfter.padding = 1
>   cis2-\bendBefore #5
>   c2-\bendBefore #4
>   |
>   %\break
>   \once \override NoteColumn.X-offset = 3
>   ees2-\bendBefore #-4.75
>   c2-\bendBefore #8.5
>   |
>   \once \override NoteColumn.X-offset = 3
>   fis1-\bendBefore #-6
> }
>
> HTH a bit,
>   Harm
>

Reply via email to