[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: non-markup stencils
From: |
Jonatan Liljedahl |
Subject: |
Re: non-markup stencils |
Date: |
Mon, 2 May 2005 00:13:44 -0300 |
On Sat, 30 Apr 2005 15:05:27 +0200
Sean Reed <address@hidden> wrote:
> thanks again han-wen, mats, donald axel, jonatan, and fairchild for
> the help with the bartok pizz. it opened my eyes a bit to the
> flexibility of self-programmed extensions, specifically for extended
> performance techniques.
>
> i am now attempting to put a little cross on the stems of notes for
> passages or pitches which are to be performed battuto (strings) or
> with "slap" articulations for winds.
>
> i attempted to modify your examples with the attached patch (see
> below), but the crosses always remain at a static x-y coordinate. i
> assume this is because i defined it as a markup command. is there a
> way to define a stencil (forgive me if it's incorrect terminology)
> that would place a cross in the note's corresponding stem while
> automatically modifying the y-coordinate so as to position it in the
> middle of that given stem (see attached example)?
>
> thanks for your help.
>
There was someone who requested a cross on the stems a while ago, and I
posted something which might be what your want. Try this:
%%% tested with 2.5.18 %%%
#(define (cross-callback callback)
(define (cross-stencil grob)
(let* ((cross (ly:font-get-glyph
(ly:get-default-font grob) "noteheads.s2cross"))
(s (callback grob))
(sx (ly:stencil-extent s 0))
(sy (ly:stencil-extent s 1))
(cx (ly:stencil-extent cross 0))
(xadj (/ (interval-length cx) 2))
(midy (+ (car sy) (/ (interval-length sy) 2))))
(set! s (ly:stencil-add s
(ly:stencil-translate cross (cons (- xadj) midy))))
(ly:make-stencil (ly:stencil-expr s) sx sy)))
cross-stencil)
stemCrossStart = \override Stem #'print-function
= #(cross-callback Stem::print)
stemCrossStop = \revert Stem #'print-function
/Jonatan -=( http://kymatica.com )=-