Layout units

Beside millimeters (abbreviated by "mm" or "Mm" in the source code), Zong! uses the following units in the layout engine:

Interline Space (IS) and Line Position (LP)

  • Interline Space (IS, is, Is): 1 IS the the distance between two staff lines, or more exactly, the distance between the vertical centers of two adjacent staff lines. This unit allows to measure distances within a staff, independent of the actual staff size. IS is both used to measure vertical and horizontal distances.
  • Line Position (LP, lp, Lp): Independent of the number of lines of a staff, LP 0 is always on the bottommost line. LP 1 is a half IS above (in the center between the two bottommost staff lines), LP 2 is on the second staff line from below, and so on. For positions below the bottommost line, negative values are used. For example, LP -2 is the first position where a note would need a leger line.

In the source code, the units are often used at the end of variable names. For example, xMm is a horizontal position in mm, offsetIs is some offset in interline spaces and noteLp is the line position of a note.

Staff Position (SP)

A Staff Position (SP, sp, Sp) denotes a position relative to specific staff. It contains the horizontal coordinate in mm relative to the left side of the staff and the vertical coordinate in LP.

The horizontal coordinate specified in mm instead of LP has the advantage of being independent of the staff size. For example, a stem spanning over two staves has a unique horizontal position, even when the two staves have different sizes.