Fix malformed page.kern on 54 pages with page-boundary voice splits

#10
by tobiashornbogen - opened

Problem

54 of 685 entries in metadata.jsonl have page.kern values that are
structurally invalid under the humdrum spec. Verovio 5.7.0 crashes on
them with std::length_error.

The page slicer does not correctly handle pages where a voice split
(*^) is active at the page boundary. The result is a header declaring
N **kern spines, then an immediate *^ line with more than N tokens,
followed by clef/key/meter lines that drop back to N tokens without any
*v merge.

Example from test/mozart/sonata15_1/sonata15_1_2.png:

**kern   **kern   **kern       (3 spines declared)
*        *^       *^      *    (4 tokens, invalid expansion)
*clefF4  *clefG2  *clefG2      (3 tokens, invalid drop)

Fix

Each affected entry already contains the correct structure in
regions[0].kern. This PR replaces the pre-data section of page.kern
(header through last interpretation before the first =) with
regions[0].kern's pre-data section. The data section is preserved
byte-for-byte.

This complements PRs #7 and #8, which fixed the same class of bug in
regions[].kern but did not touch page.kern.

Pattern Recognition and Artificial Intelligence Group org

Merged manually into main after resolving LFS pointer conflict in metadata.jsonl. Took the PR version (fixed page.kern for 54 pages).

JuanCarlosMartinezSevilla changed pull request status to closed

Sign up or log in to comment