lilypond-user
[Top][All Lists]
Advanced

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

Re: Lyrics, barlines and whiteout


From: Mats Bengtsson
Subject: Re: Lyrics, barlines and whiteout
Date: Thu, 08 May 2008 15:17:01 +0200
User-agent: Thunderbird 2.0.0.5 (X11/20070716)

I would propose the following solution, which automatically adds the white box around every syllable. It works by redefining the function that typesets each LyricText object. To make it work in version 2.10, I copied (and slightly modified) a couple of functions that are predefined in version 2.11.
Add the following lines somewhere at the top of your file:

% Copied from scm/stencil.scm in version 2.11
#(define-public (stencil-with-color stencil color)
 (ly:make-stencil
  (list 'color color (ly:stencil-expr stencil))
  (ly:stencil-extent stencil X)
  (ly:stencil-extent stencil Y)))

% Copied from scm/stencil.scm in version 2.11
% Extended to add some padding around:
#(define (stencil-padded-whiteout stencil padding)
 (let*
     ((x-ext (ly:stencil-extent stencil X))
      (y-ext (ly:stencil-extent stencil Y))

      )

   (ly:stencil-add
    (stencil-with-color (ly:round-filled-box
             (interval-widen x-ext padding)
             (interval-widen y-ext padding) 0.0)
                        white)
    stencil)
   ))

#(define (text-in-white-box grob)
 (stencil-whiteout (ly:text-interface::print grob) 0.5))



and then add a setting in your layout block:

 \layout {
   \context { \GrandStaff \accepts "Lyrics" }
   \context {
       \Lyrics
           \consists "Bar_engraver"
%            \consists "Separating_line_group_engraver"
%            \override BarLine #'transparent = ##t
       \override LyricText #'stencil = #text-in-white-box

       }
 }
}


   /Mats

Kim Bastin wrote:
I'm a pretty new Lilypond user, about a week old in fact, so please be gentle.

As a learning exercise I have been entering a keyboard arrangement of one of Reger's Geistliche Gesänge, including the lyrics, which I had previously done in Sibelius (opening bars appended as Morgengesang.ly).

I have persuaded the lyrics to mask the barlines where they overlap by embedding the affected syllables in the construct

\markup { \whiteout \pad-markup #0.5 höch }

-- which works but makes ugly and confusing code. I tried writing a function:

mask = #(define-music-function (parser location syllable) (string?)
  #{
    \markup { \whiteout \pad-markup #0.5 $syllable }
  #})

but the result is a log full of errors and no compile. I'm probably attempting something I'm not ready for. (Anyone care to correct it?)

However, rather than hunt for overlapping syllables, it would be more efficient if some equivalent of \whiteout and \pad-markup #0.5 could be applied to the lyrics globally. I've looked unsuccessfully for a way of doing this. Is there one? I suppose it would involve overriding properties, but I can't identify the relevant ones.

Thanks


------------------------------------------------------------------------

_______________________________________________
lilypond-user mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/lilypond-user

--
=============================================
        Mats Bengtsson
        Signal Processing
        School of Electrical Engineering
        Royal Institute of Technology (KTH)
        SE-100 44  STOCKHOLM
        Sweden
        Phone: (+46) 8 790 8463                         
       Fax:   (+46) 8 790 7260
        Email: address@hidden
        WWW: http://www.s3.kth.se/~mabe
=============================================





reply via email to

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