lilypond-user
[Top][All Lists]
Advanced

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

Re: Print Double Percent Repeat inside a markup


From: Thomas Morley
Subject: Re: Print Double Percent Repeat inside a markup
Date: Sun, 30 Aug 2015 02:56:42 +0200

2015-08-30 2:16 GMT+02:00 Caio Giovaneti de Barros <address@hidden>:
> Thanks guys!
>
> On 28-08-2015 15:26, tisimst wrote:
>>
>> On 8/28/2015 12:18 PM, Stephen MacNeil [via Lilypond] wrote:
>>
>> > how is
>>
>>
>> Nice! That looks like a good one, too! Isn't it great to have this kind
>> of flexibility? I love it!
>>
>> - Abraham
>
> I'm tinkering here with Stephen's code to try to draw the second beam. Just
> because it seems easier to me to understand this them Abraham's (I have 0
> experience with postscript). I'll be back working in the edition again by
> Monday and decide which solution I'll take. I appreciate your help very very
> much!

Well, I don't like postscript-code as well.
Although, you can do a lot with it ;)

If you want to stick to LilyPond's markup-commands, I'd suggest to
split construction into steps otherwise it's confusing.

I'd first define a circle and a beam:

crcle = \markup \draw-circle #0.22 #0 ##t
bm = \markup \rotate #90 \beam #2 #-1 #0.58

Now you can reuse them. All left to do is combining them with
appropiate translating values.

Here let me introduce a custom markup-command `combine-list'.

#(define-markup-command (combine-list layout props args)
  (markup-list?)
  #:category align
  "Takes a list of markups combining them.
@lilypond[verbatim,quote]
\\markup \\combine-list \\vcenter \\center-align { + o X }
@end lilypond"
  (apply ly:stencil-add
    (map (lambda (e) (interpret-markup layout props e)) args)))


(I always think we miss this command, but I seem to never find the
time to put up a patch, maybe tomorrow...)

Now it's pretty much straight-forward.

Complete example:


#(define-markup-command (combine-list layout props args)
  (markup-list?)
  #:category align
  "Takes a list of markups combining them.
@lilypond[verbatim,quote]
\\markup \\combine-list \\vcenter \\center-align { + o X }
@end lilypond"
  (apply ly:stencil-add
    (map (lambda (e) (interpret-markup layout props e)) args)))

crcle = \markup \draw-circle #0.22 #0 ##t
bm = \markup \rotate #90 \beam #2 #-1 #0.58


percentRepeat =
\markup \combine-list {
  \translate #'(0.2 . 1.5) \crcle
  \translate #'(1.8 . 0.5) \crcle
  \translate#'(0 . 2) \bm
}

doublePercentRepeat =
\markup \combine-list {
  \translate #'(0.2 . 1.5) \crcle
  \translate #'(2.8 . 0.5) \crcle
  \translate#'(0 . 2) \bm
  \translate#'(1 . 2) \bm
}

\percentRepeat
\doublePercentRepeat

HTH,
  Harm



reply via email to

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