bug-lilypond
[Top][All Lists]
Advanced

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

Re: countPercentRepeats: print number "1"?


From: Neil Puttock
Subject: Re: countPercentRepeats: print number "1"?
Date: Wed, 18 Aug 2010 22:30:17 +0100

On 17 August 2010 21:57, Alexander Kobel <address@hidden> wrote:

> Oops, sorry, I see now the difference between those options for a
> MultiMeasureRest and the PercentRepeat.  For the former, there already is
> the grob, and it just lacks the number. In the second case, the number is
> not suppressed; rather, no PercentRepeat is there at all, and we have to dig
> deeper to create/simulate one.  Anyway, the request sounds reasonable to me.

I should know by now that declaring something impossible in LilyPond
is unwise. :)

It is possible to generate a percent repeat for the first bar; all you
have to do is create an explicit PercentEvent (which usually comes
from the iterator):

forcePercent =
#(define-music-function (parser location mus) (ly:music?)
   "Create a percent repeat the same length as MUS, labelled `1' if
countPercentRepeats is set."
   (let ((percent (make-music 'PercentEvent
                              'repeat-count 1
                              'length (ly:music-length mus))))

     (make-event-chord (list percent))))

<<
  \context Voice = "foo" {
    \clef bass
    c4 r g r
    c4 r g r
    c4 r g r
    c4 r g r
  }
  \context Voice = "foo" {
    \set countPercentRepeats = ##t
    \override PercentRepeat #'transparent = ##t
    \override PercentRepeatCounter #'staff-padding = #1
    \repeat percent 4 { \forcePercent s1 }
  }
>>

> Such an engraver might be interesting to have in general - I can't see a
> simple way (other than hijacking the MultiMeasureRestText) to center a
> markup above a measure, right?

It should be quite simple to implement: the basic code for centring is
already there for full-bar rests and percents.

Cheers,
Neil



reply via email to

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