Re: lilypond-user Digest, Vol 246, Issue 40

2023-05-14 Thread Jean Abou Samra
Le samedi 13 mai 2023 à 21:23 -0600, Jeff Olson a écrit :
>  
> >  
>  
> Excellent!  How would you similarly circle a rest (both r and f''\rest)?
>  

For technical reasons, you would have to use the form with \balloonGrobText as 
in the message I later corrected, not with \balloonText.


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


Re: lilypond-user Digest, Vol 246, Issue 40

2023-05-13 Thread Jeff Olson

On 5/13/2023 5:49 PM, Jean Abou Samra wrote:


PS. In fact it's better like this (to avoid influencing other balloons 
at the same moment):


|\version "2.24.1" \layout { \context { \Voice \consists 
Balloon_engraver } } circleB = \tweak layer -1 \tweak 
annotation-balloon ##f \balloonText #'(0 . 0) \markup \with-color 
"#fcc" \draw-circle #3.5 #0.1 ##t {  a d'  b' 
e'' } |


Excellent!  How would you similarly circle a rest (both r and f''\rest)?

Jeff


Re: lilypond-user Digest, Vol 246, Issue 40

2023-05-13 Thread Jean Abou Samra
Le dimanche 14 mai 2023 à 01:42 +0200, Jean Abou Samra a écrit :

> 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'' }
> ```

PS. In fact it's better like this (to avoid influencing other balloons at the 
same moment):

```
\version "2.24.1"

\layout {
  \context {
\Voice
\consists Balloon_engraver
  }
}

circleB =
  \tweak layer -1
  \tweak annotation-balloon ##f
  \balloonText #'(0 . 0)
\markup \with-color "#fcc" \draw-circle #3.5 #0.1 ##t

{   a d'  b' e'' }
```



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


Re: lilypond-user Digest, Vol 246, Issue 40

2023-05-13 Thread Jean Abou Samra
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'' }
```





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


Re: lilypond-user Digest, Vol 246, Issue 40

2023-05-13 Thread Jeff Olson

On 5/13/2023 2:07 PM, lilypond-user-requ...@gnu.org wrote:

Il 13/05/23 15:47, Jean Abou Samra ha scritto:

[...]
|\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 { \stencil #original \align-on-other #X #CENTER 
\stencil #original #CENTER \draw-circle #1.5 #0.1 ##f } #}))) { 
\circleB c'' \circleB c'' \circleB c''2 \circleB c''1 \circleB c''8 
\circleB a'8 \circleB b'16 \circleB c''16 \circleB b'16 \circleB a'16 
\circleB f'2 } |


You can then add |\with-color "red"| before |\draw-circle| or do 
other transformations.


Jean


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:


two results

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?


Jeff