Hello Stu,

Am Donnerstag, 30. Jänner 2025, 18:13:42 Mitteleuropäische Normalzeit 
schrieben Sie:
> I processed the content and the result doesn't have the sticking under the 
stems
> of the notes.
> 
> The first bar is slightly to the left of the stem, and the second bar is to 
the
> right of the stem.

That is incorrect. See this debugging version to find that in fact the sticking 
is perfectly aligned to the stem:

```
#(define-markup-command (show-bounding-box layout props mup) (markup?)
   (let* ((stc (interpret-markup layout props mup))
          (ext-x (ly:stencil-extent stc X))
          (ext-y (ly:stencil-extent stc Y))
          (box-stc
           (make-path-stencil
            `(moveto ,(car ext-x) ,(car ext-y)
              lineto ,(car ext-x) ,(cdr ext-y)
              lineto ,(cdr ext-x) ,(cdr ext-y)
              lineto ,(cdr ext-x) ,(car ext-y)
              closepath)
            0.04 1 1 #f))
          (inner-stencil
           (make-path-stencil
            `(moveto ,(interval-center ext-x) ,(- (car ext-y) 0.1)
              lineto ,(interval-center ext-x) ,(+(cdr ext-y) 0.1)
              moveto ,(- (car ext-x) 0.1) ,(interval-center ext-y)
              lineto ,(+ (cdr ext-x) 0.1) ,(interval-center ext-y))
            0.04 1 1 #f))
          (outline
           (ly:make-stencil
            (ly:stencil-expr
             (ly:stencil-add box-stc inner-stencil))
            ext-x ext-y)))
     (ly:stencil-add outline stc)))

% Drums
Drums = \drummode {
   \repeat unfold 8 sn8
   \stemUp
   \repeat unfold 8 bd8
}

% Sticking
Sticking = \lyricmode {
   \override Lyrics.LyricText.font-series = #'bold
   \override Lyrics.LyricText.before-line-breaking =
   #(lambda (g)
      (let* ((note-column (ly:grob-parent g X))
             (stem (ly:grob-object note-column 'stem)))
        (if (ly:grob? stem)
            (ly:grob-set-parent! g X stem))))
   \override Lyrics.LyricText.self-alignment-X = #CENTER

   \repeat unfold 4 { \markup\show-bounding-box R \markup\show-bounding-box L 
}
   \repeat unfold 4 { \markup\show-bounding-box R \markup\show-bounding-box L 
}
}

\score {
  <<
    \new DrumStaff \new DrumVoice = "Drums" { \voiceTwo \Drums }
    \new Lyrics \lyricsto "Drums" { \Sticking }
  >>
}
```

What might cause you confusion is that the letters used are not exactly 
symmetric. What you probably want is some sort of optical correction? My 
answer just shows how to have the Lyrics align to the stem rather than the 
note column. You can still combine this with changing self-alignment-X or Y-
offset to get a non-centered alignment. E.g. use `\override 
Lyrics.LyricText.self-alignment-X = #-0.5` to have the vertical line of the 
default font L align with the stem.

To demonstrate the difference try your solution with something like

```
Drums = \drummode {
   \repeat unfold 4 sn8
   << { \voiceOne \repeat unfold 4 sn } \new DrumVoice { \voiceTwo \repeat 
unfold 4 tomml } >>
}
```

Meanwhile aligning to the proper Stem you can do things such as:

```
% Drums
Drums = \drummode <<
  \new DrumVoice = "down" { \voiceTwo \repeat unfold 4 tomml8 }
  \new DrumVoice = "up" { \voiceOne \repeat unfold 2 { sn8. 16 } }
>>

% Sticking
Sticking = \lyricmode {
   \override Lyrics.LyricText.font-series = #'bold
   \override Lyrics.LyricText.before-line-breaking =
   #(lambda (g)
      (let* ((note-column (ly:grob-parent g X))
             (stem (ly:grob-object note-column 'stem)))
        (if (ly:grob? stem)
            (ly:grob-set-parent! g X stem))))
   \override Lyrics.LyricText.self-alignment-X = #-0.5

   \repeat unfold 4 R8
}

StickingUp = \lyricmode {
   \override Lyrics.LyricText.font-series = #'bold
   \override Lyrics.LyricText.before-line-breaking =
   #(lambda (g)
      (let* ((note-column (ly:grob-parent g X))
             (stem (ly:grob-object note-column 'stem)))
        (if (ly:grob? stem)
            (ly:grob-set-parent! g X stem))))
   \override Lyrics.LyricText.self-alignment-X = #-0.5

   \repeat unfold 4 L8
}


\score {
  <<
    \new DrumStaff = "staff" \Drums
    \new Lyrics \lyricsto "down" { \Sticking }
    \new Lyrics \with { alignAboveContext = "staff" } \lyricsto "up" { 
\StickingUp }
  >>
}
```

Cheers,
Valentin

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

Reply via email to