Thomas Morley <thomasmorle...@googlemail.com> writes:

> this should compile (tested with "2.15.20"):
>
> \version "2.15.20"
>
> \layout {
>    ragged-right = ##f
>    point-and-click = ##f
> }
>
> %% Arguments to Makeslash (all numbers are in staff units):
> %%
> %% #1: angle
> %% #2: length of the left  half of the slash
> %% #3: length of the right half of the slash
> %% #4: thickness
> %% #5: factor to shift the slash relative to the stem (+1/-1 =
> attached to top/bottom)
> %% #6: offset as a pair (x-offset, y-offset)
> %%
> %% Values other than +/-1 in arguments #5 and #6 are interpolated.
>
> MakeSlash = #(define-music-function (parser location angle len-left
> len-right thick y-factor offset)
>                                     (number? number? number? number?
> number? pair?)
> #{
> \once \override Voice.Stem #'text = \markup {
>     \postscript #(let ((x-off (car offset))
>                        (y-off (cdr offset)))
>     (string-append
>     (ly:number->string (car offset)) " " (ly:number->string (cdr
> offset)) " translate "
>     (ly:number->string angle) " rotate "
>     (ly:number->string (- x-off)) " "
>     (ly:number->string (- y-off)) " translate 0 setlinewidth "
>     (ly:number->string (- x-off len-left))  " " (ly:number->string (+
> y-off thick)) " moveto "
>     (ly:number->string (- x-off len-left))  " " (ly:number->string y-off)
>                                              " " (ly:number->string
> thick) " 90 270 arc "
>     (ly:number->string (+ x-off len-right)) " " (ly:number->string y-off)
>                                              " " (ly:number->string
> thick) " 270 90 arc "
>                                              " gsave fill grestore stroke")) }

Looks like being restricted to PostScript-based backends.  Should be
possible to do this with the generic drawing primitives, right?

Also it might be easier on the eyes to use `format' here.

-- 
David Kastrup


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to