[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lilypond-user
Subject:    Re: typesetting Christian Wolff Excersize
From:       Valentin Petzel <valentin () petzel ! at>
Date:       2021-10-31 20:52:31
Message-ID: 24072266.4Xnnqu1Y22 () siductionbox
[Download RAW message or body]

[Attachment #2 (multipart/mixed)]


Hi Lukas, hi Ole,

Getting the parentheses is quite a simple modification (just use parenthesize-
stencil on the arrowhead stencil. But I think that using straight arrow lines 
is more readable than the slightly concave arrow head markup.

See the appended files for details.

Cheers,
Valentin

Am Sonntag, 31. Oktober 2021, 19:54:48 CET schrieb Lukas-Fabian Moser:
> Hi Ole,
> 
> Am 31.10.21 um 19:13 schrieb ole:
> > I've already removed the stem-engraver in the \layout part (to get the
> > quarter notes without stem)
> 
> I just want to point out that removing the stem engraver removes the
> stems "for good". Often, one wants to remove the stems but wants to be
> able to switch them on again at some later point in the score; in this
> case, it's better to just do \omit Stem (in \layout {} or in your music)
> which can be undone.
> 
> (Strictly speaking, removing the engraver does more than just \omitting
> the object, which in turn is more than just \hide'ing it.)
> 
> > Does someone have a solution for that particular spot by chance,
> > otherwise I thing about using Inkscape..?
> 
> One possibility would be to abuse stems for this. (This does not work if
> the Stem engraver is removed, see above.)
> 
> A first approximation:
> 
> \version "2.22"
> 
> connectArrowStem =
> #(define-music-function (dir) (ly:dir?)
>     #{
>       \once {
>         \undo \omit Stem % in case someone \omit'ted them :-)
>         \override Stem.length-fraction = 0
>         \override Stem.X-offset = 0.65
>         \override Stem.thickness = 2
>         \override Stem.stencil =
>         #(grob-transformer
>           'stencil
>           (lambda (grob stem)
>             (let* ((Y-ext (ly:stencil-extent stem Y))
>                    (Y-pos (interval-index Y-ext (* dir 0.3))))
>               (ly:stencil-add
>                stem
>                (ly:stencil-translate-axis
>                 (grob-interpret-markup grob (markup #:arrow-head Y dir #f))
>                 Y-pos Y)))))
>       }
>     #})
> 
> {
>    \omit Stem
>    c'4 d' e'4
>    \connectArrowStem #UP <c' g''>4
>    \connectArrowStem #DOWN <b' g''>
> }
> 
> This still causes problems if the two notes are too close together
> (because LilyPond still creates a stem protruding over one of the notes).
> 
> I also didn't implement the parentheses yet.
> 
> Lukas
["arrow-pars.ly" (arrow-pars.ly)]

\version "2.22"

connectArrowStem =
#(define-music-function (dir) (ly:dir?)
    #{
      \once {
        \undo \omit Stem % in case someone \omit'ted them 
        \override Stem.length-fraction = 0
        \override Stem.X-offset = 0.65
        \override Stem.thickness = 2
        \override Stem.stencil =
        #(grob-transformer
          'stencil
          (lambda (grob stem)
            (let* ((Y-ext (ly:stencil-extent stem Y))
                   (Y-pos (interval-index Y-ext (* dir 0.3))))
              (ly:stencil-add
               stem
               (ly:stencil-translate-axis
                (parenthesize-stencil (grob-interpret-markup grob (markup \
#:arrow-head Y dir #f)) 0.08 0.25 0.4 0.07)  Y-pos Y)))))
      }
    #})

{
   \omit Stem
   c'4 d' e'4
   \connectArrowStem #UP <c' g''>4
   \connectArrowStem #DOWN <b' g''>
}


["arrow-straight-pars.ly" (arrow-straight-pars.ly)]

\version "2.22"

connectArrowStem =
#(define-music-function (dir) (ly:dir?)
    #{
      \once {
        \undo \omit Stem % in case someone \omit'ted them 
        \override Stem.length-fraction = 0
        \override Stem.X-offset = 0.65
        \override Stem.thickness = 2
        \override Stem.stencil =
        #(grob-transformer
          'stencil
          (lambda (grob stem)
            (let* ((Y-ext (ly:stencil-extent stem Y))
                   (Y-pos (interval-index Y-ext 0)))
              (ly:stencil-add
               stem
               (ly:stencil-translate-axis
                (parenthesize-stencil
                 (grob-interpret-markup grob
                                        (if (= dir UP)
                                            (markup #:with-dimensions '(-0.6 . 0.6) \
'(-0.65 . 0.55) #:postscript "0.15 setlinewidth -0.6 -0.4 moveto 0 0.4 lineto 0.6 \
-0.4 lineto stroke")  (markup #:with-dimensions '(-0.6 . 0.6) '(-0.55 . 0.65) \
#:postscript "0.15 setlinewidth -0.6 0.4 moveto 0 -0.4 lineto 0.6 0.4 lineto \
stroke")))  0.08 0.25 0.4 0)
                Y-pos Y)))))
      }
    #})

{
   \omit Stem
   c'4 d' e'4
   \connectArrowStem #UP <c' g''>4
   \connectArrowStem #DOWN <b' g''>
}


["signature.asc" (application/pgp-signature)]

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic