Skip to content

Fix #203 — %%scale and %%pagescale, as abcm2ps implements them - #210

Merged
sbeitzel merged 1 commit into
developfrom
feature/fix_203
Oct 3, 2026
Merged

sbeitzel merged 1 commit into
developfrom
feature/fix_203

Conversation

@sbeitzel

@sbeitzel sbeitzel commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Fix #203

Summary

  • %%scale S and %%pagescale F (≡ %%scale 0.75 × F) are implemented with abcm2ps's behaviour and generation scope: file → following tunes, tune → that tune, last value wins. A body directive scales the whole tune and gets an info note (scaleAppliesToWholeTune).
  • Baseline matches abcm2ps: with no directive a document renders at %%scale 0.75 (staff space 4.5 pt instead of 6).
  • Everything the tune draws scales — music, chord/annotation/lyric text, title block, W: words. The page, margins and %%footer do not.
  • Default font sizes are now abcm2ps's (title 20, subtitle 16, composer 14, info 14, tempo 15, gchord 12, annotation 12, vocal 13, words 16), in its nominal units, scaled with the page. Faces stay Libertinus Serif.
  • SVGRenderConfig.scale (default 0.75) is the host default, like abcm2ps's -s; scaledStaffSize is the staff space as drawn.
  • %%ceolkit:scale F ≡ %%pagescale F, with a deprecatedDirective warning (decision B).
  • ckprobe --scale / --sweep set %%scale.
  • Docs: EXTENSIONS.md, CONFORMANCE.md (§11.4.3, font table), README.md, CLAUDE.md.

Checked against abcm2ps 8.14

  • §14.4 Canzonetta at its own %%scale 0.7 now prints on one page with a 22.4 pt title, as abcm2ps does (new tests).
  • tunebook.abc paginates to 15 pages, the same count as abcm2ps (was 16). The Parting Glass now fits under The Radar Racketeer on page 3; abcm2ps starts it on page 4.
  • Snapshots (Canzonetta, Zocharti Loch, simple jig ×2) re-recorded after a side-by-side visual comparison.

Test changes

Geometry tests that used SVGRenderConfig().staffSize as the drawn staff space now use scaledStaffSize; a few tolerances moved from 1e-6/1e-9 to 1e-3 for rounded SVG coordinates; three tests got more music so they still overflow a line or page. Tests that used %%ceolkit:scale as a tool now use %%pagescale.

Upgrading

  • Output is now 75% of its previous size by default, matching abcm2ps's %%scale 0.75. More fits on a line and a page, so line and page breaks move. For the old size, add %%scale 1 (≡ %%pagescale 1.333) or set SVGRenderConfig.scale = 1.
  • Default text sizes are now abcm2ps's, and every text except the footer scales with the page.
  • %%ceolkit:scale F is deprecated and now means %%pagescale F: it scales the title block and words too, and the same value prints at 75% of its former size.

Test plan

  • swift build
  • swift test — all suites pass
  • Canzonetta compared visually with abcm2ps output

🤖 Generated with Claude Code

%%scale S and %%pagescale F (= %%scale 0.75 × F) are parsed in the file
header, tune header and tune body, with abcm2ps's generation scope: a file
value governs the tunes after it, a tune's own governs that tune, and the
last one written wins. A body directive scales the whole tune and says so
with a scaleAppliesToWholeTune note.

With no directive a document renders at abcm2ps's default %%scale 0.75
(4.5 pt staff space). The scale applies to the music and to every piece of
text the tune sets — title block and W: words included — but not to the
page, its margins or the footer. Default font sizes are now abcm2ps's, in
its nominal units, scaled with everything else. SVGRenderConfig.scale is
the host default (abcm2ps's -s); scaledStaffSize is the drawn staff space.

%%ceolkit:scale F now means %%pagescale F and emits a deprecatedDirective
warning. ckprobe --scale/--sweep set %%scale.

Canzonetta (§14.4, %%scale 0.7) now prints on one page with a 22.4 pt
title, as abcm2ps does; the tunebook fixture paginates to 15 pages, the
same as abcm2ps 8.14. Snapshots re-recorded after a visual comparison.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@sbeitzel
sbeitzel merged commit 209f013 into develop Oct 3, 2026
2 checks passed
@sbeitzel
sbeitzel deleted the feature/fix_203 branch October 4, 2026 04:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant