lilypond-user
[Top][All Lists]
Advanced

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

Macro function for changing the size of a single staff


From: Paul Morris
Subject: Macro function for changing the size of a single staff
Date: Sat, 22 Dec 2012 00:33:51 -0500

Hi all,  To resize a single staff you have to change three different settings, 
using the same value for each[1].  This felt redundant and complex, so I wrote 
a little macro function that sets all three at once, simplifying the process.  
Maybe others will find it useful too.  

See the snippet below for how to use it.  I added it to the LSR[2], but it 
needs LilyPond 2.16.1 -- unless I can get it to work with 2.14.2 by figuring 
out how to use the "$" with  \set Staff.fontSize = #new-size 

Cheers,
-Paul


[1] http://www.lilypond.org/doc/v2.16/Documentation/learning/size-of-objects  
and 
http://www.lilypond.org/doc/v2.16/Documentation/learning/length-and-thickness-of-objects

[2] http://lsr.dsi.unimi.it/LSR/Item?u=1&id=862



%%%% BEGIN SNIPPET %%%%

\version "2.16.1"

staffSize = #(define-music-function (parser location new-size) (number?)
#{
  \set Staff.fontSize = #new-size  
  \override Staff.StaffSymbol #'staff-space = #(magstep new-size)
  \override Staff.StaffSymbol #'thickness = #(magstep new-size)
#})

theMusic = \relative c' { 
  a'8 a a a a \ff a a a
}

\score {
  <<
    \new Staff 
      { \theMusic }

    % the usual way to change a staff's size
    \new Staff \with {
      fontSize = #-3
      \override StaffSymbol #'staff-space = #(magstep -3)
      \override StaffSymbol #'thickness = #(magstep -3)
      } 
      { \theMusic }

    % simplified with staffSize function
    \new Staff \with {
      \staffSize #-3
      } 
      { \theMusic }
  >>
}

%%%% END SNIPPET %%%%


reply via email to

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