Le mardi 14 février 2023 à 07:28 +0000, Werner LEMBERG a écrit :

> * 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.


Like all sticky grobs, footnotes are created in the same context
as the grob they annotate. Overriding on `Score` level should work
to set properties for all footnotes (unless there are overrides
in lower-level contexts, which take precedence). The problem here
is that footnote texts are not interpreted by the `Footnote` grobs
themselves, which is kind of logical because they're printed at
a completely different location. See `page-layout-problem.cc`
line 251:

```
              SCM footnote_markup = get_property (footnote, "footnote-text");
              if (Spanner *orig = dynamic_cast<Spanner *> (footnote))
                if (orig->is_broken ())
                  footnote_markup
                    = get_property (orig->broken_intos_[0], "footnote-text");

              SCM props
                = Lily::layout_extract_page_properties (paper->self_scm ());

              auto footnote_stencil = Text_interface::interpret_markup (
                paper, props, footnote_markup);
```

To change those properties, you could do

```
\paper {
  text-font-defaults.baseline-skip = 3
}
```


> * 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
>   ```


You can use `Score`, see above. Additionally, for footnotes, the `text`
property holds the number that is printed in the music. You want 
`footnote-text`.

```
    \override Score.Footnote.footnote-text =
      #(grob-transformer
        'footnote-text
        (lambda (grob orig)
          #{ \markup \replace #`(("@" . ,#{ \markup \strut #})) #orig #}))
```


or even

```
    \override Score.Footnote.footnote-text =
      #(grob-transformer
        'footnote-text
        (lambda (grob orig)
          #{ \markup { \strut #orig } #}))
```

to add the strut to all texts.

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

Reply via email to