-1.5.18.jcn1
+--- ../lilypond-1.5.18/CHANGES Sat Oct 27 08:12:57 2001
+++ b/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.'
+ ===========
+ 1.5.18.jcn1
===========
* Moved python modules to ./python.
MAJOR_VERSION=1
MINOR_VERSION=5
PATCH_LEVEL=18
-MY_PATCH_LEVEL=jcn1
+MY_PATCH_LEVEL=moh1
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
--- /dev/null
+\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'
+ }
+ >
+}
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_) {
/** 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
{
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;
/** 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;
(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 ))
(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.")
"a single piece of lyrics"
'(
word-space
+ alignment
+ ignore-length-mismatch
+ begin-alignment
end-alignment
))