lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

No blot in custom bar line


From: Simon Albrecht
Subject: No blot in custom bar line
Date: Mon, 23 Nov 2015 22:40:32 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

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"
}
%%%%%%%%%%%%%%%%%%%%%

Attachment: bach-bar-line.ly
Description: Text Data

Attachment: bach-bar-line.preview.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]