On Sun, 26 Jul 2026, Yoshiaki Onishi wrote: > > I would like to improve this draft in the following ways and need help: > > • make-down-tick-bar-line — I would like it to mirror > make-up-tick-bar-line — i.e., find the lowest staff line and extend down > from there. But I haven’t been able to build that in my experimentation. > > • Edges — IIUC, LilyPond’s *tick* bar lines are rounded boxes, but > *normal* bar lines are squared off to meet the edge of the staff line where > they end. My style requires (ideally) a box with one rounded edge (the edge > that touches nothing) and one squared-off edge to touch a staff line. But I > don’t know how to build that. > > …I think I addressed both of these issues? For Item 1, I did a bit of a > “brute force” thing where the value of “bottom” is set depending on > “line-count,” using *cond*. If you somehow tinker with the distance between > staff lines, you’d have to also tweak the values, but I think this should > work for now. >
Thank you very much! I am still experimenting with Scheme code to find the lowest staff line … I think I have isolated a problem. In the MWE below, my Scheme code *can* find the lowest staff line. 👍 Screenshot (bar line in blue): [image: image.png] But if I try to use the minus sign (-) to *subtract* 0.25 staff space from the minimum line-pos, to get the output that I want, things fail: The bar line is no longer positioned relative to the lowest staff line. Screenshot: [image: image.png] I am confused: Why is it that I can add (+) 0.25 staff space above the lowest line, but I *cannot subtract* (-) 0.25 staff space below that line? %%% SNIPPET BEGINS \version "2.27.1" % From https://github.com/lilypond/lilypond/blob/master/scm/bar-line.scm #(define (bar-line::calc-blot thickness extent grob) "Calculate the blot diameter for a rounded box, taking the extent into account." (let ((blot-diameter (layout-blot-diameter grob)) (height (interval-length extent))) (cond ((< thickness blot-diameter) thickness) ((< height blot-diameter) height) (else blot-diameter)))) % From https://github.com/lilypond/lilypond/blob/master/scm/bar-line.scm #(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)) *% Draw a tick placed around the lowest staff line:*#(define (make-up-tick-bar-line is-span grob extent) (let* ((line-thickness (layout-line-thickness grob)) (thickness (* (ly:grob-property grob 'hair-thickness 1) line-thickness)) (staff-symbol (ly:grob-object grob 'staff-symbol)) (line-pos (ly:grob-property staff-symbol 'line-positions)) (line-count (length line-pos)) (staff-space (ly:staff-symbol-staff-space grob)) (half-staff (* 1/2 staff-space)) (quarter-staff (* 1/4 staff-space))) * ;; Our goal is to place the tick mark ;; relative to the bottom/lowest staff line.* (if (>= line-count 2) (set! center (+ *; WILL FAIL if I change this plus to minus (-)* quarter-staff ; in the following code, ; min WORKS to find the lowest line: (* (apply min line-pos) half-staff)))) (ly:round-filled-box (cons 0 thickness) ; x (coord-translate (symmetric-interval quarter-staff) center) ; y (bar-line::calc-blot thickness extent grob)))) #(add-bar-glyph-print-procedure "u" make-up-tick-bar-line) #(define-bar-line "u" "u" #f #f) \fixed c' { g1 \bar "u" } \layout { % \override Staff.StaffSymbol.line-count = #4 \context { \Staff % For testing and inspection purposes: \override BarLine.color = #blue } } %%% SNIPPET ENDS
