]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/syllable-group.cc
release: 1.5.19
[lilypond.git] / lily / syllable-group.cc
index 119acd03df36e3dfe6de5a799d5a626d8f6105e9..84a3f7fa485785e51d4f6325aa184d15e3dd1982 100644 (file)
@@ -104,7 +104,7 @@ Syllable_group::set_lyric_align (const char *punc, Grob *default_notehead_l)
 
   Grob * lyric;
   alignment_i_ = appropriate_alignment (punc);
-
+  
   // If there was no notehead in the matching voice context, use the first 
   // notehead caught from any voice context (any port in a storm).
   if (!notehead_l_) {
@@ -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) < 2 * (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
@@ -142,7 +142,7 @@ Syllable_group::amount_to_translate ()
   Real translate = 0.0;
   if (alignment_i_ != CENTER) {
     // 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 () / 2;
+    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;
@@ -153,13 +153,20 @@ Syllable_group::amount_to_translate ()
 
 
 /** determine what alignment we want.
-    Rules: if first_in_phrase_b_ is set, then alignment is LEFT.
+    Rules: if property alignment is set it specifies the alignment
+           if first_in_phrase_b_ is set, then alignment is LEFT.
            otherwise if each syllable ends in punctuation, then alignment is RIGHT
           otherwise alignment is centre.
 */
 int 
 Syllable_group::appropriate_alignment (const char *punc)
 {
+
+  SCM s=this->longest_lyric_l_->get_grob_property ("alignment");
+    if (s!=SCM_EOL) {
+      return gh_scm2int (s);
+    }
+
   if (first_in_phrase_b_)
     return LEFT;
 
@@ -259,7 +266,7 @@ Syllable_group::print_smob (SCM, SCM port, scm_print_state *)
   return 1;
 }
 
-IMPLEMENT_UNSMOB (Syllable_group, voice_entry);
+
 IMPLEMENT_SIMPLE_SMOBS (Syllable_group);
 IMPLEMENT_DEFAULT_EQUAL_P (Syllable_group);