[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Slashed beam
From: |
David Kastrup |
Subject: |
Re: Slashed beam |
Date: |
Sun, 25 Dec 2011 07:57:46 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) |
Thomas Morley <address@hidden> 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