lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Parenthesize slashed grace with fingering?


From: Olivier Biot
Subject: Re: Parenthesize slashed grace with fingering?
Date: Wed, 2 Jan 2013 23:39:17 +0100

On Wed, Jan 2, 2013 at 10:59 PM, Colin Campbell <address@hidden> wrote:
In transcribing some cello exercises, I need to show a slashed grace note, with a fingering, in parentheses.  The exercise involves shifting between first and third position on the same string, so it emphasizes the intermediate "target" position, with the intent that the grace note gets eliminated as the shift gets smoother.  The following gives me all I need except for the parentheses.  I'm a bit foggy from a virus, and I cannot find the magic incantation which will show both the grace note and the parenthesis. Using 2.17.10, by the way.
%<%<%<%<%<%<%<%<%<

e'2-1 ( \parenthesize \slashedGrace gs8-1 a2-2


%<%<%<%<%<%<%<%<%<

Any pointers to TFM or LSR gratefully received!

Cheers,
Colin

Hi Colin,

I found something in LSR snippet 186 (http://lsr.dsi.unimi.it/LSR/Item?id=186).

Here's a working example:

%%% BEGIN snippet:
\version "2.16.1"
\include "english.ly"

% LSR http://lsr.dsi.unimi.it/LSR/Snippet?id=186
#(define (parenthesize-callback callback)
   (define (parenthesize-stencil grob)
     (let* ((fn (ly:grob-default-font grob))
            (pclose (ly:font-get-glyph fn "accidentals.rightparen"))
            (popen (ly:font-get-glyph fn "accidentals.leftparen"))
            (subject (callback grob))
            ;; get position of stem
            (stem-pos (ly:grob-property grob 'stem-attachment))
            ;; remember old size
            (subject-dim-x (ly:stencil-extent subject X))
            (subject-dim-y (ly:stencil-extent subject Y)))

       ;; add parens
       (set! subject
             (ly:stencil-combine-at-edge
              (ly:stencil-combine-at-edge subject X RIGHT pclose 0)
              X LEFT popen 0))

       ;; adjust stem position
       (set! (ly:grob-property grob 'stem-attachment)
             (cons (- (car stem-pos) 0.43) (cdr stem-pos)))

       ;; adjust size
       (ly:make-stencil
        (ly:stencil-expr subject)
        (interval-widen subject-dim-x 0.5)
        subject-dim-y)))

   parenthesize-stencil)

\relative c'' {
  e2-1 ( \once \override NoteHead #'stencil = #(parenthesize-callback ly:note-head::print) \slashedGrace gs8-1  a-2 )
}
%%% END snippet

Hope this helps.

Best regards,

Olivier

reply via email to

[Prev in Thread] Current Thread [Next in Thread]