See attached. I already had a music function for indicating string numbers in 
guitar scores, and it only took a minute or two to modify it to have a 
different number on each end of the spanner.

Nick

> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On
> Behalf Of Patrick Schmidt
> Sent: Saturday, 15 August 2009 5:08 AM
> To: [email protected]
> Subject: horizontal/vertical text spanner alignment
> 
> Dear all,
> 
> how can I align a text spanner vertically and horizontally to get
> something like this ➂---➁? Here is a tiny example:
> 
> 
> \version "2.13.3"
> 
> scale = \relative c'' {
>       %\once \override TextSpanner #'(bound-details left Y) = #5
>       %\once \override TextSpanner #'(bound-details right Y) = #5
>       <g\3_0>\startTextSpan <a_2> <b_4>\stopTextSpan <c\2_1>
> }
> 
> \score {
>       \new Staff \scale
>       \layout {}
> }
> 
> I fiddled with \once \override TextSpanner #'(bound-details left/right
> Y) = #[±0-9] but to no avail.
> 
> Any hint is greatly appreciated.
> 
> Thanks for your help!
> 
> patrick
> --
> Neu: GMX Doppel-FLAT mit Internet-Flatrate + Telefon-Flatrate
> für nur 19,99 Euro/mtl.!* http://portal.gmx.net/de/go/dsl02
> 
> 
> _______________________________________________
> lilypond-user mailing list
> [email protected]
> http://lists.gnu.org/mailman/listinfo/lilypond-user
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.392 / Virus Database: 270.13.57/2303 - Release Date:
> 08/14/09 18:10:00

<<attachment: test.png>>

\version "2.13.3"

stringUp = #(define-music-function (parser location stringnuma stringnumb osp shorten adjBreak adjEnd) (string? string? number? pair? number? number?) #{
	% set osp to 999 if spanner is colliding with another element
	% this will position the spanner outside all other elements
	% can be normally be set to zero
	\once \override TextSpanner #'outside-staff-priority = #$osp
	\once \override TextSpanner #'bound-details #'left #'text = \markup \bold \teeny \circle { \finger $stringnuma }
	\once \override TextSpanner #'font-shape = #'upright
	% setup dashed line and draw a bracket edge on RHS
	\once \override TextSpanner #'dash-period = #0.8
	\once \override TextSpanner #'dash-fraction = #0.6
	\once \override TextSpanner #'thickness = #0.8
	\once \override TextSpanner #'bound-details #'right #'text = \markup \bold \teeny \circle { \finger $stringnumb }
	% set alignment of line with reference to text
	\once \override TextSpanner #'bound-details #'left #'stencil-align-dir-y = #CENTER
	\once \override TextSpanner #'bound-details #'right #'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
#})

\relative c' {
	\stringUp "2" "3" #0 #'(0 . -0.5) #5 #1 e\startTextSpan e e e\stopTextSpan
}

_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to