lilypond-devel
[Top][All Lists]
Advanced

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

[PATCH] 1.4 Lyric alignment


From: Mark Hindley
Subject: [PATCH] 1.4 Lyric alignment
Date: Thu, 18 Oct 2001 07:58:38 +0100 (BST)

Hi,

Here is my patch to fix/improve lyric alignment at the beginning/end of
phrases and sentences. The current behaviour just produces centred
lyrics, even though the source suggest that the first syllable should
be left-aligned and the last right-aligned.

I have implemented a new property ("end-alignment") in the
lyric-syllable-interface which allows fine control over exactly where
these non-centred lyrics are typeset. The value of "end-alignment"
specifies the proportion in from the beginning/end of the lyric that will be
aligned with the note-head. The sense is reversed for lyrics at the
beginning and end of sentences. So end-alignment of 4 (the default)
will align the note-head 1/4 in to the beginning lyric and 1/4 from the
end of the last lyric.

Any comments? If you don't like it, just set end-alignment to 2 and
you will get the old behaviour!

It is for 1.4. I haven't got my 1.5 tree up to date yet.

Mark


Generated by address@hidden,
>From = lilypond-1.4.8, To = lilypond-1.4.8.moh1

usage 

    cd lilypond-source-dir; patch -E -p1 < lilypond-1.4.8.moh1.diff

Patches do not contain automatically generated files 
or (urg) empty directories, 
i.e., you should rerun autoconf, configure

diff -urN ../lilypond-1.4.8/CHANGES ./CHANGES
--- ../lilypond-1.4.8/CHANGES   Wed Oct 17 09:25:04 2001
+++ ./CHANGES   Wed Oct 17 10:55:11 2001
@@ -1,3 +1,12 @@
+1.4.8.moh1
+==========
+
+* new property "end-alignment" to control non-centered lyric alignment
+
+
+1.4.8
+=====
+
 1.4.7.jcn2
 ==========
 
diff -urN ../lilypond-1.4.8/VERSION ./VERSION
--- ../lilypond-1.4.8/VERSION   Wed Oct 17 09:25:04 2001
+++ ./VERSION   Wed Oct 17 10:40:25 2001
@@ -2,7 +2,7 @@
 MAJOR_VERSION=1
 MINOR_VERSION=4
 PATCH_LEVEL=8
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=moh1
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
diff -urN ../lilypond-1.4.8/lily/syllable-group.cc ./lily/syllable-group.cc
--- ../lilypond-1.4.8/lily/syllable-group.cc    Wed Mar 28 23:44:44 2001
+++ ./lily/syllable-group.cc    Wed Oct 17 11:38:09 2001
@@ -131,7 +131,7 @@
 /** 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 @@
   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;
diff -urN ../lilypond-1.4.8/scm/grob-description.scm ./scm/grob-description.scm
--- ../lilypond-1.4.8/scm/grob-description.scm  Wed Oct 17 09:24:52 2001
+++ ./scm/grob-description.scm  Wed Oct 17 10:50:21 2001
@@ -304,6 +304,7 @@
                (self-alignment-X . 0)
                (non-rhythmic . #t)
                (word-space . 0.6)
+               (end-alignment . 5)
                (font-family . roman)
                (font-shape . upright)
                (meta . ,(grob-description "LyricText" lyric-syllable-interface 
text-interface font-interface ))
diff -urN ../lilypond-1.4.8/scm/grob-property-description.scm 
./scm/grob-property-description.scm
--- ../lilypond-1.4.8/scm/grob-property-description.scm Fri Jul 27 08:02:01 2001
+++ ./scm/grob-property-description.scm Wed Oct 17 11:18:15 2001
@@ -360,6 +360,7 @@
 (grob-property-description 'visibility-lambda procedure? "a function that 
takes the break direction and returns a  cons of booleans containing 
(TRANSPARENT . EMPTY).")
 (grob-property-description 'when moment? "when does this column happen?.")
 (grob-property-description 'word-space number? "elongate left by this much 
(FIXME: cumbersome semantics).")
+(grob-property-description 'end-alignment number? "proportion of lyric length 
to align with note-head for non-centered lyrics.")
 (grob-property-description 'x-gap number? "horizontal gap between notehead and 
tie.")
 (grob-property-description 'y-free number? "minimal vertical gap between slur 
and noteheads or stems.")
 (grob-property-description 'y-offset number? "extra vertical offset for ties 
away from the center line.")
diff -urN ../lilypond-1.4.8/scm/interface-description.scm 
./scm/interface-description.scm
--- ../lilypond-1.4.8/scm/interface-description.scm     Wed Oct 17 09:24:52 2001
+++ ./scm/interface-description.scm     Wed Oct 17 10:48:57 2001
@@ -532,7 +532,8 @@
    'lyric-syllable-interface
    "a single piece of lyrics"
    '(
-    word-space  
+    word-space
+    end-alignment
     ))
 
 



reply via email to

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