lilypond-learning: Properties found in interfaces
4.2.2 Properties found in interfaces
------------------------------------
Suppose now that we wish to print the lyrics in italics. What form of
‘\override’ command do we need to do this? We first look in the IR page
listing ‘All layout objects’, as before, and look for an object that
might control lyrics. We find ‘LyricText’, which looks right. Clicking
on this shows the settable properties for lyric text. These include the
‘font-series’ and ‘font-size’, but nothing that might give an italic
shape. This is because the shape property is one that is common to all
font objects, so, rather than including it in every layout object, it is
grouped together with other similar common properties and placed in an
*Interface*, the ‘font-interface’.
So now we need to learn how to find the properties of interfaces, and
to discover what objects use these interface properties.
Look again at the IR page which describes LyricText. At the bottom
of the page is a list of clickable interfaces which LyricText supports.
The list has several items, including ‘font-interface’. Clicking on
this brings up the properties associated with this interface, which are
also properties of all the objects which support it, including
LyricText.
Now we see all the user-settable properties which control fonts,
including ‘font-shape(symbol)’, where ‘symbol’ can be set to ‘upright’,
‘italics’ or ‘caps’.
You will notice that ‘font-series’ and ‘font-size’ are also listed
there. This immediately raises the question: Why are the common font
properties ‘font-series’ and ‘font-size’ listed under ‘LyricText’ as
well as under the interface ‘font-interface’ but ‘font-shape’ is not?
The answer is that ‘font-series’ and ‘font-size’ are changed from their
global default values when a ‘LyricText’ object is created, but
‘font-shape’ is not. The entries in ‘LyricText’ then tell you the
values for those two properties which apply to ‘LyricText’. Other
objects which support ‘font-interface’ will set these properties
differently when they are created.
Let’s see if we can now construct the ‘\override’ command to change
the lyrics to italics. The object is ‘LyricText’, the property is
‘font-shape’ and the value is ‘italic’. As before, we’ll omit the
context.
As an aside, although it is an important one, note that some
properties take values that are symbols, like ‘italic’, and must be
preceded by an apostrophe, ‘'’. Symbols are then read internally by
LilyPond. Note the distinction from arbitrary text strings, which would
appear as ‘"a text string"’; for more details about symbols and strings,
see (lilypond-extending)Scheme tutorial.
So we see that the ‘\override’ command needed to print the lyrics in
italics is:
\override LyricText.font-shape = #'italic
This should be placed just in front of the lyrics we wish to affect,
like so:
{
\key es \major
\time 6/8
{
r4 bes8 bes[( g]) g |
g8[( es]) es d[( f]) as |
as8 g
}
\addlyrics {
\override LyricText.font-shape = #'italic
The man who | feels love's sweet e -- | mo -- tion
}
}
[image src="" alt="[image of music]" text="image of music" ]
and the lyrics are all printed in italics.
Note: In lyrics always leave whitespace between the final
syllable and the terminating brace.
See also
........
Extending: (lilypond-extending)Scheme tutorial.