lilypond-user
[Top][All Lists]
Advanced

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

Re: `\afterGrace` and clef problem


From: Werner LEMBERG
Subject: Re: `\afterGrace` and clef problem
Date: Mon, 13 Feb 2023 08:12:26 +0000 (UTC)

Hello Valentin,


> My suggestion to getting around this would be the tell Lilypond that
> the clef stencil is in fact narrower than it actually is, which will
> allow the Clef stencil to protrude arbitrarily much: [...]

Thanks!  Interestingly, the clef still gets some extra horizontal
space, which is especially undesirable
for `\afterGrace`.  This extra space can be suppressed by setting

```
\once\override Staff.Clef.space-alist.staff-bar = #'(extra-space . 0)
```

but this moves the clef too near to the bar line.  I'm rather inclined
to count the behaviour of `space-alist` for clefs as a buglet: It
doesn't make sense allowing the clef to move 'under' other notes in
different staves while its `space-alist` values are applied globally
to all staves.

The best (optical) solution that I have found so far is to disable
`X-extent` completely, shifting the clef to the left using
`extra-offset`.


> Alternatively you may try to use \afterGrace to insert the \clef
> before the bar line, although this would probably require some
> manual spacing too.

This doesn't work at all: `\afterGrace` doesn't accept a clef, as the
image shows.

```
\markup "no clef change"

\relative c' {
  <<
    { \afterGrace f1 { e16[ f] } | g1 }
    { 1 | 1 }
  >>
}

\markup "lambda for X-extent"

\relative c' {
  <<
    { \afterGrace f1 { e16[ f] } | g1 }
    { 1
      \once\override Staff.Clef.X-extent =
      #(lambda (grob)
         (let* ((stc (ly:grob-property grob 'stencil))
                (ext (ly:stencil-extent stc X))
                (mod-ext (cons (cdr ext) (cdr ext))))
           mod-ext))
      \clef "bass" | c,1 }
  >>
}

\markup "X-extent = ##f and extra-offset"

\relative c' {
  <<
    { \afterGrace f1 { e16[ f] } | g1 }
    { 1
      \once\override Staff.Clef.X-extent = ##f
      \once\override Staff.Clef.extra-offset = #'(-2.9 . 0)
      \clef "bass" | c,1 }
  >>
}

\markup "clef change in \afterGrace"

\relative c' {
  <<
    \new Staff { \afterGrace f1 { e16[ f] } | g1 }
    \new Staff { \afterGrace 1 { s8 \clef "bass" } | c,1 }
  >>
}
```


    Werner

PNG image


reply via email to

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