[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Espacement vertical de markups
From: |
Jean Abou Samra |
Subject: |
Re: Espacement vertical de markups |
Date: |
Fri, 26 Aug 2022 22:56:58 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 |
Le 26/08/2022 à 22:38, éric BELLOCQ a écrit :
Merci Pierre pour la fonction,
oui le rendu est tout à fait ce que je cherche.
Je me permets d'abuser avec une question en plus :
est-il compliqué d'avoir un nombre d'argument variable pour éviter
d'avoir à coder trop de d'arguments vides c-à-d les "" quand il y a
moins de lignes que le maximum ?
C'est possible, en donnant à la fonction un seul argument de type
markup-list? au lieu de plusieurs arguments de type markup? . Par
contre, il faut alors mettre des accolades (logique, sinon
LilyPond ne pourrait pas savoir où les arguments se terminent).
\version "2.22.2"
#(define-markup-command (indic layout props args)
(markup-list?)
(interpret-markup layout props
#{
\markup
\override #'(baseline-skip . 2.2)
\center-column { #args }
#}))
\score {
\new RhythmicStaff {
\textLengthOn
4-\markup\indic { 11 22 }
4-\markup\indic { 11 22) }
4-\markup\indic { 11 33 }
4-\markup\indic { 11 = 33 }
4-\markup\indic { 11 22 33 }
}
}
D'ailleurs, en réalité on n'a même pas besoin d'une fonction ici (mais
la technique est moins connue) :
\version "2.22.2"
\score {
\new RhythmicStaff {
\textLengthOn
\override TextScript.baseline-skip = 2.2
4-\markup \center-column { 11 22 }
4-\markup \center-column { 11 22) }
4-\markup \center-column { 11 33 }
4-\markup \center-column { 11 = 33 }
4-\markup \center-column { 11 22 33 }
}
}
Et si vous trouvez le nom \center-column trop long, vous pouvez toujours
faire
\version "2.22.2"
%{
#(define-markup-command (cc layout props args) (markup-list?)
(interpret-markup layout props #{ \markup \center-column { #args } #}))
%}
% ou en plus concis :
\markup cc = #center-column-markup
\score {
\new RhythmicStaff {
\textLengthOn
\override TextScript.baseline-skip = 2.2
4-\markup \cc { 11 22 }
4-\markup \cc { 11 22) }
4-\markup \cc { 11 33 }
4-\markup \cc { 11 = 33 }
4-\markup \cc { 11 22 33 }
}
}
Bref, comme souvent, il y a beaucoup de possibilités.
La page de la documentation sur la définition de commandes pour
markup personnalisées est ici :
https://lilypond.org/doc/v2.23/Documentation/extending/new-markup-command-definition
Cordialement,
Jean