Completion_heads_engraver and Completion_rests_engraver automatically
split notes and rests at bar lines. However, they ignore notes and rests
in pickups (Auftakt, partial bars).

Here's an example demonstrating the behaviour for notes and rests. The
current and the desired behavior are attached as PDF files.

\version "2.18.0"
\score {
   <<
      { \time 4/4 \partial 4 g1 g }
      { \time 4/4 \partial 4 r1 r }
   >>
   \layout {
      \context {
         \Voice
         \remove "Note_heads_engraver"
         \consists "Completion_heads_engraver"
         \remove "Rest_engraver"
         \consists "Completion_rest_engraver"
      }
   }
}

I made the following patches to produce the desired.pdf. The version can
currently be tested on http://www.weblily.net

However, I am not an expert on Lilypond to determine if this is a proper
solution in general.

index 34a985d..9f7a659 100644
--- a/lily/completion-note-heads-engraver.cc
+++ b/lily/completion-note-heads-engraver.cc
@@ -116,7 +116,14 @@ Completion_heads_engraver::next_moment (Rational
const &note_len)
       return Moment (0, 0);
     }
 
-  Moment result = *l - *e;
+  Moment result;
+  if (*e < 0) {
+     /* pickup */
+        result = - *e;
+  } else {
+     result = *l - *e;
+  }
+
   if (result < 0)
     {
       programming_error ("invalid measure position: "
--------------------------------------------------------------

index 8f809fd..342fea2 100644
--- a/lily/completion-rest-engraver.cc
+++ b/lily/completion-rest-engraver.cc
@@ -112,7 +112,14 @@ Completion_rest_engraver::next_moment (Rational
const &note_len)
       return Moment (0, 0);
     }
 
-  Moment result = *l - *e;
+  Moment result;
+  if (*e < 0) {
+         /* pickup */
+         result = - *e;
+  } else {
+     result = *l - *e;
+  }
+
   Moment const *unit = unsmob<Moment> (get_property ("completionUnit"));
 
   if (unit)

-- 
Johannes Feulner
Tel: +49 721 33500158  [email protected]

fun communications GmbH i. L.  Bonhoefferweg 3   76327 Pfinztal
Liquidator Johannes Feulner
Sitz der Gesellschaft Karlsruhe
Amtsgericht Mannheim HRB 106906 

Attachment: current.pdf
Description: Adobe PDF document

Attachment: desired.pdf
Description: Adobe PDF document

_______________________________________________
bug-lilypond mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-lilypond

Reply via email to