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: Nicolas Sceaux
Subject: Re: InstrumentName centrés par défaut?
Date: Sun, 10 Feb 2008 12:12:54 +0100

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]