]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/syllable-group.cc
release: 1.5.19
[lilypond.git] / lily / syllable-group.cc
index 65aa936a374bb86281b6906c258e904d51d70c85..84a3f7fa485785e51d4f6325aa184d15e3dd1982 100644 (file)
@@ -131,7 +131,7 @@ Syllable_group::set_lyric_align (const char *punc, Grob *default_notehead_l)
 /** determine the distance to translate lyrics to get correct alignment
     Rules: If alignment is centre, translate = 0
            Otherwise,
-             If (length of longest lyric) < (property {begin,end}-alignment) * (length of shortest lyric),
+             If (length of longest lyric) < property("end-alignment") * (length of shortest lyric),
                 - centre longest lyric on notehead
              Otherwise
                 - move so shortest lyric just reaches notehead centre
@@ -141,20 +141,11 @@ Syllable_group::amount_to_translate ()
 {
   Real translate = 0.0;
   if (alignment_i_ != CENTER) {
-    switch (alignment_i_) {
-      // FIXME: do we really know the lyric extent here? Some font sizing comes later?
-    case LEFT: 
-      translate =  longest_lyric_l_->extent (longest_lyric_l_, X_AXIS).length () / gh_scm2double (longest_lyric_l_->get_grob_property("begin-alignment"));
-      break;
-    case RIGHT: 
-      translate =   longest_lyric_l_->extent (longest_lyric_l_, X_AXIS).length () / gh_scm2double (longest_lyric_l_->get_grob_property("end-alignment"));
-      break;
-    }
-    if (!gh_scm2bool(longest_lyric_l_->get_grob_property("ignore-length-mismatch"))) {
-      Real l = shortest_lyric_l_->extent (shortest_lyric_l_, X_AXIS).length ();
-      translate = l <? translate;
-    }
-    
+    // FIXME: do we really know the lyric extent here? Some font sizing comes later?
+    Real l1 = longest_lyric_l_->extent (longest_lyric_l_, X_AXIS).length () / gh_scm2double (longest_lyric_l_->get_grob_property("end-alignment"));
+    Real l2 = shortest_lyric_l_->extent (shortest_lyric_l_, X_AXIS).length ();
+
+    translate = l1 <? l2;
     translate *= alignment_i_ ;
   }
   return translate;