lilypond-user
[Top][All Lists]
Advanced

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

Re: vertical spacing of footnotes


From: Valentin Petzel
Subject: Re: vertical spacing of footnotes
Date: Tue, 14 Feb 2023 13:02:57 +0100

As far as I see this is not the problem. Footnotes appear to be simply stacked 
by extent, not by baseline. This already creates issues with footnotes 
extending over multiple lines, as the spacing between different footnotes will 
be less than the spacing between different lines of footnotes.

Meanwhile we could easily get an acceptable behaviour (I suppose) by changing 
from a equal baseline distance model to a model that aligns baselines to some 
grid, such as this:

fns = \markuplist {
  "Meter change."
  "Chord stem."
  "Bar line."
  \justify { Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut eget 
ante venenatis mi consectetur ornare. Cras facilisis dictum venenatis. }
  "Key change."
}

\markup\column\fns

#(define (cumsum . x)
   (define (impl init a . b)
     (if (null? b)
         (list (+ init a))
         (cons (+ init a) (apply impl (cons (+ a init) b)))))
   (apply impl (cons 0 x)))


\markup\vspace #3

#(define-markup-command (column-to-grid layout props ml) (markup-list?)
   #:properties ((baseline-skip 3.5))
   (let* ((iml (interpret-markup-list layout props ml))
          (exts (map (lambda (s) (ly:stencil-extent s Y)) iml))
          (under-bl-exts (map car exts))
          (under-bl-grids (map (lambda (x) (* (1- (ceiling (/ x baseline-
skip))) baseline-skip)) under-bl-exts))
          (grid-points (cons 0 (apply cumsum under-bl-grids)))
          (moved-iml (map (lambda (stc amt) (ly:stencil-translate-axis stc amt 
Y)) iml grid-points)))
     (display under-bl-exts)
     (apply ly:stencil-add moved-iml)))

\markup\column-to-grid\fns

\markup\vspace #3

\markup\override #'(baseline-skip . 2.5) \column-to-grid\fns


Maybe it would be useful to be able to override the formatting of the footnote 
block, similar to how we have toItemMarkup. We could allow the user to format 
footnotes using some footnoteMarkup callback?

Cheers,
Valentin

Am Dienstag, 14. Februar 2023, 01:48:50 CET schrieb Jean Abou Samra:
> Le lundi 13 février 2023 à 19:37 -0500, kieren@kierenmacmillan.info a 
écrit :
> > Am I the only one who thinks users shouldn’t have to add transparent
> > letters with ascenders and descenders in order to have a consistent line
> > height?! Working with text should not require such efforts…
> 
> Unfortunately, LilyPond's idea of stencils is not prepared for doing
> that automatically: a stencil is basically a drawing expression + an
> X extent + an Y extent. The info on the lines of text that made
> this stencil, if it was made from text, is lost.
> 
> It'd be possible to add an option for making equal spacing between the
> baselines of footnote lines, but it'd be a crutch: it would handle
> footnotes extending on multiple lines poorly.
> 
> The real fix would be changing the `Stencil` class to include an additional
> data member that would be the extent from the baseline of the first line of
> text to the baseline of the last line of text. Expect a lot of work though:
> all stencil operations would have to be modified to account for it.

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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