lilypond-user
[Top][All Lists]
Advanced

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

Re: lyric tie font size


From: Mark Polesky
Subject: Re: lyric tie font size
Date: Thu, 16 Jul 2009 13:05:59 -0700 (PDT)

Michael Lauer wrote:
> I don't see any simple way, but you can copy the default (mostly in
> define-markup-commands.scm), tweak it to suit, and override the
> LyricText stencil.

Michael,

your solution is *much* more convenient for the user than mine, but I
think mine looks a little better since it prevents word-collisions at
small tie-sizes, and prevents tie-collisions at large tie-sizes. I've
included a version below which incorporates my spacing into your syntax. 

This could be incorporated in the source without too much modification.
Something like:
\override LyricText #'lyric-tie-fontsize = #-4
Maybe I'll start a thread in -devel...

- Mark


\version "2.13.0"

#(define-markup-command (my-tied-lyric layout props str)
  (string?)
  "Create tied-lyrics using custom tie-size defined here."
  (if (string-contains str "~")
      (let* ((tie-size -4)
             (backstep
               ;; prevents word-collisions at small tie-sizes
               ;; prevents  tie-collisions at large tie-sizes
               (markup #:hspace (- 0.5 (magstep (min 0 tie-size)))))
             (tie-markup
               (markup #:fontsize tie-size #:char #x203F))
             (make-tied-markup
               (lambda (x)
                 (markup #:concat (backstep tie-markup backstep x))))
             (parts (string-split str #\~))
             (markups (cons (car parts)
                            (map make-tied-markup (cdr parts)))))
        (interpret-markup layout props
          (markup #:concat ((make-line-markup markups)))))
      (interpret-markup layout props str)))

#(define (my-lyric-print grob)
  "Print lyrics using the lyric-tie size as defined in the my-tied-lyric
   procedure above."
  (let* ((text   (ly:grob-property grob 'text))
         (layout (ly:grob-layout grob))
         (defs   (ly:output-def-lookup layout 'text-font-defaults))
         (props  (ly:grob-alist-chain grob defs)))
    (interpret-markup layout props
      (if (string? text)
          (markup #:my-tied-lyric text)
          text))))

\score {
  <<
    \new Voice = "melody" {
      c''1 c''
    }
    \addlyrics {
      \override LyricText #'stencil = #my-lyric-print
      a a~b~c
    }
  >>
}



      




reply via email to

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