Am 07.12.2016 um 23:59 schrieb Thomas Morley:
So here a very first shot.

Thanks for your work. I think the attached code shows a problem of your code ...

Knut

\version "2.19.53"

#(define (lh-test-stencil arg)
 (lambda (grob)
   (if (ly:stencil? (ly:lyric-hyphen::print grob))
       (let* ((stil (ly:lyric-hyphen::print grob))
              (x-ext (ly:stencil-extent stil X))
              (dash-period (ly:grob-property grob 'dash-period))
              (arg-stil (grob-interpret-markup grob arg))
              (arg-stil-x-ext (ly:stencil-extent arg-stil X))
              (length-to-print (interval-length x-ext))
              (guess (max 0 (truncate (/ length-to-print dash-period))))
              (guessed-args-line-length (* guess dash-period))
              (line-length-diff (- length-to-print guessed-args-line-length))
              (line-length-diff-for-each-arg (/ line-length-diff guess))
              (first-arg-length (+ dash-period line-length-diff-for-each-arg))
              (first-arg-end-coord
                  (/ (* first-arg-length
                        (- (interval-length x-ext)
                           (interval-length arg-stil-x-ext)))
                     length-to-print))
              (list-of-starts
                (map
                  (lambda (n) (* n first-arg-end-coord))
                  (iota (+ 1 guess)))))
         (ly:stencil-translate-axis
           (apply
             ly:stencil-add
             (map
               (lambda (x-val) (ly:stencil-translate-axis arg-stil x-val X))
               list-of-starts))
           (car x-ext) X))
       (ly:grob-suicide! grob))))


newLH = #(define-music-function (mrkp)(markup?)
        #{
          \override LyricHyphen.after-line-breaking =
            #(lambda (grob)
              (if (ly:stencil? (ly:lyric-hyphen::print grob))
                  (ly:grob-set-property! grob 'stencil
                    (ly:stencil-add
                      (stencil-with-color (ly:lyric-hyphen::print grob) red)
                      ((lh-test-stencil mrkp ) grob)))))
        #})

\paper { ragged-right = ##f }

\layout {
  \context {
    \Lyrics
    \newLH "¦"
    \override LyricHyphen #'height = #0.6
  }
}

<<
    \new Voice = "sopran" { c''2.. 8 \bar "|." }
    \new Lyrics \lyricsto sopran { bro -- ken  }
>>

Attachment: harmA.pdf
Description: Adobe PDF document

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to