Format a multi-staff score in bar-over-bar layout.
The parsed MusicSheet
Layout configuration
Whether to generate debug entries
Whether facsimile mode is active
Function to compute slur lengths per staff
BrailleOutput with formatted bar-over-bar text
OptionalperPartKeys: Map<number, KeyInstruction>When provided, parts have different key signatures. The heading will show only time (no key), and each staff's state is pre-initialized with its own key to suppress per-measure rendering. Map: global staff index → KeyInstruction. (Par. 33.4.1)
Convert a measure number to bare braille digits (NO number sign). Par. 29.3(b): measure numbers at the margin use no numeric indicator, in upper-cell digits (Example 29.3-1: measure 15 → ⠁⠑).
The measure number (0 for anacrusis, 1+ for regular measures)
Braille digit string without number sign prefix
Generate padding to fill a gap for vertical alignment.
If the gap is large enough (≥ guideDotThreshold), fills with guide dots (dot 3, minimum guideDotMinCount). Guide dots are separated from music by one blank cell on each side (Par. 28.1.3).
If the gap is too small for guide dots, fills with plain spaces.
Number of cells to fill
Layout configuration with guide dot thresholds
Padding string of exactly gap cells
Render an instrument list table (Par. 33.2). Two-column table: full instrument names + abbreviations. Abbreviations start 2 cells beyond the longest name. Guide dots (dot 5) fill gaps of 3+ cells between name and abbreviation column.
Array of { name, abbreviation } in braille literary characters
Lines of the table, one per instrument
Render the music heading: key + time signature centered on the line. Par. 1.7: heading appears above the first parallel.
Split a formatted staff line into run-over lines when it exceeds lineWidth (Par. 28.1.2).
Splits occur only at blank-cell separators (between measures) — never mid-measure, since breaking within a measure would corrupt braille semantics (octave marks, interval signs, etc. are tightly coupled to adjacent notes).
Run-over (continuation) lines are indented 2 cells beyond the alignment point (where music starts on the primary line, i.e., right after the prefix).
The full formatted line (prefix + music content)
The cell length of the prefix (music alignment point)
Maximum cells allowed per line
Array of lines. If input fits, returns [line]. Otherwise, primary line plus one or more continuation lines with run-over indent.
Bar-over-bar layout engine for keyboard/piano braille music.
Implements BANA Music Braille Code 2015, Chapter 28 + Par. 29.3. Produces vertically aligned parallels where RH and LH measures appear on adjacent lines with aligned measure starts.
This class handles layout only — note rendering is delegated to BrailleMeasureRenderer.