Thank you too for the tip,

Unfortunately, it seems to produce weird results in some cases, For
example: I can't set the 'padding' property in a consistent way. See the
snippet below (and please, give me a feedback, so the gitlab page can be
updated, if needed).
It appears to me that there is a conceptual contradiction in the
TupletBracket itself: it is defined as a non-outside-staff object as
default, but it requires the avoid-collision props of the outside-staff
objects as well. I can understand that there are scores in which brackets
are inside staves (I don't like this choice TBH, I think it visually messes
up the score), but in case the notation doesn't require this constraint,
like my case, putting the bracket outside the score, with a proper barrier
around it, seem to solve all the issues.
Note that a TupletBracket should have an unbalanced barrier (no space or
few space above it, some space below it), which is not possible with
outside-staff-padding but it is possible with the function that Aaron wrote
some time ago (just create a white box):

https://lists.gnu.org/archive/html/lilypond-user/2020-02/msg00202.html

Best,
P

%%%%%
(define (Tuplet_accidental_support_engraver context)
    (let ((brackets (make-hash-table))
          (ending-brackets '())
          (accidentals '()))
      (make-engraver
        (acknowledgers
          ((tuplet-bracket-interface engraver grob source-engraver)
             (hashq-set! brackets grob #t))
          ((accidental-interface engraver grob source-engraver)
             (set! accidentals (cons grob accidentals))))
        (end-acknowledgers
          ((tuplet-bracket-interface engraver grob source-engraver)
             (set! ending-brackets (cons grob ending-brackets))))
        ((stop-translation-timestep engraver)
           (hash-for-each
             (lambda (bracket dummy)
               (for-each
                 (lambda (accidental)
                   (ly:pointer-group-interface::add-grob
                     bracket
                     'scripts
                     accidental))
                 accidentals))
             brackets)
           (for-each
             (lambda (bracket)
               (hashq-remove! brackets bracket))
             ending-brackets)
           (set! accidentals '())))))

\layout {
   \context {
     \Voice
     \consists #Tuplet_accidental_support_engraver
   }
}


%%%%%
{
\time 5/4
\override TupletBracket.direction = #UP
\override TupletBracket.padding = 0
\tuplet 3/2 { a'' a'' a''}
\revert TupletBracket.padding
s
\tuplet 3/2 { \once \hide Accidental a'' a'' ais''}

\override TupletBracket.padding = 0
\tuplet 3/2 { a'' a'' a''}
s
\tuplet 3/2 { \once \hide Accidental a'' a'' a''}
}
%%%%%


On Fri, Dec 10, 2021 at 10:09 AM Jean Abou Samra <j...@abou-samra.fr> wrote:

> Le 10/12/2021 à 01:13, Paolo Prete a écrit :
> > Hello,
> >
> > please look at this snippet (tested with 2.22.0):
> >
> > %%%%%
> > {
> > \time 5/4
> > \override TupletBracket.direction = #UP
> > \tuplet 3/2 { a'' a'' ais''-.}
> > s
> > \tuplet 3/2 { \once \hide Accidental a'' a'' ais''}
> > }
> > %%%%%
> >
> > As you can see, the vertical gap between the staccato dot and the
> > tuplet bracket is shorter than the gap between the same bracket and
> > the accidental; however, this is not taken into account and the result
> > is visually faulty.
> > Is there a way to fix this?
>
>
> Try the workaround given here:
>
> https://gitlab.com/lilypond/lilypond/-/issues/3766#note_623977182
>
>
> \version "2.22.1"
>
> #(define (Tuplet_accidental_support_engraver context)
>     (let ((brackets (make-hash-table))
>           (ending-brackets '())
>           (accidentals '()))
>       (make-engraver
>         (acknowledgers
>           ((tuplet-bracket-interface engraver grob source-engraver)
>              (hashq-set! brackets grob #t))
>           ((accidental-interface engraver grob source-engraver)
>              (set! accidentals (cons grob accidentals))))
>         (end-acknowledgers
>           ((tuplet-bracket-interface engraver grob source-engraver)
>              (set! ending-brackets (cons grob ending-brackets))))
>         ((stop-translation-timestep engraver)
>            (hash-for-each
>              (lambda (bracket dummy)
>                (for-each
>                  (lambda (accidental)
>                    (ly:pointer-group-interface::add-grob
>                      bracket
>                      'scripts
>                      accidental))
>                  accidentals))
>              brackets)
>            (for-each
>              (lambda (bracket)
>                (hashq-remove! brackets bracket))
>              ending-brackets)
>            (set! accidentals '())))))
>
> \layout {
>    \context {
>      \Voice
>      \consists #Tuplet_accidental_support_engraver
>    }
> }
>
>
> %%%%%
> {
> \time 5/4
> \override TupletBracket.direction = #UP
> \tuplet 3/2 { a'' a'' ais''-.}
> s
> \tuplet 3/2 { \once \hide Accidental a'' a'' ais''}
> }
> %%%%%
>
>
> Best,
> Jean
>

Reply via email to