lilypond-devel
[Top][All Lists]
Advanced

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

Suppress continuing LyricHyphen under grace note at start of line (issue


From: tdanielsmusic
Subject: Suppress continuing LyricHyphen under grace note at start of line (issue4313047)
Date: Thu, 24 Mar 2011 18:45:40 +0000

Reviewers: ,

Message:
This is a suggested fix for issue 688:
http://code.google.com/p/lilypond/issues/detail?id=688
Reg tests look OK.

The output shown by the regression test looks right to me, and the
simple example in issue 688 is certainly fixed.
But I'm unsure whether this is the desired output in
other circumstances, so I've expanded the regression
test to show a few more situations.

Trevor


Description:
Suppress continuing LyricHyphen under grace note at start of line

 - fixes 688

Please review this at http://codereview.appspot.com/4313047/

Affected files:
  A input/regression/lyric-hyphen-grace.ly
  M lily/include/moment.hh
  M lily/lyric-hyphen.cc
  M lily/moment.cc


Index: input/regression/lyric-hyphen-grace.ly
diff --git a/input/regression/lyric-hyphen-grace.ly b/input/regression/lyric-hyphen-grace.ly
new file mode 100644
index 0000000000000000000000000000000000000000..64a11b1d238f0c02f43c486bad82a34633d06eb9
--- /dev/null
+++ b/input/regression/lyric-hyphen-grace.ly
@@ -0,0 +1,30 @@
+\header {
+
+  texidoc = "No hyphen should be printed under a grace note at the start
+of a line if the grace's main note starts a new syllable."
+}
+
+<<
+  \new Staff {
+    \appoggiatura f'8 g'2 g'( | \break
+    \appoggiatura f'8 g'2) \appoggiatura f'8 g'2 | \break
+    \appoggiatura f'8 g'2 g' | \break
+    g'2 g' |
+  }
+  \addlyrics {
+    \lyricmode {
+      bla -- bla -- bla -- bla -- bla -- bla -- bla
+    }
+  }
+  \new Staff {
+    g'2 g' |
+    g'2 g' |
+    g'2 g' |
+    g'2 g' |
+  }
+  \addlyrics {
+    \lyricmode {
+      bla -- bla -- bla -- bla -- bla -- bla -- bla -- bla
+    }
+  }
+>>
Index: lily/include/moment.hh
diff --git a/lily/include/moment.hh b/lily/include/moment.hh
index 6a3922066eefe427a02cc74267857ef52c0363aa..59dfcd3798b3de2cf7dac935b16186b90811dccf 100644
--- a/lily/include/moment.hh
+++ b/lily/include/moment.hh
@@ -54,6 +54,8 @@ public:
   bool to_bool () const;
   I64 den () const;
   I64 num () const;
+  Rational main_part () const;
+  Rational grace_part () const;
   /*
     Deliver a copy of THIS as a smobified SCM
   */
@@ -81,4 +83,3 @@ ostream &operator << (ostream &, Moment const &);
 bool moment_less (SCM a, SCM b);

 #endif /* MOMENT_HH */
-
Index: lily/lyric-hyphen.cc
diff --git a/lily/lyric-hyphen.cc b/lily/lyric-hyphen.cc
index 5fae21fc34f9e4704d6561ad0637158c193b56fc..b80fcaa7d0a7b6699c5016bfffc3629ecd5b9414 100644
--- a/lily/lyric-hyphen.cc
+++ b/lily/lyric-hyphen.cc
@@ -35,10 +35,19 @@ MAKE_SCHEME_CALLBACK (Lyric_hyphen, print, 1);
 SCM
 Lyric_hyphen::print (SCM smob)
 {
+
   Spanner *me = unsmob_spanner (smob);
   Drul_array<Item *> bounds (me->get_bound (LEFT),
                             me->get_bound (RIGHT));

+  /* No hyphen should be printed under a grace note at the start
+     of a line if the grace's main note starts a new syllable.  */
+
+ if (Paper_column::when_mom (bounds[LEFT]->get_column ()).grace_part () != Rational (0)
+      && Paper_column::when_mom (bounds[LEFT]->get_column ()).main_part ()
+ == Paper_column::when_mom (bounds[RIGHT]->get_column ()).main_part ())
+    return SCM_EOL;
+
   if (bounds[LEFT]->break_status_dir ()
       && (Paper_column::when_mom (bounds[LEFT])
          == Paper_column::when_mom (bounds[RIGHT]->get_column ())))
@@ -153,4 +162,3 @@ ADD_INTERFACE (Lyric_hyphen,
               "padding "
               "thickness "
               );
-
Index: lily/moment.cc
diff --git a/lily/moment.cc b/lily/moment.cc
index ae6ea63dd2f6f421c0ea2b127a6edd0dfd97d123..1a646b9735ce08eb9fb9b11035d812da5db1c010 100644
--- a/lily/moment.cc
+++ b/lily/moment.cc
@@ -159,6 +159,18 @@ Moment::to_bool () const
   return main_part_ || grace_part_;
 }

+Rational
+Moment::main_part () const
+{
+  return main_part_;
+}
+
+Rational
+Moment::grace_part () const
+{
+  return grace_part_;
+}
+
 void
 Moment::set_infinite (int k)
 {
@@ -207,4 +219,3 @@ moment_less (SCM a, SCM b)
 {
   return *unsmob_moment (a) < *unsmob_moment (b);
 }
-





reply via email to

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