Thanks a lot, it works.
And I tried to add a little bit more to the original file, now it only
compresses 3 or more measures of rests.

--- a/jianpu10a.ly
+++ b/jianpu10a.ly
@@ -87,6 +87,9 @@ jianpuMusic =
          ((or (music-is-of-type? m 'rest-event)
               (music-is-of-type? m 'multi-measure-rest))
           (let ((dur (ly:moment-main (ly:music-duration-length m))))
+              (if (or (music-is-of-type? m 'rest-event)
+                      (and (music-is-of-type? m 'multi-measure-rest)
+                           (<= dur 2)))
             (if (>= dur 1/2)
                 ;; split whole and half rests into quarter notes
                 (let ((q (make-music 'NoteEvent
@@ -110,7 +113,7 @@ jianpuMusic =
                     (delete 'rest-event (ly:music-property m 'types))
                     '(note-event melodic-event)))
                  (ly:music-set-property! m 'jianpu-rest #t)
-                 ))))
+                 )))))


Windy

Werner LEMBERG <w...@gnu.org> 于2024年3月24日周日 14:28写道:

>
> [Forwarding private message to have the whole conversation in the
> archive.]
>
>
>
> ---------- Forwarded message ----------
> From: Windy Deng <windy0d...@gmail.com>
> To: Werner LEMBERG <w...@gnu.org>
> Cc:
> Bcc:
> Date: Sun, 24 Mar 2024 13:00:10 +0800
> Subject: Re: Compress Long Rest in Jianpu.
> Sure, it looks like this
> [image: image.png]
> and this
> [image: image.png]
>
> seems like it just copies the staff style and removes staff lines.
>
>
> Windy
>
> Werner LEMBERG <w...@gnu.org> 于2024年3月24日周日 01:23写道:
>
>>
>> > I want to display both staff and jianpu, but if I enable
>> > \compressMMRests function, the long rests are not compressed when
>> > engraving with jianpu.
>> >
>> > Jianpu support for Lilypond is from file jiapu10a.ly on
>> > https://github.com/nybbs2003/lilypond-Jianpu . Is there any way to
>> > patch the file or something to make it support \compressMMRests?
>> >
>> > MWE is in the attachment.
>>
>> Do you have a real-world example how compressed rests look like in
>> Jianpu notation?  I guess the author hasn't thought of that...
>>
>>
>>     Werner
>>
>

Reply via email to