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.

[image of music]

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.


Footnotes

(1)

This artificial name was derived from the English word ‘breadth’, which means approximately the same as ‘width’.


Extending LilyPond v2.25.23 (development-branch).