lilypond-user
[Top][All Lists]
Advanced

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

Re: `\afterGrace` and clef problem


From: Valentin Petzel
Subject: Re: `\afterGrace` and clef problem
Date: Mon, 13 Feb 2023 00:15:43 +0100

Hello Werner,

When doing \afterGrace internally something like

<< [music] { [some-skip] [graces] } >>

is created. These graces will necessarily not fall onto the last timestep of 
the measure, which appears to be where the Clef stencil is limited to, which 
we can see here:

\relative c' {
  <<
    { f2. e16[ f] s8 | g1 }
    { c1 \clef "bass" | c,1 }
  >>
} 

Also if we do this

\layout {
  \override Score.SpacingSpanner.spacing-increment = #0
}

<<
  \new Staff \repeat unfold 32 { 16 }
  \new Staff { 1 \clef bass 1 }
>>

we see that the Clef is positioned after the last note, making additional 
space to make it fit if necessary. 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:

\layout {
  \override Score.SpacingSpanner.spacing-increment = #0
}

<<
  \new Staff \repeat unfold 32 { 16 }
  \new Staff { 1 \clef bass 1 }
>>

<<
  \new Staff \repeat unfold 32 { 16 }
  \new Staff {
    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 1 }
>>

This is directly applicable to your case:

\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 }
  >>
}

Keep in mind though that this might produce collisions with previous notes. In 
these contexts where we would use this such collisions should not happen, but 
it is still something to be aware of.

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

Cheers,
Valentin

Am Sonntag, 12. Februar 2023, 18:22:23 CET schrieb Werner LEMBERG:
> Please look at this example.
> 
> ```
> \relative c' {
>   <<
>     { \afterGrace f1 { e16[ f] } | g1 }
>     { c1 \clef "bass" | c,1 }
> 
> }
> 
> \relative c' {
>   <<
>     { f2.. e16[ f] | g1 }
>     { c1 \clef "bass" | c,1 }
> 
> }
> ```
> 
> What can I do to make the clef move 'under' the grace, similar to the
> non-grace situation?
> 
> 
>     Werner

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


reply via email to

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