Re: In TabStaff, \grace with \override misbehaves when it’s the first note

2021-07-20 Thread David Kastrup
Jean Abou Samra  writes:

> Thanks for your report. The same happens in Staff:
>
> \version "2.23.4"
>
> {
>   \grace {
>     \override NoteHead.font-size = 3
>     c'
>     \revert NoteHead.font-size
>   }
>   d'
> }
>
> This is because graces have special settings, which
> include a value for NoteHead.font-size (as well as
> TabNoteHead.font-size). When the first grace note
> arrives, the settings start applying and override what
> you did. Then, the \revert pops those settings off the
> stack, and your setting shines start to shine through.

It's more complex than that: synchronisation with the input stream
(rather than just the timing) is usually established by the
Grace_iterator communicating to the Grace_engraver with a GraceChange
event.

However, in the given situation the bottom context is established only
implicitly with the \override which is too late to establish this
synchronisation.  Cf this comment in lily/grace-engraver.cc:

// if we are in grace time already on initialization, it is unlikely
// that we'll receive a GraceChange event from the grace iterator yet,
// so we want to start into grace mode anyway.  The downside is that
// this will get us confused when given something like
//
// \new Voice { \oneVoice \grace { c''8 8 } g'1 }
//
// where \grace executes its actions already before \oneVoice, causing
// different stem directions.

which is related.

-- 
David Kastrup

___
bug-lilypond mailing list
bug-lilypond@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond


Re: In TabStaff, \grace with \override misbehaves when it’s the first note

2021-07-20 Thread David Kastrup
Nate Whetsell  writes:

> Hi there,
>
> Thanks for all your work on LilyPond!
>
> In a TabStaff, if a grace note is the first note and the \grace contains 
> overrides, the overrides seem to be applied to whatever follows the grace 
> note (instead of the grace note itself). Here’s an example that illustrates 
> the behavior:
>
> ```
> \version "2.22.1"
>
> % Font size is unexpectedly increased for what follows the grace note.
> \score {
>   \new TabStaff {
>   \grace { \override TabNoteHead.font-size = #3 c' \revert 
> TabNoteHead.font-size } d'
>   }
> }

Do not pair \override and \revert.  Instead pair \temporary \override
with \revert.  Otherwise you may get interactions with outer overrides,
and grace notes do come with their own set of overrides.

-- 
David Kastrup

___
bug-lilypond mailing list
bug-lilypond@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond


Re: In TabStaff, \grace with \override misbehaves when it’s the first note

2021-07-20 Thread Jean Abou Samra

Le 20/07/2021 à 13:14, Nate Whetsell a écrit :

Hi there,

Thanks for all your work on LilyPond!

In a TabStaff, if a grace note is the first note and the \grace contains 
overrides, the overrides seem to be applied to whatever follows the grace note 
(instead of the grace note itself). Here’s an example that illustrates the 
behavior:

```
\version "2.22.1"

% Font size is unexpectedly increased for what follows the grace note.
\score {
   \new TabStaff {
   \grace { \override TabNoteHead.font-size = #3 c' \revert 
TabNoteHead.font-size } d'
   }
}

% But when something precedes the grace note, font size increases as expected.
\score {
   \new TabStaff {
 r \grace { \override TabNoteHead.font-size = #3 c' \revert 
TabNoteHead.font-size } d'
   }
}
```

(I also tried this using the latest version from the Git repo, and the behavior 
is the same.)

All the best,
Nate



Hello,

Thanks for your report. The same happens in Staff:

\version "2.23.4"

{
  \grace {
    \override NoteHead.font-size = 3
    c'
    \revert NoteHead.font-size
  }
  d'
}

This is because graces have special settings, which
include a value for NoteHead.font-size (as well as
TabNoteHead.font-size). When the first grace note
arrives, the settings start applying and override what
you did. Then, the \revert pops those settings off the
stack, and your setting shines start to shine through.
A second \revert would cancel your \override:

\version "2.23.4"

{
  \grace {
    \override NoteHead.font-size = 3
    c'
    \revert NoteHead.font-size
    \revert NoteHead.font-size
  }
  d'
}

Unfortunately, grace timing is such a tricky thing
that I doubt we'll be able to do much better here.

Fortunately, there exists a user interface to change
the layout of grace notes:

\version "2.23.4"

\new Voice {
  $(add-grace-property 'Voice 'NoteHead 'font-size 3)
  \grace {
    c'
  }
  d'
}

(do note the importance of the explicit \new Voice).

Please see the snippet "Tweaking grace layout within music" at
lilypond.org/doc/v2.23/Documentation/notation/special-rhythmic-concerns.html#grace-notes

Best regards,
Jean

___
bug-lilypond mailing list
bug-lilypond@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond


In TabStaff, \grace with \override misbehaves when it’s the first note

2021-07-20 Thread Nate Whetsell
Hi there,

Thanks for all your work on LilyPond!

In a TabStaff, if a grace note is the first note and the \grace contains 
overrides, the overrides seem to be applied to whatever follows the grace note 
(instead of the grace note itself). Here’s an example that illustrates the 
behavior:

```
\version "2.22.1"

% Font size is unexpectedly increased for what follows the grace note.
\score {
  \new TabStaff {
  \grace { \override TabNoteHead.font-size = #3 c' \revert 
TabNoteHead.font-size } d'
  }
}

% But when something precedes the grace note, font size increases as expected.
\score {
  \new TabStaff {
r \grace { \override TabNoteHead.font-size = #3 c' \revert 
TabNoteHead.font-size } d'
  }
}
```

(I also tried this using the latest version from the Git repo, and the behavior 
is the same.)

All the best,
Nate
___
bug-lilypond mailing list
bug-lilypond@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-lilypond