Contrôle de la position et du nombre de points d’une barre de reprise

Il est possible de personnaliser la position et le nombre de points d’une barre indiquant une reprise, que ce soit en définissant de nouvelles barres de mesure personnalisées ou bien en redéfinissant la manière dont les indications de reprise par défaut sont dessinées. Ceci s’avère tout particulièrement utile dans le cas de portées aux lignes adaptées comme dans l’exemple ci-dessous.

#(define ((make-custom-dot-bar-line dot-positions) is-span grob extent)
   "Draw dots (repeat sign dots) at DOT-POSITIONS.

The coordinates of DOT-POSITIONS are equivalent to the coordinates of
`StaffSymbol.line-positions`; a dot position of X and a line position
of X indicate the same vertical position.

IS-SPAN is not used in this custom function."
   (let* ((staff-space (ly:staff-symbol-staff-space grob))
          (dot (ly:font-get-glyph (ly:grob-default-font grob)
               "dots.dot"))
          (stencil empty-stencil))
     (for-each
      (lambda (dp)
        (set! stencil (ly:stencil-add stencil
                        (ly:stencil-translate-axis
                         dot (* dp (/ staff-space 2)) Y))))
      dot-positions)
     stencil))

% With the procedure above we can define custom bar lines, for example,
% that resemble standard repeat sign bar lines except that there are
% three dots at staff positions -3, 0, and 3.

#(add-bar-glyph-print-procedure "*" (make-custom-dot-bar-line '(-3 0 3)))
\defineBarLine ".|*" #'("" "*" "")
\defineBarLine "*|." #'("" "*" "")

% We can also customize the dot positions used in all default repeat
% signs by redefining the print procedure of the colon bar glyph (":").
% On a staff with line positions of `(-4 -2 2 4)`, the default repeat
% sign dots appear at `(-3 3)`, but we can put them at `(-1 1)` instead.
#(add-bar-glyph-print-procedure ":" (make-custom-dot-bar-line '(-1 1)))


\new Staff \with {
  \override StaffSymbol.line-positions = #'(-4 -2 2 4)
  \override StaffSymbol.staff-space = #1.3
} \relative f' {
  g1 \bar ".|*"
  g \bar "*|."
  g \bar ".|:-|"
  g \bar ":|."
  g |
  \repeat volta 2 { g }
}
[image of music]

LilyPond snippets v2.25.34 (development-branch).