\version "2.15.14"
% Parameters: % fretnum: the fret number for the barre - eg "VII" % osp: outside staff priority, in case this needs altering from the default % dirn: #UP or #DOWN % vdrop: height of vertical line at LH end % shorten: pair indicating left & right padding of TextSpanner% adjBreak: adjust LH end of TextSpanner line when it has wrapped to following stave
% adjEnd: adjustment of line end when it wraps to following stavebarre = #(define-music-function (parser location fretnum osp dirn vdrop shorten adjBreak adjEnd)
(string? number? number? number? pair? number? number?)
#{
\once \override TextSpanner #'outside-staff-priority = #$osp
\once \override TextSpanner #'bound-details #'left #'text =
\markup\small\bold { \concat {
\postscript #(string-append
"0.1 setlinewidth 0.7 -0.5 moveto 0 -"
(number->string $vdrop)
" rlineto 0.5 0 rlineto stroke")
$fretnum " "
} }
\once \override TextSpanner #'style = #'line
\once \override TextSpanner #'font-shape = #'upright
\once \override TextSpanner #'direction = #$dirn
%draw a bracket edge on RHS
\once \override TextSpanner #'bound-details #'right #'text =
\markup { \draw-line #(cons 0 (/ $dirn -1)) }
% set alignment of line with reference to left text
\once \override TextSpanner #'bound-details #'left
#'stencil-align-dir-y = #CENTER
% change X pos of LH and RH end as desired
\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
% 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'' {
\barre "III" #0 #UP #4 #'(-1.5 . -1) #10 #0.5 f4.\startTextSpan
f8 b4. d8\stopTextSpan
}
<<attachment: barre.png>>
_______________________________________________ lilypond-user mailing list [email protected] https://lists.gnu.org/mailman/listinfo/lilypond-user
