lilypond-user
[Top][All Lists]
Advanced

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

Re: String number spanner


From: Olivier Biot
Subject: Re: String number spanner
Date: Sat, 29 Dec 2012 14:08:36 +0100

On Fri, Dec 28, 2012 at 6:19 PM, Olivier Biot <address@hidden> wrote:
On Fri, Dec 28, 2012 at 6:14 PM, Phil Burfitt <address@hidden> wrote:
From: "Nick Payne"


I'm stuck on the last part of getting this working - the part that is eluding me is getting a short vertical line drawn at the RH end of the spanner. According the the Internals reference, UP = 1 and DOWN = -1, and that works fine when I use the return value from the updown function to set TextSpanner.direction in beginStringNum. But when I try to use the value returned from updown in the section of code that is commented out in beginStringNum, I get an error. If I hardcode 1 or -1 instead of updown then the line is drawn as expected.

I also tried the righttext function below to draw the line: no error is indicated but neither is the vertical line drawn.

Oops. Forgot to remove the comment for the right "hook" - here's a corrected version:
 
This is a spanner with an end 'hook' - I use it for telling in which cello position a passage should be played:

\version "2.16.1"
% Allows to draw a dashed text spanner for highlighting sections with a given playng position in a score
stringNumberSpanner =
#(define-music-function (parser location stringNumber) (string?)
   #{
     \override TextSpanner #'style = #'dashed-line
     \override TextSpanner #'dash-period = #1.5
     \override TextSpanner #'dash-fraction = #0.5
     \override TextSpanner #'font-size = #-5
     \override TextSpanner #'font-shape = #'upright
     \override TextSpanner #'(bound-details left stencil-align-dir-y) = #CENTER
     \override TextSpanner #'(bound-details left text) = \markup { \number $stringNumber }
     \override TextSpanner #'(bound-details right text) = \markup { \draw-line #'(0 . -1) }
     \override TextSpanner #'outside-staff-priority = 500
   #}
   )


If you need some examples on how & what can be done with spanners, please visit the following link:
http://www.lilypond.org/doc/v2.16/Documentation/snippets/expressive-marks#expressive-marks-creating-text-spanners
It's where I found my inspiration.

From what I understand you still want to conditionally have an up "hook" ( \markup { \draw-line #'(0 . 1) } ) when the spanner is displayed below the staff and a down "hook" (\markup { \draw-line #'(0 . -1) }) when the spanner appears above the staff. This is something I can't help with, apart from defining 2 music-function instances with each variant hard-coded.

Best regards,

Olivier

reply via email to

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