[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: string-lines
From: |
Nick Payne |
Subject: |
RE: string-lines |
Date: |
Fri, 10 Jul 2009 08:08:19 +1000 |
Here are the functions I use for a string number indication with a text
spanner. One for up, one for down. I suppose it could be simplified to one
function by passing in an extra parameter to indicate UP or DOWN.
% usage e.g.:
% \stringUp "2" #0 #'(0 . -0.5) #5 #1
% g\startTextSpan c bf'-> ef, af-> c, g c bf'-> ef, af->
c,\stopTextSpan
stringUp = #(define-music-function (parser location stringnum osp shorten
adjBreak adjEnd) (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 \concat { \circle { \finger $stringnum } " " } }
\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
{ \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
#})
% usage e.g.:
% \stringDn "2" #0 #'(0 . -0.5) #5 #1
% g\startTextSpan c bf'-> ef, af-> c, g c bf'-> ef, af->
c,\stopTextSpan
stringDn = #(define-music-function (parser location stringnum osp shorten
adjBreak adjEnd) (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 #'direction = #DOWN
\once \override TextSpanner #'bound-details #'left #'text = \markup
\bold { \teeny \concat { \circle { \finger $stringnum } " " } }
\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
{ \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
#})
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of Jonathan Kulp
> Sent: Friday, 10 July 2009 6:49 AM
> To: Mark Polesky
> Cc: address@hidden
> Subject: Re: string-lines
>
> Mark Polesky wrote:
> >
> > You don't need any fancy scheme, just a music-function:
> > http://lilypond.org/doc/v2.13/Documentation/user/lilypond/Simple-
> substitution-functions
> >
>
> Oh, sweet! That was about the easiest thing ever! Thanks for the
> tip, Mark & Neil. :) This is much more elegant and useful.
>
> Revised in LSR:
>
> http://lsr.dsi.unimi.it/LSR/Item?u=1&id=616
>
> Here's how it looks now (in case you don't want to go to LSR):
>
> %\version "2.12.2"
>
> stringNumberSpanner = #(define-music-function (parser location
> StringNumber) (string?)
> #{
> \override TextSpanner #'style = #'solid
> \override TextSpanner #'font-size = #-5
> \override TextSpanner #'(bound-details left
> stencil-align-dir-y) = #CENTER
> \override TextSpanner #'(bound-details left text) = \markup {
> \circle \number $StringNumber }
> #})
>
>
> \relative c {
> \clef "treble_8"
> \stringNumberSpanner "5"
> \textSpannerDown
> a8\startTextSpan
> b c d e f\stopTextSpan
> \stringNumberSpanner "4"
> g\startTextSpan a
> bes4 a g2\stopTextSpan
> }
>
>
>
> _______________________________________________
> 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.8/2224 - Release Date:
> 07/08/09 05:53:00
stringnum.png
Description: PNG image
- Re: string-lines, (continued)
- Re: string-lines, -Eluze, 2009/07/09
- Re: string-lines, Mario Moles, 2009/07/09
- Re: string-lines, Jonathan Kulp, 2009/07/09
- Re: string-lines, Neil Puttock, 2009/07/09
- Re: string-lines, Jonathan Kulp, 2009/07/09
- Re: string-lines, Neil Puttock, 2009/07/09
- Re: string-lines, Mark Polesky, 2009/07/09
- Re: string-lines, Jonathan Kulp, 2009/07/09
- Re: string-lines, Mario Moles, 2009/07/09
- Re: string-lines, Jonathan Kulp, 2009/07/09
- RE: string-lines,
Nick Payne <=
- Re: string-lines, Mario Moles, 2009/07/09
- Re: string-lines, Mario Moles, 2009/07/09
- RE: string-lines, Nick Payne, 2009/07/10
- Re: string-lines, Matthieu Jacquot, 2009/07/10
- Re: string-lines, Mario Moles, 2009/07/10
RE: string-lines, Nick Payne, 2009/07/09