[Top][All Lists]
[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: |
Sat, 27 Oct 2001 08:27:23 +0100 (BST) |
Han-Wen Nienhuys writes:
> yes, please send the patch relative to 1.4.8.moh1 ; It barfs on all
> sides when I try to apply it to 1.5.18 (which has moh1 already).
>
Here is the new patch. Incorporates the same changes, but against 1.5.18. Hope
it
applies cleanly this time!
Mark
Generated by address@hidden,
>From = lilypond-1.5.18, To = lilypond-1.5.18.moh1
usage
cd lilypond-source-dir; patch -E -p1 < lilypond-1.5.18.moh1.diff
Patches do not contain automatically generated files
or (urg) empty directories,
i.e., you should rerun autoconf, configure
diff -purN ../lilypond-1.5.18/CHANGES ./CHANGES
--- ../lilypond-1.5.18/CHANGES Sat Oct 27 08:12:57 2001
+++ ./CHANGES Sat Oct 27 07:46:59 2001
@@ -1,3 +1,12 @@
+1.5.18.moh1
+===========
+
+* Further work on more flexible control of lyric alignment.
+ - new properties "alignment", "ignore-length-mismatch", "begin-alignment"
and "end-alignment" to control non-centered lyric alignment
+
+1.5.18
+======
+
1.5.17.jcn6 - aka: `pgwit! Ah, dacht dat-i zo wel aardig was.'
===========
diff -purN ../lilypond-1.5.18/VERSION ./VERSION
--- ../lilypond-1.5.18/VERSION Sat Oct 27 08:12:57 2001
+++ ./VERSION Sat Oct 27 07:43:41 2001
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
MAJOR_VERSION=1
MINOR_VERSION=5
PATCH_LEVEL=18
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=moh1
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
diff -purN ../lilypond-1.5.18/input/regression/lyric-align.ly
./input/regression/lyric-align.ly
--- ../lilypond-1.5.18/input/regression/lyric-align.ly Thu Jan 1 01:00:00 1970
+++ ./input/regression/lyric-align.ly Sat Oct 27 07:42:52 2001
@@ -0,0 +1,73 @@
+\version "1.3.146"
+\header{
+ texidoc="Lyric alignment
+
+ Lyric alignment is adjustable both interms of alignment between stanzas and
on notehead.
+
+ If the property alignment is not set, there is automatic determination of
alignment type based on punctuation. (ee lyric-phrasing.ly)
+
+"
+}
+
+%\paper { linewidth = -1. }
+\score {
+ \addlyrics
+ \context Voice = "v" \notes \relative c'' {
+ \property Staff.automaticMelismata = ##t
+ \cadenzaOn
+ a\breve \bar "||" a1 \bar "|" a \bar "|" a \bar "||" \break a \bar
"|" a \bar "|" a \bar "|" a \bar "||" \break a \bar "|" a \bar "|."
+ }
+ \context Lyrics <
+ \context LyricsVoice = "v-1" \lyrics {
+% \property LyricsVoice . stanza = "1:"
+ \property Lyrics . LyricText \override #'ignore-length-mismatch = ##t
+ \property Lyrics . LyricText \override #'alignment = #-1
+ \property Lyrics . LyricText \override #'begin-alignment = #8
+
+ "Particularly useful for reciting notes "
+ left
+
+ \property Lyrics . LyricText \override #'alignment = #0
+
+ centered
+
+ \property Lyrics . LyricText \override #'alignment = #1
+
+ right
+
+ \property Lyrics . LyricText \override #'alignment = #-1
+ \property Lyrics . LyricText \override #'begin-alignment = #2
+
+ left_half_way
+
+ \property Lyrics . LyricText \override #'begin-alignment = #4
+
+ left_one_quarter
+
+ \property Lyrics . LyricText \override #'begin-alignment = #10
+
+ left_one_tenth
+
+ \property Lyrics . LyricText \override #'begin-alignment = #1
+
+ left_one_whole
+
+ \property Lyrics . LyricText \override #'ignore-length-mismatch = ##f
+ \property Lyrics . LyricText \override #'begin-alignment = #4
+
+ Very_short_lyrics_remain_in_touch_with_their_note
+
+ \property Lyrics . LyricText \override #'alignment = #1
+ \property Lyrics . LyricText \override #'end-alignment = #1.1
+ \property Lyrics . LyricText \override #'ignore-length-mismatch = ##t
+
+
+ Unless_ignore-length-mismatch_is_true
+
+ }
+ \context LyricsVoice = "v-2" \lyrics {
+% \property LyricsVoice . stanza = "2:"
+ " with many syllables under them." l c r l l l x x x note' true'
+ }
+ >
+}
diff -purN ../lilypond-1.5.18/lily/syllable-group.cc ./lily/syllable-group.cc
--- ../lilypond-1.5.18/lily/syllable-group.cc Sat Oct 27 08:12:57 2001
+++ ./lily/syllable-group.cc Sat Oct 27 07:42:53 2001
@@ -104,7 +104,7 @@ Syllable_group::set_lyric_align (const c
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 c
/** determine the distance to translate lyrics to get correct alignment
Rules: If alignment is centre, translate = 0
Otherwise,
- If (length of longest lyric) < property("end-alignment") *
(length of shortest lyric),
+ If (length of longest lyric) < (property {begin,end}-alignment) *
(length of shortest lyric),
- centre longest lyric on notehead
Otherwise
- move so shortest lyric just reaches notehead centre
@@ -141,11 +141,20 @@ 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 () /
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;
+ 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;
+ }
+
translate *= alignment_i_ ;
}
return translate;
@@ -153,13 +162,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;
diff -purN ../lilypond-1.5.18/scm/grob-description.scm
./scm/grob-description.scm
--- ../lilypond-1.5.18/scm/grob-description.scm Sat Oct 27 08:12:57 2001
+++ ./scm/grob-description.scm Sat Oct 27 07:50:48 2001
@@ -316,7 +316,9 @@
(self-alignment-X . 0)
(non-rhythmic . #t)
(word-space . 0.6)
- (end-alignment . 5)
+ (ignore-length-mismatch . #f)
+ (begin-alignment . 4)
+ (end-alignment . 2)
(font-family . roman)
(font-shape . upright)
(meta . ,(grob-description lyric-syllable-interface
text-interface font-interface ))
diff -purN ../lilypond-1.5.18/scm/grob-property-description.scm
./scm/grob-property-description.scm
--- ../lilypond-1.5.18/scm/grob-property-description.scm Sat Oct 27
08:12:57 2001
+++ ./scm/grob-property-description.scm Sat Oct 27 07:42:53 2001
@@ -381,7 +381,10 @@ function of type (beam multiplicity dy s
(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 'alignment number? "alignment of lyrics on
notehead, -1 is LEFT, 0 is CENTRE, 1 is RIGHT .")
+(grob-property-description 'ignore-length-mismatch boolean? "if #t, stanzas
with shorter lyrics can be moved away from their respective note-head by the
lyric alignment code.")
+(grob-property-description 'begin-alignment number? "proportion of lyric
length from beginning to align with note-head for left-aligned lyrics.")
+(grob-property-description 'end-alignment number? "proportion of lyric length
from end to align with note-head for right-aligned 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 -purN ../lilypond-1.5.18/scm/interface-description.scm
./scm/interface-description.scm
--- ../lilypond-1.5.18/scm/interface-description.scm Sat Oct 27 08:12:57 2001
+++ ./scm/interface-description.scm Sat Oct 27 07:42:53 2001
@@ -533,6 +533,9 @@ that helps show the length of a melissim
"a single piece of lyrics"
'(
word-space
+ alignment
+ ignore-length-mismatch
+ begin-alignment
end-alignment
))