lilypond-devel
[Top][All Lists]
Advanced

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

Re: bounty hack for some (non-Mike) Schemer out there


From: address@hidden
Subject: Re: bounty hack for some (non-Mike) Schemer out there
Date: Sat, 9 Feb 2013 17:19:42 +0100

On 4 févr. 2013, at 16:01, Kieren MacMillan <address@hidden> wrote:

> Hello all!
> 
> A few weeks ago, in response to Mike Solomon's call for features and bugs, I 
> posted a request:
> 
>>> 2. Allowing a text markup (especially a MetronomeMark) to have a "minimum 
>>> measure length". This would avoid collisions, particularly where there are 
>>> lots of multi-measure rests (e.g., orchestral parts).
> 
> His response was:
> 
>> #2 is doable via a hack.  Minimum lengths can only work if you use spanners, 
>> but you can hijack the tempo print function for a text spanner (and suppress 
>> the line afterwards) and then create a scheme engraver for text spanner that 
>> uses whatever as the left bound and the next bar line's non-musical paper 
>> column as the right bound.  Or you could just use the existing engraver and 
>> use the last note in the measure as a bound, although this will potentially 
>> create uneven spacing in a measure.
>> 
>> You'll have to manually put this TextSpanner in the topmost context and/or 
>> use ly:side-position-interface::move-to-extremal-staff (I'd recommend the 
>> former, as the latter is powerful but falls in the category of LilyPond 
>> black magic).  Make sure to use springs and rods and set a minimum-length - 
>> there's an example in the docs with a hairpin or glissando or something 
>> spanner-y that does this.
> 
> Is there anyone out there who can work on this with me? I've got some money 
> to put towards the implementation.
> 
> Thanks!
> Kieren.

Should get you started OK:

\version "2.17.8"

#(define my-text "Allegro con fuoco ma non troppo")

\new Staff << {
  \override TextSpanner.bound-details.left.text = #my-text
  \override TextSpanner.font-shape = #'normal
  \override TextSpanner.font-size = #1
  \override TextSpanner.springs-and-rods = #ly:spanner::set-spacing-rods
  \override TextSpanner.minimum-length =
    #(lambda (grob)
       (interval-length (ly:stencil-extent (grob-interpret-markup grob
                                                                  my-text)
                                           X)))
  s1*7/8\startTextSpan
  s1*1/8\stopTextSpan
  s1*7/8\startTextSpan
  s1*1/8\stopTextSpan
}
{
  R1 |
  R1 |
} >>

Cheers,
MS




reply via email to

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