After some trial and error, the simplest workaround was to override the stencil of NoteHead so it draws the missing ledger line. I conditionally set NoteHead.stencil to ly:text-interface::print and set NoteHead.text to custom markup function.
\override NoteHead.stencil = #(lambda (grob) (let ((pos (ly:grob-property grob 'staff-position))) (begin (if (< pos -7) (display "ERROR: Lower brevis then expected\n") (display "")) (if (<= pos -6) ly:text-interface::print ly:note-head::print)))) \override NoteHead.text = #(lambda (grob) (let ((pos (ly:grob-property grob 'staff-position))) #{\markup { \combine \halign #-0.55 \raise #(if (= pos -6) 0 0.5) \override #'(thickness . 2) \draw-line #'(3.2 . 0) \musicglyph "noteheads.sM1" }#})) It is very basic ledger line code that is valid only for staff positions -6 and -7, but this is all I need for the psalms. Even though my question didn't get any attention, I hope this workaround might help someone in the future. Many thanks to all the developers of LilyPond for creating such a highly customizable music engraving tool. I can't imagine creating this project without LilyPond. Kind regards, Jiri Hon On 15. 12. 23 13:19, Jiří Hon wrote:
Dear LilyPond community, I'm working on an web psalter https://www.zaltar.cz (in Czech language) with responsive music notation based on LilyPond. For example, take a look at https://www.zaltar.cz/OL1.html and try changing the width of the browser. The notation is pre-engraved at 9 different sizes and the correct size is automatically selected using CSS rules. The LilyPond code used to create the notation is linked at the bottom of each page. In order to make the notation work at so many different sizes, I have used the excellent work of Thomas Morley (https://lists.gnu.org/archive/html/lilypond-user/2020-05/msg00002.html), Jean Abou Samra and Werner Lemberg (https://www.mail-archive.com/lilypond-user@gnu.org/msg149350.html). Thank you very much! Their code handles automatic wrapping of long breves and snapping syllables so that they appear as one text on each breve. However, I would like to take musical notation even further. Right now, there's a lot of extra space behind the breve because of those invisible notes that are evenly spaced. My question is: Is it possible to reduce the spacing between those invisible breves? I tried using \override NoteHead.X-extent = #'(0 . 0). This almost does what I want. The notes can overlap and the spacing is dictated by the text only, which is great for my purpose. However, there is serious drawback to this. The ledger lines stop working. This is understandable, since they need the X-extent of note heads to calculate the length. So, please, is there any other way to a achieve similar spacing, but without interfering with the ledger lines? Below is some kind of MWE. I would like to achieve the same spacing as in the MWE, but with working ledger lines: \version "2.24.0" \header { tagline = "" } \paper { indent = 0\cm top-margin = 0\cm right-margin = 0\cm bottom-margin = 0\cm left-margin = 0\cm paper-width = 15\cm page-breaking = #ly:one-page-breaking } hideNotes = { % logic for hiding notes based on Thomas Morley's work % https://lists.gnu.org/archive/html/lilypond-user/2020-05/msg00002.html } unHideNotes = { % logic for hiding notes based on Thomas Morley's work % https://lists.gnu.org/archive/html/lilypond-user/2020-05/msg00002.html } squashNotes = { \override NoteHead.X-extent = #'(0 . 0) } unSquashNotes = { \revert NoteHead.X-extent } \score { << \new Voice = "melody" { \cadenzaOn \key c \major \relative { c'\breve*1/16 \squashNotes \hideNotes \breve*1/16 \bar "" \breve*1/16 \bar "" \breve*1/16 \bar "" \breve*1/16 \bar "" \breve*1/16 \bar "" \breve*1/16 \bar "" \breve*1/16 \bar "" \breve*1/16 \bar "" \breve*1/16 \breve*1/16 \bar "" \unHideNotes \unSquashNotes \bar "" f8 e d d4 r \bar "|" d\breve*1/16 \squashNotes \hideNotes \breve*1/16 \breve*1/16 \bar "" \unHideNotes \unSquashNotes \bar "" g8[( f)] e e2 \bar "||" \break } } \new Lyrics \lyricsto "melody" { \lyricmode { \set stanza = "3." Bu -- deš-li u -- cho -- vá -- vat "v pa" -- mě -- ti vi -- ny, Ho -- spo -- di -- ne, Pa -- ne, kdo ob -- sto -- jí? } } >> } Thank you very much for your time and effort, Jiri Hon