Personalizar la posición y el número de puntos en las líneas divisorias de repetición

Si queremos personalizar la posición y/o el número de puntos en las barras de repetición, podemos definir líneas divisorias personalizadas o redefinir la manera en que se dibujan los símbolos de repetición. Esto puede ser de especial ayuda cuando se usa un pentagrama con posiciones de línea personalizadas, como se muestra en el fragmento.

#(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).