What a way to start the monday morning! Thank you Neil! I will put this in the Snippet Repository. I just thought of one enhancement I want to make and one "feature" that came up:
* Enhancement: Multiple alignments of notes for one lyric word. For example the swedish word "begynnelsen" has 4 vowels that each should be aligned with a note in the score I'm working on and using "be -- gyn -- nel -- sen" takes to much space. I thought that a simple solution to this would be to have it as 4 words and simply force 0 space between the syllables(words) in the lyrics but I find no command to do that. * Unwanted feature with \remove "Bar_engraver". The lyrics do not keep within the left limits of the staff since the vowel-alignment shifts them (usually) to the left. See example below. - Any clever workarounds like adding a s-note with after line breaking ? In that case, how do I set the width of that note? - Or should I set the X-extent of the grob-parent? All the best. /Tor \version "2.12.1" #(set-default-paper-size "a5" 'portrait) #(define vowel-set (list->char-set (string->list "AEIOUYÅÄÖaeiouyåäö"))) #(define (width grob text-string) (let* ( (layout (ly:grob-layout grob)) (props (ly:grob-alist-chain grob (ly:output-def-lookup layout 'text-font-defaults)))) (cdr (ly:stencil-extent (ly:text-interface::interpret-markup layout props (markup text-string)) X)))) #(define (center-on-vowel grob) (let* ((syllable (ly:grob-property-data grob 'text)) (vowel-count (string-count syllable vowel-set)) (vowel-position (string-index syllable vowel-set)) (prevowel (substring syllable 0 vowel-position)) (vowel (substring syllable vowel-position (+ vowel-position 1))) (prevowel-width (width grob prevowel)) (vowel-width (width grob vowel)) ; TODO: get the note width dynamically instead of hard coded (note-width (interval-length (ly:grob-property (ly:grob-parent grob X) 'X-extent)))) (- (/ (- note-width vowel-width) 2) prevowel-width))) chant = \relative c'' { c4 c4 c4 c4 c4 c4 c4 c4 c4 a2 \bar "|" c4 c4 c4 \break c4 c4 c4 c4 a4 a2 \bar "|" c4 c4 c4 c4 c4 c4 c4 c2 \break c4 b4 a4 c4 c2 \bar "|" c4 c4 c4 c4 c4 c4 c4 c2 \bar "|" \break c4 } words = \lyricmode { \set stanza = "℣." Lat mig pri -- sa dig he -- li -- ga Jung -- fru. \set stanza = "℟." Ge mig kraft mot di -- na fi -- en -- der. \set stanza = "℣." Hell dig Mar -- i -- a, full av nad, Herren _ ar med dig \set stanza = "℟." Val -- sign -- ad ar du bland kvin -- nor, } \score { \new Staff << \new Voice = "melody" \chant \new Lyrics \lyricsto "melody" \words >> \layout { \context { \Score \remove "Time_signature_engraver" timing = ##t \override Stem #'transparent = ##t } \context { \Staff \override StaffSymbol #'line-count = #4 \remove "Time_signature_engraver" \remove "Bar_engraver" } \context { \Voice \override Stem #'length = #0 \override TextScript #'font-shape = #'italic \override TextScript #'font-series = #'bold } \context { \Lyrics \override LyricText #'X-offset = #center-on-vowel } } } \paper { indent = 0\cm right-margin = 2\cm line-width = 11.5\cm ragged-last = ##t ragged-right = ##f } 2010/2/20 Neil Puttock <n.putt...@gmail.com> > On 19 February 2010 12:24, Wolf Alight <wolfali...@gmail.com> wrote: > > > My inner perfectionist only have one complaint: the note width has been > hard > > coded and the value should be adjusted if non default notehead sizes are > > used. > > The LyricText grob's X-parent is a NoteHead, so it's easy to get the > extent: > > (note-width (interval-length (ly:grob-property (ly:grob-parent grob X) > 'X-extent))) > > Regards, > Neil >
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user