lilypond-user
[Top][All Lists]
Advanced

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

Re: Shorten ledger lines


From: Paul Morris
Subject: Re: Shorten ledger lines
Date: Sun, 13 Jul 2014 14:21:52 -0700 (PDT)

Colin Campbell-8 wrote
> How about tucking the overrides into variables, so they could be put into
> an \include library?

Good call.  Or how about a music function that takes a parameter and scales
the default values, as shown below?  

One problem is you can end up hiding a bar line that doesn't need to be
hidden if you try to change ledger widths at a bar line.  So I made two
functions, one for use at bar lines and one for use between them.  Not
elegant but at least something...  (Now if only there was no gap created by
\stopStaff \startStaff...)

Cheers,
-Paul 

\version "2.18.2"

scaleLedgers =
#(define-music-function (parser location s) (number?)
   "Changes the width of ledger lines. 0.25 is default value 
    for both length-fraction and minimum-length-fraction 
    properties.  By default ledger lines extend beyond the note 
    head by 0.25 times the width of the notehead.   
    Scales the default value by s."
   (define x (* 0.25 s))
   #{
     \stopStaff
     \startStaff
     \override Staff.LedgerLineSpanner.length-fraction = #x
     \override Staff.LedgerLineSpanner.minimum-length-fraction = #x
   #})

scaleLedgersBetweenBars =
#(define-music-function (parser location s) (number?)
   #{
     % A hidden bar line corrects the gap created by \stopStaff
     % and \startStaff when \scaleLedgers is not called at a  
     % bar line, but increases spacing between notes.
     \once \hide Staff.BarLine
     \bar "|"
     \scaleLedgers #s
   #})

\score {
  \relative c' {
    g d c d
    \scaleLedgers #2
    g d c d
    \scaleLedgers #0.5
    g d c d
    \scaleLedgers #1
    g d c d
    c d
    \scaleLedgersBetweenBars #2
    g d
    c d c d
    c d
    \scaleLedgersBetweenBars #0.5
    g d
    c d c d
  }
  \layout {}
}



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Re-Shorten-ledger-lines-tp164380p164432.html
Sent from the User mailing list archive at Nabble.com.



reply via email to

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