%% Generated by lilypond-book
%% Options: [exampleindent=10.16\mm,indent=0\mm,line-width=160\mm,paper-height=845.047\pt,paper-width=597.508\pt,papersize='(cons (* 597.508 pt) (* 845.047 pt))]
\include "lilypond-book-preamble.ly"


% ****************************************************************
% Start cut-&-pastable-section
% ****************************************************************

#(ly:set-option 'eps-box-padding 3.000000)



\paper {
  #(set-paper-size '(cons (* 597.508 pt) (* 845.047 pt)))
  indent = 0\mm
  line-width = 160\mm
  % offset the left padding, also add 1mm as lilypond creates cropped
  % images with a little space on the right
  line-width = #(- line-width (* mm  3.000000) (* mm 1))
}

\layout {
  
}




% ****************************************************************
% ly snippet:
% ****************************************************************
\sourcefilename "snippets/adjusting-slur-positions-vertically.ly"
\sourcefileline 0
%% DO NOT EDIT this file manually; it was automatically
%% generated from the LilyPond Wiki
%% (https://wiki.lilypond.community).
%%
%% Make any changes in the Wiki itself, or in
%% `Documentation/snippets/new/`, then run
%% `scripts/auxiliar/makelsr.pl`.
%%
%% This file is in the public domain.

\version "2.24.0"

\header {
%% Translation of GIT committish: de1e42ce512f3690387cdd065109bddff1b7bd6d
  texidocfr = "
Il est possible, à l'aide d'un @code{\\override Slur.positions}, de
définir le positionnement vertical des extrémités d'une liaison à des
valeurs absolues (ou, plutôt, forcer l'algoritme de LilyPond à
considérer ces valeurs comme étant préférables). Dans de nombreux cas,
ceci demande de procéder à tâtons pour obtenir une valeur acceptable,
d'autant que la commande @code{\\offset} est inefficace pour les
liaisons et affiche un avertissement.

Le code ci-dessous parmet d'ajuster le positionnement du début et de la
fin d'une liaison en spécifiant des modifications @emph{relatives} comme
le ferait un @code{\\offset}.

Syntaxe : @code{\\offsetPositions #'(@var{dy1} . @var{dy2})}
"

  doctitlefr = "Ajustement du positionnement vertical d'une liaison"

%% Translation of GIT committish: 4f16fa98fd258f08e64203c793028ea3e363b1c0
  texidoces = "

Usando @code{\\override Slur.positions} es posible fijar la
posición vertical de los puntos de inicio y de fin de una ligadura
de expresión a valores absolutos (o mejor dicho, forzar al
algoritmo de ligaduras de LilyPond para que tenga en cuenta estos
valores según se desee).  En muchos casos, esto implica bastante
ensayo y error hasta que se encuentran unos valores aceptables.
Porblablemente habrá probado la instrucción @code{\\offset} solo
para comprobar que no funciona con las ligaduras de expresión,
sino que emite una advertencia en su lugar.

El código de este fragmento nos permite trucar las posiciones de
comienzo y final especificando cambios @emph{relativos}, de manera
parecida a @code{\\offset}.

La sintaxis es: @code{\\offsetPositions #'(@var{dy1} . @var{dy2})}
"

  doctitlees = "Ajustar las posiciones de las ligaduras verticalmente"

  categories = "Expressive marks, Scheme, Tweaks and overrides"

  texidoc = "
Using @code{\\override Slur.positions} it is possible to set the
vertical position of the start and end points of a slur to absolute
values (or rather, forcing LilyPond's slur algorithm to consider these
values as desired). In many cases, this means a lot of trial and error
until good values are found. You probably have tried the
@code{\\offset} command next just to find out that it doesn't work for
slurs, emitting a warning instead.

The code in this snippet allows you to tweak the vertical start and end
positions by specifying @emph{relative} changes, similar to
@code{\\offset}.

Syntax: @code{\\offsetPositions #'(@var{dy1} . @var{dy2})}
"

  doctitle = "Adjusting slur positions vertically"
} % begin verbatim


offsetPositions =
#(define-music-function (offsets) (number-pair?)
  #{
     \once \override Slur.control-points =
       #(lambda (grob)
          (match-let ((((_ . y1) _ _ (_ . y2))
                       (ly:slur::calc-control-points grob))
                      ((off1 . off2) offsets))
            (set! (ly:grob-property grob 'positions)
                  (cons (+ y1 off1) (+ y2 off2)))
            (ly:slur::calc-control-points grob)))
  #})

\relative c'' {
  c4(^"default" c, d2)
  \offsetPositions #'(0 . 1)
  c'4(^"(0 . 1)" c, d2)
  \offsetPositions #'(0 . 2)
  c'4(^"(0 . 2)" c, d2)
  \bar "||"
  g4(^"default" a d'2)
  \offsetPositions #'(1 . 0)
  g,,4(^"(1 . 0)" a d'2)
  \offsetPositions #'(2 . 0)
  g,,4(^"(2 . 0)" a d'2)
}



% ****************************************************************
% end ly snippet
% ****************************************************************
