Custom Bar Line for Renaissance Polyphony

Yoshiaki Onishi <[email protected]> Sun, 26 Jul 2026 18:37:32 -0400
Newsgroups gmane.comp.gnu.lilypond.general
Message-ID <[email protected]>
--Apple-Mail=_F2BD1C4D-CCA5-417E-9967-4A2BD80B39F3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=utf-8

Hi Gabriel,


> I would like to improve this draft in the following ways and need =
help:
>     =E2=80=A2 make-down-tick-bar-line =E2=80=94 I would like it to =
mirror make-up-tick-bar-line =E2=80=94 i.e., find the lowest staff line =
and extend down from there. But I haven=E2=80=99t been able to build =
that in my experimentation.
>     =E2=80=A2 Edges =E2=80=94 IIUC, LilyPond=E2=80=99s *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=E2=80=99t know how to =
build that.

=E2=80=A6I think I addressed both of these issues? For Item 1, I did a =
bit of a =E2=80=9Cbrute force=E2=80=9D thing where the value of =
=E2=80=9Cbottom=E2=80=9D is set depending on =E2=80=9Cline-count,=E2=80=9D=
 using *cond*. If you somehow tinker with the distance between staff =
lines, you=E2=80=99d have to also tweak the values, but I think this =
should work for now.

I hope this helps you somehow!

Regards,
Yoshi


--Apple-Mail=_F2BD1C4D-CCA5-417E-9967-4A2BD80B39F3
Content-Disposition: attachment;
	filename="YO_solution_Custom Bar Line Outside Staff.ly"
Content-Type: application/octet-stream;
	x-unix-mode=0644;
	name="YO_solution_Custom Bar Line Outside Staff.ly"
Content-Transfer-Encoding: quoted-printable

