[ << Scheme tutorial ] | [Top][Contents][Index] | [ Interfaces for programmers >> ] |
[ < Alist chains ] | [ Up : Scheme in LilyPond ] | [ Internal music representation > ] |
1.2.8 LilyPond’s box model
The ‘classical’ box model for text (as used, for example, in TeX), comprises the three dimensions width, height, and depth: glyphs are positioned on a horizontal text base line; the height of a glyph is the vertical size above this line, the depth the size below this line, and the width holds the horizontal size of the glyph. LilyPond adds a fourth dimension, breapth,1 to extend the horizontal size by a part left of the glyph’s ‘reference point’, denoted with ‘(0, 0)’ in the image below. The main reason for this extension is that many glyphs like fermatas are symmetrical horizontally (and also symmetrically attached to a note head), and the best reference point for such glyphs is consequently the horizontal center. Other glyphs like the quarter-tone accidental shown on the left in the image also have considerable breapth.
As demonstrated by the custos glyph on the right side of the image, the box defined for a glyph often differs considerably of what gets actually printed: LilyPond positions the right side of the custos glyph box at the end of a staff, making the long extension line stick out to the right into the margin.
This box model is not only used for LilyPond’s musical glyphs but
also for markup of any kind. Both the horizontal and vertical
dimensions are specified as an extent; using Scheme notation, the
left glyph in the image above has a horizontal extent of
#'(-9 . 26)
and a vertical extent of #'(-10 . 29)
.
LilyPond also uses some extensions to the box model to cover special cases.
- If a box should not take part in LilyPond’s music spacing
algorithm along a certain axis, set the extents of this axis to
the otherwise nonsensical value
#'(+inf.0 . -inf.0)
, also available as the symbolempty-interval
. - In markup, spacing (which normally causes horizontal or
vertical movement of the next object in the markup) is also set up
as a box internally: the extent along the orthogonal axis is set
to
empty-interval
as a marker, and a spacing value s is represented as the extent#'(0 . s)
. Contrary to ‘normal’ boxes, spacing can be also negative: for example, the horizontal extent of the markup command\hspace #-4
is#'(0 . -4)
.
Footnotes
(1)
This artificial name was derived from the English word ‘breadth’, which means approximately the same as ‘width’.
[ << Scheme tutorial ] | [Top][Contents][Index] | [ Interfaces for programmers >> ] |
[ < Alist chains ] | [ Up : Scheme in LilyPond ] | [ Internal music representation > ] |