Jump to content

Drawing circles around note heads: Difference between revisions

From LilyPond wiki
mNo edit summary
other notes without circle
 
Line 16: Line 16:
   \etc
   \etc


{ \circle c'' }
{ a' b' \circle c'' d'' }
</lilypond>
</lilypond>



Latest revision as of 21:22, 31 January 2026

A circle can be drawn around a note head by providing a custom Scheme function to temporarily override the stencil property.

\version "2.24"

% LSR originally contributed by Valentin
% LSR http://lists.gnu.org/archive/html/lilypond-user/2010-10/msg00523.html

circle = \tweak NoteHead.stencil
  #(lambda (grob)
    (let* ((note (ly:note-head::print grob))
           (combo-stencil (ly:stencil-add
               note
               (circle-stencil note 0.1 0.8))))
          (ly:make-stencil (ly:stencil-expr combo-stencil)
            (ly:stencil-extent note X)
            (ly:stencil-extent note Y))))
  \etc

{ a' b' \circle c'' d'' }