Le samedi 27 mai 2023 à 17:17 -0400, Gregory Evans a écrit :

> Hi Everyone,  
> Yes Andrew, that excerpt is from Mahnkopf: good eye!
> 
> Thanks Karim, your override is a good step in the right direction for me.
> 
> So now I guess what I'm looking for is a way to query the tuplet bracket for 
> its direction while tweaking the tuplet number.



Something like this?




```
\version "2.25.5"

#(define (duration-or-markup? x)
   (or (ly:duration? x)
       (markup? x)))

addNote =
#(define-music-function (note tuplet-music) (duration-or-markup? ly:music?)
   (unless (music-is-of-type? tuplet-music 'time-scaled-music)
     (ly:music-warning tuplet-music "\\addNotes expected a tuplet"))
   #{
     %% ugh, bug workaround -- see 
https://gitlab.com/lilypond/lilypond/-/merge_requests/2024
     %% for a fix
     \tweak TupletNumber.direction
       #(lambda (grob)
          (ly:grob-property (ly:grob-object grob 'bracket) 'direction))
     \tweak TupletNumber.text
     #(grob-transformer
       'text
       (lambda (grob orig)
         (let* ((dir (ly:grob-property grob 'direction))
                (note-markup (if (markup? note)
                                 note
                                 #{ \markup \parenthesize \fontsize #-4 \note 
#note #dir #})))
           #{ \markup \put-adjacent #Y #dir
                #orig
                \raise #(* dir 0.7) \with-outline "" #note-markup #})))
     #tuplet-music
   #})

{
  \addNote 8 \tuplet 3/2 { c'8 8 8 }
  \once \tupletDown
  \addNote 16 \tuplet 3/2 { c'8 8 8 }
  \addNote \markup \with-color "red" foobarbaz \tuplet 3/2 { c'8 8 8 }
}
```


Regards,

Jean

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

Reply via email to