%=20Inspired=20by=20Harm=E2=80=99s=20solution=20at=0A%=20=
https://www.mail-archive.com/[email protected]/msg101994.html=20and=0A=
%=20=
https://lists.gnu.org/archive/html/lilypond-user/2015-05/msg00416.html=0A=
%=20=E2=80=A6=20and=20elements=20of=20the=20make-tick-bar-line=20command=20=
at=0A%=20=
https://github.com/lilypond/lilypond/blob/master/scm/bar-line.scm=0A=0A=
\version=20"2.27.1"=0A=0A%=20=46rom=20=
https://github.com/lilypond/lilypond/blob/master/scm/bar-line.scm=0A=
#(define=20(bar-line::calc-blot=20thickness=20extent=20grob)=0A=20=20=
"Calculate=20the=20blot=20diameter=20for=20a=20rounded=20box,=20taking=20=
the=20extent=0Ainto=20account."=0A=20=20(let=20((blot-diameter=20=
(layout-blot-diameter=20grob))=0A=20=20=20=20=20=20=20=20(height=20=
(interval-length=20extent)))=0A=0A=20=20=20(cond=20((<=20thickness=20=
blot-diameter)=20thickness)=0A=20=20=20=20=20=20=20=20=20((<=20height=20=
blot-diameter)=20height)=0A=20=20=20=20=20=20=20=20=20(else=20=
blot-diameter))))=0A=0A%=20=46rom=20=
https://github.com/lilypond/lilypond/blob/master/scm/bar-line.scm=0A=
#(define=20(layout-blot-diameter=20grob)=0A=20=20"Get=20the=20blot=20=
diameter=20of=20the=20@var{grob}'s=20corresponding=20layout."=0A=20=20=
(let*=20((layout=20(ly:grob-layout=20grob))=0A=20=20=20=20=20=20=20=20=20=
(blot-diameter=20(ly:output-def-lookup=20layout=20'blot-diameter)))=0A=0A=
=20=20=20blot-diameter))=0A=0A%=20Draw=20a=20tick=20above=20the=20staff:=0A=
#(define=20(make-up-tick-bar-line=20is-span=20grob=20extent)=0A=20=20=
(let*=20((line-thickness=20(layout-line-thickness=20grob))=0A=20=20=20=20=
=20=20=20=20=20(thickness=20(*=20(ly:grob-property=20grob=20=
'hair-thickness=201)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20line-thickness))=0A=20=20=20=20=20=20=20=20=20=
(staff-symbol=20(ly:grob-object=20grob=20'staff-symbol))=0A=20=20=20=20=20=
=20=20=20=20(line-pos=20(ly:grob-property=20staff-symbol=20=
'line-positions))=0A=20=20=20=20=20=20=20=20=20(line-count=20(length=20=
line-pos))=0A=20=20=20=20=20=20=20=20=20(staff-space=20=
(ly:staff-symbol-staff-space=20grob))=0A=20=20=20=20=20=20=20=20=20=
(half-staff=20(*=201/2=20staff-space))=0A=20=20=20=20=20=20=20=20=20=
(quarter-staff=20(*=201/4=20staff-space)))=0A=0A=20=20=20;;=20The=20tick=20=
is=0A=20=20=20;;=20expected=20to=20touch=20the=20top=20staff=20line,=20=
so=20we=20must=20find=20it.=20If=0A=20=20=20;;=20there=20are=20fewer=20=
than=20two=20lines,=20we=20allow=20floating=20ticks=20so=20that=0A=20=20=20=
;;=20they=20are=20not=20confused=20with=20short=20bar=20lines.=0A=20=20=20=
(if=20(>=3D=20line-count=202)=0A=20=20=20=20=20=20=20(set!=20center=20(+=20=
quarter-staff=20(*=20(apply=20max=20line-pos)=20half-staff))))=0A=0A=20=20=
=20(ly:round-filled-box=0A=20=20=20=20(cons=200=20thickness)=20;=20x=0A=20=
=20=20=20(coord-translate=20(symmetric-interval=20quarter-staff)=20=
center)=20;=20y=0A=20=20=20=20(bar-line::calc-blot=20thickness=20extent=20=
grob))))=0A=0A%=20Draw=20a=20tick=20below=20the=20staff:=0A#(define=20=
(make-down-tick-bar-line=20is-span=20grob=20extent)=0A=20=20(let*=20=
((line-thickness=20(layout-line-thickness=20grob))=0A=20=20=20=20=20=20=20=
=20=20(thickness=20(*=20(ly:grob-property=20grob=20'hair-thickness=201)=0A=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
line-thickness))=0A=20=20=20=20=20=20=20=20=20(staff-symbol=20=
(ly:grob-object=20grob=20'staff-symbol))=0A=20=20=20=20=20=20=20=20=20=
(line-pos=20(ly:grob-property=20staff-symbol=20'line-positions))=0A=20=20=
=20=20=20=20=20=20=20(line-count=20(length=20line-pos))=0A=20=20=20=20=20=
=20=20=20=20(staff-space=20(ly:staff-symbol-staff-space=20grob))=0A=20=20=
=20=20=20=20=20=20=20(half-staff=20(*=201/2=20staff-space))=0A=20=20=20=20=
=20=20=20=20=20(quarter-staff=20(*=201/4=20staff-space))=0A=20=20=20=20=20=
=20=20=20=20(bottom=20(cond=20((>=20line-count=202)=0A=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(interval-start=20=
extent))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20((=3D=20line-count=202)=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20-0.5)=0A=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20((=3D=20line-count=201)=0A=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=200.25)=0A=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20)=0A=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20))=0A=20=20=20;=20incorporated=20=
the=20condition=20above=20using=20"cond"=0A=20=20=20;(if=20(>=3D=20=
line-count=202)=0A=20=20=20;=20=20=20(set!=20center=20(-=20quarter-staff=20=
(*=20(apply=20min=20line-pos)=20half-staff))))=0A=0A=0A=20=20=20=
(ly:round-filled-box=20(cons=200=20thickness)=0A=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20(ordered-cons=20bottom=20(-=20=
bottom=20half-staff))=0A=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20(bar-line::calc-blot=20thickness=20extent=20=
grob))))=0A%;=200)))=20=20<---replaced=20this=20line=20with=20the=20=
corresponding=20line=20found=20in=20"Draw=20a=20tick=20above=20the=20=
staff"=0A=0A%=20Combine=20the=20two=20stencils=20into=20a=20single=20=
stencil:=0A#(define=20(make-both-tick-bar-line=20is-span=20grob=20=
extent)=0A=20=20(ly:stencil-add=0A=20=20=20(make-up-tick-bar-line=20=
is-span=20grob=20extent)=0A=20=20=20(make-down-tick-bar-line=20is-span=20=
grob=20extent)))=0A=0A#(add-bar-glyph-print-procedure=20"u"=20=
make-up-tick-bar-line)=0A#(define-bar-line=20"u"=20"u"=20#f=20#f)=0A=0A=
#(add-bar-glyph-print-procedure=20"d"=20make-down-tick-bar-line)=0A=
#(define-bar-line=20"d"=20"d"=20#f=20#f)=0A=0A=
#(add-bar-glyph-print-procedure=20"b"=20make-both-tick-bar-line)=0A=
#(define-bar-line=20"b"=20"b"=20#f=20#f)=0A=0A%%%%%%%%%%%%%%%%%%=0A%%=20=
EXAMPLE=0A%%%%%%%%%%%%%%%%%%=0A=0A\relative=20c'=20{=0A=20\time=202/1=0A=20=
\clef=20"treble_8"=0A=20\key=20bes=20\major=0A=20r1=20bes1.=0A=20bes2=20=
ees2=20c2=20|=0A=20d4=20ees=20f=20d=20ees=20f=20g2=20|=0A}=0A=0A\layout=20=
{=0A=20\set=20Timing.measureBarType=20=3D=20"b"=0A=0A=20%=20Ideally=20=
the=20make-down-tick-bar-line=20command=0A=20%=20should=20still=20work=20=
(i.e.,=20the=20lower=20tick=0A=20%=20should=20still=20touch=20the=20=
bottom=20line)=0A=20%=20when=20we=20enable=20the=20following:=0A=20=
\override=20Staff.StaffSymbol.line-count=20=3D=20#4=0A=0A=20\context=20{=0A=
=20=20\Voice=0A=20=20\consists=20Melody_engraver=0A=20}=0A}=

--Apple-Mail=_F2BD1C4D-CCA5-417E-9967-4A2BD80B39F3
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=us-ascii


-- -- --
Yoshiaki Onishi
https://github.com/yoshiakionishi/lilypond-snippets






--Apple-Mail=_F2BD1C4D-CCA5-417E-9967-4A2BD80B39F3--