lilypond-user-fr
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: InstrumentName centrés par défaut?


From: Xavier Scheuer
Subject: Re: InstrumentName centrés par défaut?
Date: Sun, 10 Feb 2008 13:16:09 +0100

Merci à vous tous pour vos réponses!
Je ne pensais vraiment pas que cette fonctionnalité n'était pas implémentée par défaut dans lilypond.
Surtout que \set Staff.instrument = \markup { \center-align "InstrumentName" } donnait des InstrumentNames centrés dans des versions précédentes de lilypond (2.7.29, voir http://www.mutopiaproject.org/cgibin/piece-info.cgi?id=686 ).

J'avais vu ta commande \instrument-name dans les Fêtes de Ramire (Mutopia), mais je dois avouer que je ne m'y retrouve pas trop dans tout ce Scheme...
J'ai finalement utilisé la commande \instrument que tu as donnée ci-dessous et elle fonctionne parfaitement, merci.
Ce serait vraiment super si tu arrivais à implémenter ça de base dans lilypond (désolé d'être à l'origine de ce travail en plus).

Bravo, bonne continuation (ce serait sympa de nous tenir au courant de l'évolution) et encore merci!


Xavier


Le dimanche 10 février 2008 à 12:12 +0100, Nicolas Sceaux a écrit :
Le 8 févr. 08 à 16:27, Valentin Villenave a écrit :
>
> C'est très utile ; pourrais-tu le poster sur le LSR ? (ou bien me
> préparer un snippet pour que je le poste moi-même)

LSR database ne fonctionne pas chez moi. Voici un snippet
retravaillé, qui va chercher la valeur de l'indentation
automatiquement. Donc normallement c'est plug-n-play :

%{
Horizontaly centered instrument names: use \instrument for a single
line instrument name, and \instruments for a multi line instrument
name.
%}

#(define-markup-command (hcenter-pad layout props width arg)
  (number? markup?)
  (let* ((arg-stencil (interpret-markup layout props arg))
         (w (interval-length (ly:stencil-extent arg-stencil X)))
         (pad-stencil (ly:make-stencil ""
                        (cons 0 (if (> w width)
                                 0
                                 (/ (- width w) 2.0)))
                        '(-0.1 . 0.1))))
   (stack-stencil-line 0
     (list pad-stencil arg-stencil pad-stencil))))

#(define-markup-command (instruments layout props texts) (markup-list?)
    (let ((indent (ly:output-def-lookup layout 'indent)))
      (interpret-markup layout props
       (make-column-markup
         (map (lambda (m) (markup #:hcenter-pad indent #:huge m))
         texts)))))

#(define-markup-command (instrument layout props text) (markup?)
  (interpret-markup layout props
   (markup #:instruments (text))))

\score {
   \new StaffGroup <<
     \new Staff <<
       \set Staff . instrumentName = \markup \instrument Violons
       { c'4 d' e' f' g'1 }
     >>
     \new Staff <<
       \set Staff . instrumentName = \markup \instruments { Haute- 
contres Tailles }
       { \clef alto c'4 d' e' f' g'1 }
     >>
     \new Staff <<
       \set Staff . instrumentName = \markup \instrument Basses
       { \clef bass c4 c c g, c1 }
     >>
   >>
   \layout { indent = 4\cm }
}

Je suis en train de refléchir à la possibilité d'avoir ça de base
dans LilyPond, sans avoir à utiliser explicitement des commandes
de markup.

Nicolas



reply via email to

[Prev in Thread] Current Thread [Next in Thread]