lilypond-user
[Top][All Lists]
Advanced

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

Re: vertical spacing of footnotes


From: Werner LEMBERG
Subject: Re: vertical spacing of footnotes
Date: Tue, 14 Feb 2023 07:28:42 +0000 (UTC)

>> 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.  [...]

Do you remember the discussion about `\strut` on the 'lilypond-devel'
list?  I've come up with the following, which works nicely.

```
#(set-default-paper-size "a8landscape")

#(define-markup-command (strut layout props)
   ()
   #:properties ((baseline-skip))
   (let ((yext (cons (* -0.3 baseline-skip)
                     (* 0.7 baseline-skip))))
     (ly:make-stencil
      (ly:stencil-expr (make-transparent-box-stencil '(0 . 0.05) yext))
      empty-interval
      yext)))

\book {
  \header { tagline = ##f }

  \paper {
    footnote-padding = -1\mm
    footnote-separator-markup =
      \markup \column {
        \vspace #0.5
        \fill-line { \override #'(span-factor . 1/2) \draw-hline }
        \vspace #0.5
      }
  }

  \markup "time-based footnotes"
  \relative c'' {
    r1 |
    \footnote #'(-0.5 . -1)
      \markup { \strut "Meter change." } Staff.TimeSignature
    \time 3/4
    \footnote #'(1 . -1)
      \markup { \strut "Chord stem." } Stem
    <c e g>4 q q
    \footnote #'(-0.5 . 2)
      \markup { \strut "Bar line." } Staff.BarLine
    q q
    \footnote #'(0.5 . -1)
      \markup { \strut "Key change." } Staff.KeySignature
    \key c \minor
    q
  }
}
```

There are some problems, though.

* In what context are footnote texts handled?  I want to globally
  adjust `baseline-skip` for my (redefined) `\strut` function, but I'm
  not able to do it.

* `footnote-padding` is completely undocumented, as are the following
  footnote parameters:

    footnote-footer-padding
    footnote-number-raise
    footnote-stencil
    number-footnote-table
    footnote-numbering-function (at least there is a regtest)

* Too bad that `footnote-padding` is also applied between the footnote
  separator and the first footnote, which necessitates a redefinition
  of the footnote separator markup.

* If there were a context, I could apply Valentin's 'replace' trick:

  ```
  \override TextScript.before-line-breaking =
    #(lambda (grob)
       (ly:grob-set-property!
         grob 'text
         (markup #:replace
                 `(("@" . ,#{ \markup{ \strut } #}))
                 (ly:grob-property grob 'text))))
  ```

  [I'm aware that in this case `before-line-breaking` is probably not
   correct, but...]

  which would simplify the above footnote entries to

  ```
  \footnote #'(-0.5 . -1) "@Meter change." Staff.TimeSignature
  ```


    Werner

PNG image


reply via email to

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