Hello,
I’ve defined a custom bar line, following the examples in
scm/bar-line.scm. Now I would have expected the whole ‘blot’ business to
give me round edges, at least with \override Staff.BarLine.rounded =
##t, but it doesn’t. Why?
Also, it’s a bit of a nuisance that calc-blot isn’t publicly available.
Would there be a problem with changing that? And would it require
anything but to use define-public for it?
TIA, Yours Simon
%%%%%%%%%%%%%%%%%%%%
\version "2.18.2"
% dupe from scm/bar-line.scm, line 64ff. and 30ff.
% TODO: make this publicly available
#(define (layout-blot-diameter grob)
"Get the blot diameter of the @var{grob}'s corresponding layout."
(let* ((layout (ly:grob-layout grob))
(blot-diameter (ly:output-def-lookup layout 'blot-diameter)))
blot-diameter))
#(define (calc-blot thickness extent grob)
"Calculate the blot diameter by taking @code{'rounded}
and the dimensions of the extent into account."
(let* ((rounded (ly:grob-property grob 'rounded #f))
(blot (if rounded
(let ((blot-diameter (layout-blot-diameter grob))
(height (interval-length extent)))
(cond ((< thickness blot-diameter) thickness)
((< height blot-diameter) height)
(else blot-diameter)))
0)))
blot))
#(define (make-bach-bar-line grob extent)
"Draw a v-centered half bar line, to model Seb. Bach’s use (e.g. in
BWV 226)."
(let* ((line-thickness (layout-line-thickness grob))
(thickness (* (ly:grob-property grob 'hair-thickness 1)
line-thickness))
(extent (interval-scale extent 1/3))
(bottom (interval-start extent))
(top (interval-end extent))
(blot (calc-blot thickness extent grob)))
(ly:round-filled-box (cons 0 thickness)
(cons bottom top)
blot)))
#(add-bar-glyph-print-procedure "b" make-bach-bar-line)
#(define-bar-line "b" "b" #f #f)
#(set-global-staff-size 100)
{
c''4
\once\override Staff.BarLine.rounded = ##t
\bar "b"
}
%%%%%%%%%%%%%%%%%%%%%
\version "2.18.2"
% dupe from scm/bar-line.scm, line 64ff. and 30ff.
% TODO: make this publicly available
#(define (layout-blot-diameter grob)
"Get the blot diameter of the @var{grob}'s corresponding layout."
(let* ((layout (ly:grob-layout grob))
(blot-diameter (ly:output-def-lookup layout 'blot-diameter)))
blot-diameter))
#(define (calc-blot thickness extent grob)
"Calculate the blot diameter by taking @code{'rounded}
and the dimensions of the extent into account."
(let* ((rounded (ly:grob-property grob 'rounded #f))
(blot (if rounded
(let ((blot-diameter (layout-blot-diameter grob))
(height (interval-length extent)))
(cond ((< thickness blot-diameter) thickness)
((< height blot-diameter) height)
(else blot-diameter)))
0)))
blot))
#(define (make-bach-bar-line grob extent)
"Draw a v-centered half bar line, to model Seb. Bachâs use (e.g. in BWV 226)."
(let* ((line-thickness (layout-line-thickness grob))
(thickness (* (ly:grob-property grob 'hair-thickness 1)
line-thickness))
(extent (interval-scale extent 1/3))
(bottom (interval-start extent))
(top (interval-end extent))
(blot (calc-blot thickness extent grob)))
(ly:round-filled-box (cons 0 thickness)
(cons bottom top)
blot)))
#(add-bar-glyph-print-procedure "b" make-bach-bar-line)
#(define-bar-line "b" "b" #f #f)
#(set-global-staff-size 100)
{
c''4
\once\override Staff.BarLine.rounded = ##t
\bar "b"
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user