Printing bar numbers inside boxes or circles: Difference between revisions
m Replace version="2.24.0" with version="2.24" now that the LilyWiki extension supports auto-selecting the latest release in a stable series |
Use `break-alignment-list` |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
<lilypond version="2.24"> | <lilypond version="2.24"> | ||
\relative c' { | \relative c' { | ||
% Prevent bar numbers at the end of a line and permit them elsewhere | % Center bar numbers except at the beginning of a staff. | ||
\override Score.BarNumber.self-alignment-X = | |||
#(break-alignment-list CENTER CENTER 0.3) | |||
% Prevent bar numbers at the end of a line and permit them elsewhere. | |||
\override Score.BarNumber.break-visibility = #end-of-line-invisible | \override Score.BarNumber.break-visibility = #end-of-line-invisible | ||
\set Score.barNumberVisibility = #(every-nth-bar-number-visible 4) | \set Score.barNumberVisibility = #(every-nth-bar-number-visible 4) | ||
% Increase the size of the bar number by 2 | % Increase the size of the bar number by 2. | ||
\override Score.BarNumber.font-size = 2 | \override Score.BarNumber.font-size = 2 | ||
% Draw a | % Draw a circle round the following bar number(s). | ||
\override Score.BarNumber.stencil | \override Score.BarNumber.stencil | ||
= #(make-stencil- | = #(make-stencil-circler 0.1 0.25 ly:text-interface::print) | ||
\repeat unfold | \repeat unfold 7 { c1 } \break | ||
% Draw a | % Draw a box round the following bar number(s). | ||
\override Score.BarNumber.stencil | \override Score.BarNumber.stencil | ||
= #(make-stencil- | = #(make-stencil-boxer 0.1 0.25 ly:text-interface::print) | ||
\repeat unfold | \repeat unfold 7 { c1 } \bar "|." | ||
} | } | ||
</lilypond> | </lilypond> | ||
| Line 25: | Line 30: | ||
[[Category:Tweaks and overrides]] | [[Category:Tweaks and overrides]] | ||
[[Category:Included in the official documentation]] | [[Category:Included in the official documentation]] | ||
[[Category:Snippet]] | |||