Le samedi 13 mai 2023 à 17:30 -0600, Jeff Olson a écrit :

> Jean,
>  
> I tried adapting your circleB with a fill to do something like staffHighlight 
> but with a more focused spotlight effect, especially for notes outside the 
> staff on ledger lines where staffHighlight ordinarily doesn't go.    Here's 
> my adaptation (with the original stencil last, so the note itself is not 
> obliterated by the fill):  
>  
>  
> \version "2.24.1"  
>  circleB =  
>  \once \override NoteHead.stencil =  
>  #(grob-transformer  
>    'stencil  
>    (lambda (grob original)  
>      (grob-interpret-markup  
>       grob  
>       #{  
>          \markup \with-outline \stencil #original  
>          \overlay {  
>            \align-on-other #X  
>              #CENTER \stencil #original  
>              #CENTER \with-color "#fcc" \draw-circle #3.5 #0.1 ##t   
>            \stencil #original  
>            }  
>       #})))
>  
> {  \circleB e a d' \circleB g' b' e'' }
>  
>   
>  
>  
> But filling the circle obscures the staff and ledger lines (unlike the 
> staffHighlight effect) making the circled note ambiguous (see first staff in 
> image below).  
>  
>  
> The only workaround I know is to do an overlay of the whole score with its 
> un-decorated self, like this (second staff in image below).  
>  
>  
> \markup { \overlay {  
>    \score {  \new Voice { \circleB e a d' \circleB g' b' e'' } }  
>    \score {  \new Voice { e a d'  g'  b' e'' } }  
>  } }
>  
>   
>  
>  
> Here's the image of the two results.  The circle highlight obliterates the 
> ledger and staff lines:
>  
> I see the circle also has no extent so it gets clipped in the png.  That I 
> can workaround.    
>  
>  
> But how can I get the circle placed behind the staff (as in the second 
> result) without doing an unwieldy overlay of the whole score?


The basic setting to play with is the layer:

```
\version "2.24.1"

circleB = {
  \once \override NoteHead.stencil =
  #(grob-transformer
    'stencil
    (lambda (grob original)
      (grob-interpret-markup
       grob
       #{
          \markup \with-outline \stencil #original
          \overlay {
            \align-on-other #X
              #CENTER \stencil #original
              #CENTER \with-color "#fcc" \draw-circle #3.5 #0.1 ##t 
            \stencil #original
            }
       #})))
  \override NoteHead.layer = -1
}

{  \circleB e a d' \circleB g' b' e'' }
```

But you can't set the layer differently for the colored circle and the note 
head itself if they are part of the same grob, leading to the circle of a note 
head stomping on another note head as you can see above. You would have to use 
another grob, e.g.,

```
\version "2.24.1"

circleB = {
  \balloonGrobText NoteHead #'(0 . 0)
    \markup \with-color "#fcc" \draw-circle #3.5 #0.1 ##t
  \once \override BalloonText.annotation-balloon = ##f
  \once \override BalloonText.layer = -1
}

\new Voice \with {
  \consists Balloon_engraver
}
{  \circleB e a d' \circleB g' b' e'' }
```



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

Reply via email to