Lyrics.LyricText.font-size in layout block

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Lyrics.LyricText.font-size in layout block

Colin Tennyson
I was looking for a way to change the font size of the lyrics in choir music

Looking around I came across a page describing a command 'fontsize' for use in markup sections
http://lilypond.org/doc/v2.18/Documentation/notation/font

On this page it is described that many font properties can be accessed via \override followed by dot notation
http://lilypond.org/doc/v2.18/Documentation/learning/using-variables-for-layout-adjustments
Example:
\override Lyrics.LyricText.font-shape = #'italic


Hmmmm, I figured it would be worth a shot to try a font size override in the layout block
first I tried:
\layout { Lyrics.LyricText.fontsize = #-1 }
that gave an error, so I tried the other one:
\layout { Lyrics.LyricText.font-size = #-1 }
Bingo!

My question is:
Is there documentation of what number I should give to get a particular decrease or increase in font size?

There is this page:
http://lilypond.org/doc/v2.18/Documentation/internals/lyrictext

From the above page:
The font size, compared to the ‘normal’ size. 0 is style-sheet’s normal size, -1 is smaller, +1 is bigger. Each step of 1 is approximately 12% larger; 6 steps are exactly a factor 2 larger. Fractional values are allowed.


But that is not what I'm getting.
I tried this:
\layout { Lyrics.LyricText.font-size = #-1 }
That reduced the lyrics font size to less than half of the default size, by the looks of it.

Next I tried this:
\layout { Lyrics.LyricText.font-size = #-0.2 }
I estimate that gave me about 3/4 of the default font size.


So I can sort of dial it in by trial and error, but of course it would be great to know the exact formula.



Colin Tennyson
Reply | Threaded
Open this post in threaded view
|

Re: Lyrics.LyricText.font-size in layout block

tisimst
Colin,

On Tue, Jul 19, 2016 at 1:55 PM, Colin Tennyson [via Lilypond] <[hidden email]> wrote:
I was looking for a way to change the font size of the lyrics in choir music

Looking around I came across a page describing a command 'fontsize' for use in markup sections
http://lilypond.org/doc/v2.18/Documentation/notation/font

On this page it is described that many font properties can be accessed via \override followed by dot notation
http://lilypond.org/doc/v2.18/Documentation/learning/using-variables-for-layout-adjustments
Example:
\override Lyrics.LyricText.font-shape = #'italic


Hmmmm, I figured it would be worth a shot to try a font size override in the layout block
first I tried:
\layout { Lyrics.LyricText.fontsize = #-1 }
that gave an error, so I tried the other one:
\layout { Lyrics.LyricText.font-size = #-1 }
Bingo!

My question is:
Is there documentation of what number I should give to get a particular decrease or increase in font size?

There is this page:
http://lilypond.org/doc/v2.18/Documentation/internals/lyrictext

From the above page:
The font size, compared to the ‘normal’ size. 0 is style-sheet’s normal size, -1 is smaller, +1 is bigger. Each step of 1 is approximately 12% larger; 6 steps are exactly a factor 2 larger. Fractional values are allowed.


But that is not what I'm getting.
I tried this:
\layout { Lyrics.LyricText.font-size = #-1 }
That reduced the lyrics font size to less than half of the default size, by the looks of it.

Next I tried this:
\layout { Lyrics.LyricText.font-size = #-0.2 }
I estimate that gave me about 3/4 of the default font size.


So I can sort of dial it in by trial and error, but of course it would be great to know the exact formula.

The formula isn't obvious beyond the "each step of 1 is approximately 12% larger", but it's not too complicated either. There are two other things, though. The "normal" size of 0 is 12pt when the staff size is 20pt (as defined in the add-pango-fonts function in scm/font.scm). However, the default font-size for LyricText is NOT 0, it's 1, as explained in the respective Internals Reference page you pointed to. So, the real default size of LyricText is 14pt. Here would be the "exact formula":

Given
- standard staff-height (20pt)
- normal text size (12pt)
- real staff-height (x)
- chosen font-size (y)

Then the final pt size is calculated to be:

real-lyric-font-size = x*(1+y/6)*(12/20)

Thus, at a real staff-height of 20 and font-size of 0, we get 11pt. At a font-size of 1, we get 14pt. At a staff-height of 18pt and a font-size of 1 we get 12.6pt.

HTH,
Abraham

P.S. Here is a recent thread that has code for allowing you to specify an absolute pt size (e.g., regardless of staff-height) instead of the relative 12% increments: 
Reply | Threaded
Open this post in threaded view
|

Re: Lyrics.LyricText.font-size in layout block

David Kastrup
In reply to this post by Colin Tennyson
Colin Tennyson <[hidden email]> writes:

> From the above page:
> The font size, compared to the ‘normal’ size. 0 is style-sheet’s normal
> size, -1 is smaller, +1 is bigger. Each step of 1 is approximately 12%
> larger; 6 steps are exactly a factor 2 larger. Fractional values are
> allowed.
>
>
> But that is not what I'm getting.
> I tried this:
> \layout { Lyrics.LyricText.font-size = #-1 }

Unlikely.


Parsing.../usr/local/share/lilypond/2.19.44/scm/lily.scm:1089:21: In procedure ly:parse-file in expression (ly:parse-file file-name):
/usr/local/share/lilypond/2.19.44/scm/lily.scm:1089:21: Wrong type (expecting pair): #<Context_def Lyrics /usr/local/share/lilypond/2.19.44/ly/engraver-init.ly:464:1>

(interesting error message, by the way).

> That reduced the lyrics font size to less than half of the default size, by
> the looks of it.

Your minimal example does not contain any lyrics.

> Next I tried this:
> \layout { Lyrics.LyricText.font-size = #-0.2 }
> I estimate that gave me about 3/4 of the default font size.

I estimate this gives pretty much the same error as above.

> So I can sort of dial it in by trial and error, but of course it would be
> great to know the exact formula.

Let's start with a working minimal example and go from there.  The
font-size formula is, indeed, 2**(font-size/6) as stated.  You claim to
be seeing something else but without an actual example it is impossible
to check what is going wrong.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Lyrics.LyricText.font-size in layout block

Noeck
In reply to this post by Colin Tennyson
Hi Colin,

> My question is:
> Is there documentation of what number I should give to get a particular
> decrease or increase in font size?
>
> There is this page:
> http://lilypond.org/doc/v2.18/Documentation/internals/lyrictext
>
> From the above page:
> The font size, compared to the ‘normal’ size. 0 is style-sheet’s normal
> size, -1 is smaller, +1 is bigger. Each step of 1 is approximately 12%
> larger; 6 steps are exactly a factor 2 larger. Fractional values are
> allowed.

I don't know what is the reason for this (apparent?) contradiction
between the default value of 1.0 above this paragraph and the 'normal'
size 0.

But lyrics seem to have a default font-size of 1.0.

> But that is not what I'm getting.
> I tried this:
> \layout { Lyrics.LyricText.font-size = #-1 }
> That reduced the lyrics font size to less than half of the default size, by
> the looks of it.

It is really only by the looks of it! 1 - 6 = -5 is half the size and it
looks tiny. But if you measure it, you will see that it is indeed half
the size.

> Next I tried this:
> \layout { Lyrics.LyricText.font-size = #-0.2 }
> I estimate that gave me about 3/4 of the default font size.

Or rather 87% (my optical impression is more like your estimate).

> So I can sort of dial it in by trial and error, but of course it would be
> great to know the exact formula.

The factor with respect to the default font size is (1 is the default
font-size here, other objects have other default sizes, defined in
scm/define-grobs.scm):

factor = 2^((font-size-1)/6)


Cheers,
Joram

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Lyrics.LyricText.font-size in layout block

Noeck
In reply to this post by tisimst
Hi,

Am 19.07.2016 um 22:54 schrieb tisimst:
> real-lyric-font-size = x*(1+y/6)*(12/20)

I doubt this formula as y = -6 should give half of the normal size and
not a negative number. I still think this is correct:

factor = 2^((font-size-1)/6)

Cheers,
Joram

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Lyrics.LyricText.font-size in layout block

tisimst


On Tuesday, July 19, 2016, Noeck [via Lilypond] <[hidden email]> wrote:
Hi,

Am 19.07.2016 um 22:54 schrieb tisimst:
> real-lyric-font-size = x*(1+y/6)*(12/20)

I doubt this formula as y = -6 should give half of the normal size and
not a negative number. I still think this is correct:

factor = 2^((font-size-1)/6

Ah, yes. Thank you for correcting me. Not sure what I was thinking. Shouldn't it be without the -1 though?

factor = 2^(font-size/6)

--
Abraham 
Reply | Threaded
Open this post in threaded view
|

Re: Lyrics.LyricText.font-size in layout block

Noeck
Hi Abraham,

Am 20.07.2016 um 01:05 schrieb tisimst:
> Shouldn't it be without the -1 though?

In general, yes. The default is 1.0, so I wrote it for this case of
lycris. If you enter font-size=1.0 in this formula, you get a factor of
1.0 (with respect to the default lyrics font size). With the general
formula factor = 2^(font-size/6) you get a factor of 2^(1/6) with
respect to the normal font-size 0 (12% larger). So it depends what you
mean by the factor.

Best,
Joram

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: Lyrics.LyricText.font-size in layout block

tisimst
On Wed, Jul 20, 2016 at 12:34 AM, Noeck [via Lilypond] <[hidden email]> wrote:
Hi Abraham,

Am 20.07.2016 um 01:05 schrieb tisimst:
> Shouldn't it be without the -1 though?

In general, yes. The default is 1.0, so I wrote it for this case of
lycris. If you enter font-size=1.0 in this formula, you get a factor of
1.0 (with respect to the default lyrics font size). With the general
formula factor = 2^(font-size/6) you get a factor of 2^(1/6) with
respect to the normal font-size 0 (12% larger). So it depends what you
mean by the factor.

I thought of that after I sent my message, but thanks for clarifying your formula.

--
Abraham Lee
Reply | Threaded
Open this post in threaded view
|

Re: Lyrics.LyricText.font-size in layout block

Colin Tennyson
In reply to this post by tisimst
Hello tisimst, hello Noeck,

thank you for your replies.

You have explained to me why a very small number, -0.2, has such a noticable effect.
I infer that Lilypond _replaces_ the step value for the LyricText font-size with the entered step number (rather than performing an addition.)

So when I entered -0.2 the actual change was from 1.0 to -0.2, which is of course a noticable change.


For completeness (and because David Kastrup insisted a minimal example should always be provided) I created a minimal example
I took a measure of Choir from the snippet repository, and I added a paper block with one line in it, and a layout block with one line in it

Steps to repeat:
Try it with various values for the override: -1, 0, 1


+++++++++++++++++++++++++++++++++++++++++++++++++++

\version "2.18.2"
\language "english"

global = {
  \key c \major
  \time 4/4
  \dynamicUp
}
sopranonotes = \relative c'' {
  c2 d c d
}
sopranowords = \lyricmode { do do do do }
altonotes = \relative c'' {
  c2 d c d
}
altowords = \lyricmode { re re re re }
tenornotes = {
  \clef "G_8"
  c2 d c d
}
tenorwords = \lyricmode { mi mi mi mi }
bassnotes = {
  \clef bass
  c2 d c d
}
basswords = \lyricmode { mi mi mi mi }


\paper {
  #(layout-set-staff-size 22)
}


\score {
  \new ChoirStaff <<
    \new Staff <<
      \new Voice = "soprano" <<
        \global
        \sopranonotes
      >>
      \new Lyrics \lyricsto "soprano" \sopranowords
    >>
    \new Staff <<
      \new Voice = "alto" <<
        \global
        \altonotes
      >>
      \new Lyrics \lyricsto "alto" \altowords
    >>
    \new Staff <<
      \new Voice = "tenor" <<
        \global
        \tenornotes
      >>
      \new Lyrics \lyricsto "tenor" \tenorwords
    >>
    \new Staff <<
      \new Voice = "bass" <<
        \global
        \bassnotes
      >>
      \new Lyrics \lyricsto "bass" \basswords
    >>
  >>
  \layout { \override Lyrics.LyricText.font-size = #-1 }
}