Here's the function I use for indicating harmonics:
%===========================================================================
==========
harmonics = #(define-music-function (parser location text osp shorten
adjBreak adjEnd)
(string? number? pair? number? number?)
#{
% osp can be normally be set to zero unless you need to resolve a
collision
\once \override TextSpanner #'outside-staff-priority = #$osp
\once \override TextSpanner #'bound-details #'left #'text = \markup
{ \teeny $text }
% setup dashed line and draw a bracket edge on RHS
\once \override TextSpanner #'dash-period = #1.5
\once \override TextSpanner #'dash-fraction = #0.6
\once \override TextSpanner #'thickness = #0.8
\once \override TextSpanner #'bound-details #'right #'text = \markup
{ \draw-line #'(0 . -0.5) }
% set alignment of line with reference to left text
\once \override TextSpanner #'bound-details #'left
#'stencil-align-dir-y = #CENTER
\once \override TextSpanner #'bound-details #'left #'padding = #(car
$shorten)
\once \override TextSpanner #'bound-details #'right #'padding =
#(cdr $shorten)
% allow adjustment of line end when it wraps to following stave
\once \override TextSpanner #'bound-details #'right-broken #'padding
= #$adjEnd
% adjust LH end of line when it wraps to following stave so that it
doesn't
% extend to the left of the notes on the stave
\once \override TextSpanner #'bound-details #'left-broken #'X =
#$adjBreak
% optional override to remove text and bracket edge at line breaks
% \once \override TextSpanner #'bound-details #'left-broken #'text =
##f
\once \override TextSpanner #'bound-details #'right-broken #'text =
##f
#})
%===========================================================================
==========
Here is its actual use in a score:
%==================================================
\override NoteHead #'style = #'harmonic-mixed
\harmonics "harm. 8va " #0 #'(0 . -1.5) #5 #1
e,4\startTextSpan\ppp\< fs4. gs8 |
a4\> g4. f8\! |
e4\< fs4. gs8\! |
b4 d4.\sf c8 |
b4\p\> a4. g8\! |
e4\< d4. c8 |
fs4\pp\> e4. d8 |
c4 as4. c8\! |
\once\override Hairpin #'minimum-length = #8
b4\pp\stopTextSpan\<
\revert NoteHead #'style fs''4.\> b,8\! |
%==================================================
Nick
-----Original Message-----
From: address@hidden
[mailto:address@hidden On
Behalf Of David Stocker
Sent: Wednesday, 1 July 2009 1:28 PM
To: address@hidden
Subject: spanner question
Hello folks,
I have a question about a text spanner in a pre-defined variable.
In the snippet below, the first example does everything I want except
that in the first line of music, the spanner line doesn't extend to the
barline at the end of the line. I've achieved this by using two
pre-defined variables for the text spanner I want: one to start it, and
one to finish it with a terminal ending.
In the second example, the spanner extends to the end of the first line
of music (with a terminal ending that I *don't* want) and then, starts
too far to the left on the second line. The terminal ending at the
conclusion of the chord acts the way I want it to.
My goal is to define a single variable (perhaps a music function) that
will fulfill these requirements:
* Extends over multiple systems, extending to the last measure's
barline without the terminal ending
* Picks up at the beginning of subsequent lines with identical
positioning as the initiation of the spanner
* Dynamically adds a terminal ending to the end of the spanner
Has anyone worked on this issue already (possibly with a scheme
function)?
Also, the final destination for this is most probably going to be a
"\include" file with many (dozens?) pre-defined variables for common
text spanners used in guitar music. If I achieve the results I hope
for,
I plan to share it with the community.
Thanks,
David
Here's the snippet:
%%% begin ly snippet %%%
\version "2.13.1"
harmOn = {
\override Voice.NoteHead #'style = #'harmonic-mixed
\tieDashed
} %% Set harmonics to diamond noteheads with dashed ties
harmXII = {
\override TextSpanner #'(bound-details left text) = \markup { \teeny
\upright"Arm. XII " }
\once \override TextSpanner #'(bound-details right padding) = #-0.75
\once \override TextSpanner #'(bound-details left padding) = #-0.25
\once \override TextSpanner #'(bound-details left stencil-align-dir-
y)
= #CENTER
}
harmXIIterm = {
\override TextSpanner #'(bound-details left text) = \markup { \teeny
\upright"Arm. XII " }
\override TextSpanner #'(bound-details right text) = \markup {
\draw-line #'(0 . -0.75) }
\once \override TextSpanner #'(bound-details right padding) = #-0.75
\once \override TextSpanner #'(bound-details left padding) = #-0.25
\once \override TextSpanner #'(bound-details left stencil-align-dir-
y)
= #CENTER
}
exOne= {
\relative c' {
\harmOn
\harmXII
\textSpannerUp
\mark \markup { \bold "Example 1" }
<e a d g b e>1~ \startTextSpan | <e a d g b e>1 | <e a d g b e>1~ |
<e a d g b e>1 \stopTextSpan \break \harmXIIterm <e a d g b e>1~
\startTextSpan <e a d g b e> \stopTextSpan \bar "||"
}
}
exTwo = {
\relative c' {
\harmOn
\harmXIIterm
\textSpannerUp
\mark \markup { \bold "Example 2" }
<e a d g b e>1~ \startTextSpan | <e a d g b e>1 | <e a d g b e>1~ | <e
a
d g b e>1 \break <e a d g b e>1~ <e a d g b e> \stopTextSpan \bar "||"
}
}
\score {
\exOne
}
\score {
\exTwo
}
%%% end ly snippet %%%
_______________________________________________
lilypond-user mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user
Checked by AVG - www.avg.com
Version: 8.5.375 / Virus Database: 270.13.2/2213 - Release Date:
07/01/09 18:07:00