LilyPond Beginnershandleiding
LilyPond Beginnershandleiding
LilyPond Beginnershandleiding
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Hoofdstuk 4: Tweaking output 99<br />
Zie ook<br />
Extending: Sectie “Scheme tutorial” in Uitbreidingen.<br />
4.3 Appearance of objects<br />
Let us now put what we have learned into practice with a few examples which show how tweaks<br />
may be used to change the appearance of the printed music.<br />
4.3.1 Visibility and color of objects<br />
In the educational use of music we might wish to print a score with certain elements omitted as<br />
an exercise for the student, who is required to supply them. As a simple example, let us suppose<br />
the exercise is to supply the missing bar lines in a piece of music. But the bar lines are normally<br />
inserted automatically. How do we prevent them printing?<br />
Before we tackle this, let us remember that object properties are grouped in what are called<br />
interfaces – see Sectie 4.2.2 [Properties found in interfaces], pagina 97. This is simply to group<br />
together those properties that may be used together to tweak a graphical object – if one of<br />
them is allowed for an object, so are the others. Some objects then use the properties in some<br />
interfaces, others use them from other interfaces. The interfaces which contain the properties<br />
used by a particular grob are listed in the IR at the bottom of the page describing that grob,<br />
and those properties may be viewed by looking at those interfaces.<br />
We explained how to find information about grobs in Sectie 4.2.1 [Properties of layout objects],<br />
pagina 93. Using the same approach, we go to the IR to find the layout object which<br />
prints bar lines. Going via Backend and All layout objects we find there is a layout object called<br />
BarLine. Its properties include two that control its visibility: break-visibility and stencil.<br />
Barline also supports a number of interfaces, including the grob-interface, where we find the<br />
transparent and the color properties. All of these can affect the visibility of bar lines (and, of<br />
course, by extension, many other layout objects too.) Let’s consider each of these in turn.<br />
The stencil property<br />
This property controls the appearance of the bar lines by specifying the symbol (glyph) which<br />
should be printed. In common with many other properties, it can be set to print nothing by<br />
setting its value to #f. Let’s try it, as before, omitting the implied Context, Voice:<br />
{<br />
\time 12/16<br />
\override BarLine.stencil = ##f<br />
c4 b8 c d16 c d8 |<br />
g,8 a16 b8 c d4 e16 |<br />
e8<br />
}<br />
12 <br />
16 <br />
<br />
<br />
<br />
<br />
The bar lines are still printed. What is wrong? Go back to the IR and look again at the page<br />
giving the properties of BarLine. At the top of the page it says “Barline objects are created<br />
by: Bar engraver”. Go to the Bar_engraver page. At the bottom it gives a list of Contexts in<br />
which the bar engraver operates. All of them are of the type Staff, so the reason the \override<br />
command failed to work as expected is because Barline is not in the default Voice context.<br />
If the context is specified incorrectly, the command simply does not work. No error message<br />
is produced, and nothing is logged in the log file. Let’s try correcting it by adding the correct<br />
context: