Generating custom flags: Difference between revisions

Import snippet from LSR
 
mNo edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
The <code>stencil</code> property of the <code>Flag</code> grob can be set to a custom scheme function to generate the glyph for the flag.
The <code>stencil</code> property of the <code>Flag</code> grob can be set to a custom Scheme function to generate the glyph for the flag.


<lilypond version="2.24.0">
<lilypond version="2.24">
#(define-public (weight-flag grob)
#(define-public (weight-flag grob)
   (let* ((stem-grob (ly:grob-parent grob X))
   (let* ((stem-grob (ly:grob-parent grob X))
Line 37: Line 37:
{
{
   \time 1/4
   \time 1/4
   \textMark "Normal flags"
   <>^"Normal flags"
   \snippetexamplenotes
   \snippetexamplenotes


   \textMark "Custom flag: inverted"
   <>_"Custom flag: inverted"
   \override Flag.stencil = #inverted-flag
   \override Flag.stencil = #inverted-flag
   \snippetexamplenotes
   \snippetexamplenotes


   \textMark "Custom flag: weight"
   <>^"Custom flag: weight"
   \override Flag.stencil = #weight-flag
   \override Flag.stencil = #weight-flag
   \snippetexamplenotes
   \snippetexamplenotes


   \textMark "Revert to normal"
   <>_"Revert to normal"
   \revert Flag.stencil
   \revert Flag.stencil
   \snippetexamplenotes
   \snippetexamplenotes
Line 56: Line 56:
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Rhythms]]
[[Category:Rhythms]]
[[Category:Scheme]]
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Snippet]]