lilypond-user
[Top][All Lists]
Advanced

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

Re: Title font and font size change


From: Thomas Morley
Subject: Re: Title font and font size change
Date: Tue, 5 Feb 2013 00:18:30 +0100

2013/2/5 Kieren MacMillan <address@hidden>:
> Hi,
>
>>> What about a function which applies a multiplier to the relative size, to 
>>> fake an "abs-fontsize"?
>> What do you mean? What and where should I write?
>
> It would be something like
>
>   \context {
>     \Score
>     \override LyricText #'font-size = #(some-function-here)
>   }
>
> but I wouldn't have the foggiest idea how to actually write the function to 
> do what I'm suggesting (i.e., take the global font size, and apply a 
> multiplier which would force the final output to be an absolute size).
>
> Sorry,
> Kieren.

Hi Kieran,

I've sent a mail with a suggestion, but forgot to answer all.

Here again:


How about:

\version "2.16.1"

absLyrTxt =
#(define-music-function (parser location size)(number?)
"
 Ensure equal size of LyricText.
 Works with changed `set-global-staff-sizeĀ“ and
 custom-staff-sizes.
 Setting size to 12 is default.
"
#{
        \override LyricText #'before-line-breaking =
          #(lambda (grob)
            (let* ((layout (ly:grob-layout grob))
                   (ref-size (ly:output-def-lookup layout 'text-font-size 12))
                   (magnification (/ size ref-size))
                   (font-size (magnification->font-size magnification)))
            (ly:grob-set-property! grob 'font-size font-size)))
#})

% Helper-function for less typing. Thanks to Paul Morris.
% -> http://lsr.dsi.unimi.it/LSR/Item?u=1&id=862
staffSize = #(define-music-function (parser location new-size) (number?)
#{
  \set Staff.fontSize = #new-size
  \override Staff.StaffSymbol #'staff-space = #(magstep new-size)
  \override Staff.StaffSymbol #'thickness = #(magstep new-size)
#})

%%%%%%%%%% Test

% Try different values:
#(set-global-staff-size 10)

\layout {
        \context {
                \Lyrics
                \absLyrTxt #12
        }
}

vce = { \time 3/4 g'4 g' g' }

txt = \lyricmode { blah blah blah }

% 2.16.1-Example

<<
  \new Staff \with { \staffSize #-8 }
    \new Voice = "mus1" \vce
  \new Lyrics \lyricsto "mus1" \txt

  \new Staff \with { \staffSize #8 }
    \new Voice = "mus2" \vce
  \new Lyrics \lyricsto "mus2" \txt
>>


% 2.17.10-Example
%{
mus =
<<
  \new Staff
    \new Voice = "mus" \vce
  \new Lyrics \lyricsto "mus" \txt
>>

<<
\new StaffGroup \with { \staffSize #-16 } << \mus >>
\new StaffGroup \with { \staffSize #-8 } << \mus >>
\new StaffGroup \with { \staffSize #-4 } << \mus >>
\new StaffGroup \with { \staffSize #0 } << \mus >>
\new StaffGroup \with { \staffSize #4 } << \mus >>
\new StaffGroup \with { \staffSize #8 } << \mus >>
\new StaffGroup \with { \staffSize #16 } << \mus >>
>>
%}


HTH,
  Harm



reply via email to

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