diff --git a/.github/scripts/package_release.sh b/.github/scripts/package_release.sh index 6bed987..e6458ee 100755 --- a/.github/scripts/package_release.sh +++ b/.github/scripts/package_release.sh @@ -136,17 +136,54 @@ case "$fam" in "fonts/heddle/variable/MachineMadeHeddle[wdth,wght].ttf" "$out/" ;; warp) + export SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-1793059200}" name="machine-made-warp-${version}" need fonts/warp/ttf/MachineMadeWarp-Regular.ttf fonts/warp/ttf/MachineMadeWarp-Italic.ttf \ fonts/warp/ttf/MachineMadeWarp-Bold.ttf fonts/warp/ttf/MachineMadeWarp-BoldItalic.ttf \ fonts/warp/ttf/MachineMadeWarpDisplay-Regular.ttf fonts/warp/ttf/MachineMadeWarpDisplay-Italic.ttf \ fonts/warp/otf/MachineMadeWarp-Regular.otf fonts/warp/webfonts/MachineMadeWarp-Regular.woff2 \ + 'fonts/warp/vf/MachineMadeWarp[wght].ttf' \ + 'fonts/warp/vf/MachineMadeWarp-Italic[wght].ttf' \ + 'fonts/warp/vf/MachineMadeWarp[wght].woff2' \ + 'fonts/warp/vf/MachineMadeWarp-Italic[wght].woff2' \ + proofs/warp/ladder.json proofs/warp/release.json \ warp/OFL.txt "warp/RELEASE-NOTES-${notes_version}.md" "$out/readability.json" + for style in MachineMadeWarp-Regular MachineMadeWarp-Italic MachineMadeWarp-Bold \ + MachineMadeWarp-BoldItalic MachineMadeWarpDisplay-Regular MachineMadeWarpDisplay-Italic; do + need "fonts/warp/ttf/$style.ttf" "fonts/warp/otf/$style.otf" "fonts/warp/webfonts/$style.woff2" + done + # Final font hashes are separate from the historical inspector measurements. + python3 - <<'CHECK_WARP' +import hashlib +import json +from pathlib import Path + +proof = json.loads(Path("proofs/warp/ladder.json").read_text()) +release = json.loads(Path("proofs/warp/release.json").read_text()) +for slope, suffix in (("Roman", ""), ("Italic", "-Italic")): + name = f"MachineMadeWarp{suffix}[wght].ttf" + path = Path("fonts/warp/vf") / name + expected = release["variable_fonts"][name] + measured = release["styles"][slope] + pinned = proof["styles"][slope] + if (path.stat().st_size != expected["size_bytes"] + or path.stat().st_size != pinned["file_size_bytes"] + or hashlib.sha256(path.read_bytes()).hexdigest() != expected["sha256"] + or measured["source_outline_hashes_sha256"] != pinned["source_outline_hashes_sha256"] + or not measured["numerical_passed"]): + raise SystemExit(f"error: {path} differs from the pinned ladder/release hashes or sizes.") + web = path.with_suffix(".woff2") + web_pin = release["web_fonts"][web.name] + if (web.stat().st_size != web_pin["size_bytes"] + or hashlib.sha256(web.read_bytes()).hexdigest() != web_pin["sha256"]): + raise SystemExit(f"error: {web} differs from the pinned variable web font.") +CHECK_WARP mkdir -p "$stage/$name" - cp -r fonts/warp/ttf fonts/warp/otf fonts/warp/webfonts "$stage/$name/" + cp -r fonts/warp/ttf fonts/warp/otf fonts/warp/webfonts fonts/warp/vf "$stage/$name/" cp warp/OFL.txt "$stage/$name/OFL.txt" cp "warp/RELEASE-NOTES-${notes_version}.md" "$stage/$name/RELEASE-NOTES.md" cp "$out/readability.json" "$stage/$name/readability.json" + cp proofs/warp/release.json "$stage/$name/release.json" { echo "# machine-made Warp ${version}" echo @@ -155,7 +192,9 @@ case "$fam" in echo "machine-made Warp Display: Regular, Italic (titles, opsz 60)." echo echo "- ttf/, otf/: the six static fonts" - echo "- webfonts/: WOFF2 of the six fonts" + echo "- webfonts/: WOFF2 of the six static fonts" + echo "- vf/: Roman and Italic variable TTF and WOFF2, weights 300 to 700" + echo "- SHA256SUMS: SHA-256 of every font in this folder" echo "- readability.json: the OCR readability report of this release" echo "- RELEASE-NOTES.md: what is in this release" echo @@ -163,8 +202,10 @@ case "$fam" in echo "Source: https://github.com/machine-made/type" echo "Specimen: https://machine-made.github.io/type/warp/" } > "$stage/$name/README.md" + (cd "$stage/$name" && find ttf otf webfonts vf -type f -print0 \ + | LC_ALL=C sort -z | xargs -0 sha256sum > SHA256SUMS) make_zip "$stage" "$out/$name.zip" - cp fonts/warp/webfonts/*.woff2 fonts/warp/ttf/*.ttf "$out/" + cp fonts/warp/webfonts/*.woff2 fonts/warp/ttf/*.ttf fonts/warp/vf/*.ttf fonts/warp/vf/*.woff2 "$out/" ;; site) name="machine-made-type-site-${version}" @@ -179,6 +220,6 @@ case "$fam" in ;; esac -(cd "$out" && sha256sum -- * | LC_ALL=C sort -k2 > "$stage/SHA256SUMS" && mv "$stage/SHA256SUMS" SHA256SUMS) +(cd "$out" && find . -maxdepth 1 -type f ! -name SHA256SUMS -print0 | LC_ALL=C sort -z | xargs -0 sha256sum | LC_ALL=C sort -k2 > "$stage/SHA256SUMS" && mv "$stage/SHA256SUMS" SHA256SUMS) echo "Release files in $out:" ls -l "$out" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1b6334a..92fdf9b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -437,7 +437,7 @@ jobs: warp: if: startsWith(inputs.tag || github.ref_name, 'warp-v') runs-on: ubuntu-24.04 - timeout-minutes: 40 + timeout-minutes: 240 permissions: contents: write id-token: write @@ -470,13 +470,16 @@ jobs: python -m pip install -e ".[test]" node --version + - name: Build static and variable fonts with numerical gates + working-directory: warp + run: scripts/build.sh + - name: Run tests working-directory: warp run: python -m pytest -q - - name: Build fonts - working-directory: warp - run: scripts/build.sh + - name: Check variable font hashes against the release proof + run: cmp proofs/warp/release.json build/warp-vf/release.json - name: Check that the build is the same as the committed fonts run: | @@ -501,7 +504,7 @@ jobs: sudo install -m 755 "$RUNNER_TEMP/${name}/fontspector" /usr/local/bin/fontspector fontspector --version - - name: Check fonts (Fontspector, universal profile) + - name: Check static and variable fonts (Fontspector, universal profile) working-directory: warp run: scripts/check.sh fontspector @@ -531,12 +534,12 @@ jobs: exit 1 fi # A tag that exists already is fine when its commit has the same release files - # (fonts/warp warp) as this commit: that is a re-run after a failed upload, and the + # (fonts/warp warp proofs/warp) as this commit: that is a re-run after a failed upload, and the # release goes onto that tag. Any other change needs a new version. existing="$(git ls-remote --tags origin "refs/tags/${RELEASE_TAG}^{}" "refs/tags/${RELEASE_TAG}" | awk '{print $1}' | tail -n 1)" if [ -n "$existing" ]; then git fetch --quiet --depth=1 origin "$existing" - if git diff --quiet "$existing" "$GITHUB_SHA" -- fonts/warp warp; then + if git diff --quiet "$existing" "$GITHUB_SHA" -- fonts/warp warp proofs/warp; then echo "Tag ${RELEASE_TAG} exists already on ${existing} with the same release files. Re-running the release." exit 0 fi @@ -547,8 +550,7 @@ jobs: git push origin "refs/tags/${RELEASE_TAG}" - name: Create the release - # gh reads each file argument as a glob. The Warp file names have no - # brackets; any bracket in a future name must be escaped (\[ \]). + # gh reads file arguments as globs; escape the variable-font brackets. env: GH_TOKEN: ${{ github.token }} run: | @@ -568,6 +570,10 @@ jobs: "$OUT/MachineMadeWarp-BoldItalic.ttf" \ "$OUT/MachineMadeWarpDisplay-Regular.ttf" \ "$OUT/MachineMadeWarpDisplay-Italic.ttf" \ + "$OUT/MachineMadeWarp\[wght\].ttf" \ + "$OUT/MachineMadeWarp-Italic\[wght\].ttf" \ + "$OUT/MachineMadeWarp\[wght\].woff2" \ + "$OUT/MachineMadeWarp-Italic\[wght\].woff2" \ "$OUT/readability.json" \ "$OUT/SHA256SUMS" diff --git a/.github/workflows/warp.yml b/.github/workflows/warp.yml index 40e9dc2..0d1c737 100644 --- a/.github/workflows/warp.yml +++ b/.github/workflows/warp.yml @@ -20,7 +20,7 @@ jobs: build: runs-on: ubuntu-24.04 # On 19 Nov the tests, two font builds and the fidelity sweep took 40 minutes and were cancelled at the limit. - timeout-minutes: 75 + timeout-minutes: 240 defaults: run: working-directory: warp diff --git a/fonts/warp/otf/MachineMadeWarp-Bold.otf b/fonts/warp/otf/MachineMadeWarp-Bold.otf index 98abbb6..57d75ee 100644 Binary files a/fonts/warp/otf/MachineMadeWarp-Bold.otf and b/fonts/warp/otf/MachineMadeWarp-Bold.otf differ diff --git a/fonts/warp/otf/MachineMadeWarp-BoldItalic.otf b/fonts/warp/otf/MachineMadeWarp-BoldItalic.otf index bfe9c00..40f7222 100644 Binary files a/fonts/warp/otf/MachineMadeWarp-BoldItalic.otf and b/fonts/warp/otf/MachineMadeWarp-BoldItalic.otf differ diff --git a/fonts/warp/otf/MachineMadeWarp-Italic.otf b/fonts/warp/otf/MachineMadeWarp-Italic.otf index 584f802..e48ff56 100644 Binary files a/fonts/warp/otf/MachineMadeWarp-Italic.otf and b/fonts/warp/otf/MachineMadeWarp-Italic.otf differ diff --git a/fonts/warp/otf/MachineMadeWarp-Regular.otf b/fonts/warp/otf/MachineMadeWarp-Regular.otf index 87f5c27..719e5fe 100644 Binary files a/fonts/warp/otf/MachineMadeWarp-Regular.otf and b/fonts/warp/otf/MachineMadeWarp-Regular.otf differ diff --git a/fonts/warp/otf/MachineMadeWarpDisplay-Italic.otf b/fonts/warp/otf/MachineMadeWarpDisplay-Italic.otf index 9719ff8..d4fe371 100644 Binary files a/fonts/warp/otf/MachineMadeWarpDisplay-Italic.otf and b/fonts/warp/otf/MachineMadeWarpDisplay-Italic.otf differ diff --git a/fonts/warp/otf/MachineMadeWarpDisplay-Regular.otf b/fonts/warp/otf/MachineMadeWarpDisplay-Regular.otf index 01a9268..ec4f617 100644 Binary files a/fonts/warp/otf/MachineMadeWarpDisplay-Regular.otf and b/fonts/warp/otf/MachineMadeWarpDisplay-Regular.otf differ diff --git a/fonts/warp/ttf/MachineMadeWarp-Bold.ttf b/fonts/warp/ttf/MachineMadeWarp-Bold.ttf index 6771547..a4da07b 100644 Binary files a/fonts/warp/ttf/MachineMadeWarp-Bold.ttf and b/fonts/warp/ttf/MachineMadeWarp-Bold.ttf differ diff --git a/fonts/warp/ttf/MachineMadeWarp-BoldItalic.ttf b/fonts/warp/ttf/MachineMadeWarp-BoldItalic.ttf index 5c427b7..7a7077a 100644 Binary files a/fonts/warp/ttf/MachineMadeWarp-BoldItalic.ttf and b/fonts/warp/ttf/MachineMadeWarp-BoldItalic.ttf differ diff --git a/fonts/warp/ttf/MachineMadeWarp-Italic.ttf b/fonts/warp/ttf/MachineMadeWarp-Italic.ttf index 8bc672e..0b2f58b 100644 Binary files a/fonts/warp/ttf/MachineMadeWarp-Italic.ttf and b/fonts/warp/ttf/MachineMadeWarp-Italic.ttf differ diff --git a/fonts/warp/ttf/MachineMadeWarp-Regular.ttf b/fonts/warp/ttf/MachineMadeWarp-Regular.ttf index 54d3538..86730eb 100644 Binary files a/fonts/warp/ttf/MachineMadeWarp-Regular.ttf and b/fonts/warp/ttf/MachineMadeWarp-Regular.ttf differ diff --git a/fonts/warp/ttf/MachineMadeWarpDisplay-Italic.ttf b/fonts/warp/ttf/MachineMadeWarpDisplay-Italic.ttf index 739c805..36185ff 100644 Binary files a/fonts/warp/ttf/MachineMadeWarpDisplay-Italic.ttf and b/fonts/warp/ttf/MachineMadeWarpDisplay-Italic.ttf differ diff --git a/fonts/warp/ttf/MachineMadeWarpDisplay-Regular.ttf b/fonts/warp/ttf/MachineMadeWarpDisplay-Regular.ttf index af11e4c..4b37445 100644 Binary files a/fonts/warp/ttf/MachineMadeWarpDisplay-Regular.ttf and b/fonts/warp/ttf/MachineMadeWarpDisplay-Regular.ttf differ diff --git a/fonts/warp/vf/MachineMadeWarp-Italic[wght].ttf b/fonts/warp/vf/MachineMadeWarp-Italic[wght].ttf new file mode 100644 index 0000000..d1e2bf7 Binary files /dev/null and b/fonts/warp/vf/MachineMadeWarp-Italic[wght].ttf differ diff --git a/fonts/warp/vf/MachineMadeWarp-Italic[wght].woff2 b/fonts/warp/vf/MachineMadeWarp-Italic[wght].woff2 new file mode 100644 index 0000000..c764cc7 Binary files /dev/null and b/fonts/warp/vf/MachineMadeWarp-Italic[wght].woff2 differ diff --git a/fonts/warp/vf/MachineMadeWarp[wght].ttf b/fonts/warp/vf/MachineMadeWarp[wght].ttf new file mode 100644 index 0000000..98b7209 Binary files /dev/null and b/fonts/warp/vf/MachineMadeWarp[wght].ttf differ diff --git a/fonts/warp/vf/MachineMadeWarp[wght].woff2 b/fonts/warp/vf/MachineMadeWarp[wght].woff2 new file mode 100644 index 0000000..0f1ef6a Binary files /dev/null and b/fonts/warp/vf/MachineMadeWarp[wght].woff2 differ diff --git a/fonts/warp/webfonts/MachineMadeWarp-Bold.woff2 b/fonts/warp/webfonts/MachineMadeWarp-Bold.woff2 index 39198bb..d8da12d 100644 Binary files a/fonts/warp/webfonts/MachineMadeWarp-Bold.woff2 and b/fonts/warp/webfonts/MachineMadeWarp-Bold.woff2 differ diff --git a/fonts/warp/webfonts/MachineMadeWarp-BoldItalic.woff2 b/fonts/warp/webfonts/MachineMadeWarp-BoldItalic.woff2 index adabf3e..7416c71 100644 Binary files a/fonts/warp/webfonts/MachineMadeWarp-BoldItalic.woff2 and b/fonts/warp/webfonts/MachineMadeWarp-BoldItalic.woff2 differ diff --git a/fonts/warp/webfonts/MachineMadeWarp-Italic.woff2 b/fonts/warp/webfonts/MachineMadeWarp-Italic.woff2 index de5ab8f..e22eb6c 100644 Binary files a/fonts/warp/webfonts/MachineMadeWarp-Italic.woff2 and b/fonts/warp/webfonts/MachineMadeWarp-Italic.woff2 differ diff --git a/fonts/warp/webfonts/MachineMadeWarp-Regular.woff2 b/fonts/warp/webfonts/MachineMadeWarp-Regular.woff2 index 892fb42..fa4899f 100644 Binary files a/fonts/warp/webfonts/MachineMadeWarp-Regular.woff2 and b/fonts/warp/webfonts/MachineMadeWarp-Regular.woff2 differ diff --git a/fonts/warp/webfonts/MachineMadeWarpDisplay-Italic.woff2 b/fonts/warp/webfonts/MachineMadeWarpDisplay-Italic.woff2 index ed01989..94ac7cc 100644 Binary files a/fonts/warp/webfonts/MachineMadeWarpDisplay-Italic.woff2 and b/fonts/warp/webfonts/MachineMadeWarpDisplay-Italic.woff2 differ diff --git a/fonts/warp/webfonts/MachineMadeWarpDisplay-Regular.woff2 b/fonts/warp/webfonts/MachineMadeWarpDisplay-Regular.woff2 index 7ba92fc..0f46a59 100644 Binary files a/fonts/warp/webfonts/MachineMadeWarpDisplay-Regular.woff2 and b/fonts/warp/webfonts/MachineMadeWarpDisplay-Regular.woff2 differ diff --git a/proofs/warp/ladder.json b/proofs/warp/ladder.json index 211ddd3..5976c2d 100644 --- a/proofs/warp/ladder.json +++ b/proofs/warp/ladder.json @@ -52,13 +52,13 @@ "u1D6F8": "u1D44B" }, "source_hashes_sha256": { - "Light.ttf": "9953d2e9c25442d6980385c9854fd9fb1f510795501a71a002f5a0823fd0cffa", - "Weight350.ttf": "fcd46542189b9b44e1a276107ecdd7d74054954fd0e0879d9be0e646dd901a19", - "Regular.ttf": "e51ec634b46da0f2c1504628d7d8b59548d9ce32c2b6a71874bbbd507520d7ae", - "Weight450.ttf": "894b54fce6787765e58f757f5e739d43ff4144be4ad2e63140a359ada5c077eb", - "Medium.ttf": "b3846f6e7278a2159939cc2ddd6f21ac9d0f25a2b89539e56b088dd4a198c5af", - "SemiBold.ttf": "d87866691c0d0382a98877f4e51844a7436a5ca50296494bbaa30acfdee061c2", - "Bold.ttf": "86f5064628852ed56b971e3965dedfd3c82b14ad367bb08d2efc4cdf0977e60f" + "Light.ttf": "f566fe279540ea6a5e2443d9c943e59ad09f706791e48b980ec2723d5afdfd92", + "Weight350.ttf": "a9cfed3b1c9164c2f4f248a993cd853c8892eaa0f58df1225b056fd53a26fc46", + "Regular.ttf": "919a26f669a14f2a2da56ffa9c1f23310716bc3289f30caae72b56238df4bc15", + "Weight450.ttf": "719eb3325b88c67368d8d033b03c07f6a4d868dda77fa12b59e52f46e7bcc05a", + "Medium.ttf": "b81b305dab6ed083961581ca93789d9d5620d86628eb17af3607f20e1855154f", + "SemiBold.ttf": "128e1a5d639afe44e083220ebc084c02573c8a2e355e0485957987c1b10800c1", + "Bold.ttf": "c925d49833a839671062b92acb6349f61717511afe20a0c92bb9a9aa1b757cb0" }, "source_outline_hashes_sha256": { "Light.ttf": "be4d11823c3728984327c4ee5c97141c6b85532a7bc08e54c634ff7f64598be7", @@ -43465,7 +43465,7 @@ "location": { "wght": 449.98779296875 }, - "z_score": 10.481950759887695, + "z_score": 10.481953620910645, "measurement": "advance widths" }, { @@ -43476,7 +43476,7 @@ "location": { "wght": 450.006103515625 }, - "z_score": 10.481950759887695, + "z_score": 10.481953620910645, "measurement": "advance widths" } ], @@ -44329,7 +44329,7 @@ "location": { "wght": 449.98779296875 }, - "z_score": 10.481950759887695, + "z_score": 10.481953620910645, "measurement": "advance widths" }, { @@ -44340,7 +44340,7 @@ "location": { "wght": 450.006103515625 }, - "z_score": 10.481950759887695, + "z_score": 10.481953620910645, "measurement": "advance widths" }, { @@ -44351,7 +44351,7 @@ "location": { "wght": 499.993896484375 }, - "z_score": 10.830705642700195, + "z_score": 10.830710411071777, "measurement": "advance widths" }, { @@ -44362,7 +44362,7 @@ "location": { "wght": 599.98779296875 }, - "z_score": 11.745593070983887, + "z_score": 11.74559497833252, "measurement": "advance widths" }, { @@ -44373,7 +44373,7 @@ "location": { "wght": 600.006103515625 }, - "z_score": 11.745593070983887, + "z_score": 11.74559497833252, "measurement": "advance widths" }, { @@ -44384,7 +44384,7 @@ "location": { "wght": 700.0 }, - "z_score": 12.59475326538086, + "z_score": 12.594747543334961, "measurement": "advance widths" } ], @@ -44436,13 +44436,13 @@ "u1D702": "eta" }, "source_hashes_sha256": { - "LightItalic.ttf": "6cb99b738bd958440a9cea39aca91f8549a187ba93a311e43891b5d81fc9db0c", - "Weight350Italic.ttf": "fecba720ad5a7c3848968bbba2945a1bfe88bce7d2430a61550d71f79d2fe488", - "Italic.ttf": "a76673e09cebaff652c034b74f9845e208bfcdcddc6718d542461f2f546135ee", - "Weight450Italic.ttf": "1bb1bab20599750c6f0c9d15626a013b14a35af3c5dbecc3b9552da366dc9c48", - "MediumItalic.ttf": "0bcf69b5a550df97a39a0aff2d57610f0b9d3550c0704e24527ca474c5f7a8b9", - "SemiBoldItalic.ttf": "7095d26f5a53b9ca9c4d581d1b396c633d363b6c2c56fbb6fdac166d4e2b192c", - "BoldItalic.ttf": "93f29398ad5ad64299e34c0f17c75755b2ee04ed74f11bdc8e72f1ba829e627b" + "LightItalic.ttf": "23d930d463542ac9f5ff2341675d7a11dbebdd61b5f956381ef15621bb96f37b", + "Weight350Italic.ttf": "e369c087ccaa586b8cd4027a0bff01dee4e1f09ed40ff13a3239146f6aae1285", + "Italic.ttf": "33e5de3ab68d79d58a0db7cd9a2124b9f16929e6e6a908ad5386db8e2ec320e0", + "Weight450Italic.ttf": "26b2c13024945901633600e867affa08bd31622f519042563db6ca0402dd52af", + "MediumItalic.ttf": "d59f232e376c748857097df4f2d69a507bd3121a4a94cb54562a2c8bce2de77f", + "SemiBoldItalic.ttf": "9e208360433505bafa47d65dc25ba79c6305c6a3aa9e5280b600354b724d33b3", + "BoldItalic.ttf": "3781b24cc643d3cfda8a19b64af50ba73e42bd7de614c598820bea1b6297b61e" }, "source_outline_hashes_sha256": { "LightItalic.ttf": "b23ec5460689bcea78de78fa24d7926086b6fd8789f3e8edae2ea34fc3bd262e", @@ -85722,7 +85722,7 @@ "location": { "wght": 449.98779296875 }, - "z_score": 11.485076904296875, + "z_score": 11.485074043273926, "measurement": "right sidebearings" }, { @@ -85733,7 +85733,7 @@ "location": { "wght": 450.006103515625 }, - "z_score": 11.485076904296875, + "z_score": 11.485074043273926, "measurement": "right sidebearings" }, { @@ -85744,7 +85744,7 @@ "location": { "wght": 350.0 }, - "z_score": 13.670393943786621, + "z_score": 13.670392036437988, "measurement": "advance widths" }, { @@ -85755,7 +85755,7 @@ "location": { "wght": 449.98779296875 }, - "z_score": 13.67434310913086, + "z_score": 13.674341201782227, "measurement": "advance widths" }, { @@ -85766,7 +85766,7 @@ "location": { "wght": 450.006103515625 }, - "z_score": 13.67434310913086, + "z_score": 13.674341201782227, "measurement": "advance widths" } ], @@ -86667,22 +86667,22 @@ "check_id": "suspicious_sidebearings", "code": "large-rsb-variation", "severity": "WARN", - "glyph": "zcaron", + "glyph": "Lacute", "location": { - "wght": 449.98779296875 + "wght": 599.98779296875 }, - "z_score": 11.485076904296875, + "z_score": 19.066930770874023, "measurement": "right sidebearings" }, { "check_id": "suspicious_sidebearings", "code": "large-rsb-variation", "severity": "WARN", - "glyph": "zcaron", + "glyph": "Lacute", "location": { - "wght": 450.006103515625 + "wght": 600.006103515625 }, - "z_score": 11.485076904296875, + "z_score": 19.066930770874023, "measurement": "right sidebearings" }, { @@ -86691,31 +86691,31 @@ "severity": "WARN", "glyph": "Lacute", "location": { - "wght": 599.98779296875 + "wght": 700.0 }, - "z_score": 19.06690216064453, + "z_score": 16.051189422607422, "measurement": "right sidebearings" }, { "check_id": "suspicious_sidebearings", "code": "large-rsb-variation", "severity": "WARN", - "glyph": "Lacute", + "glyph": "zcaron", "location": { - "wght": 600.006103515625 + "wght": 449.98779296875 }, - "z_score": 19.06690216064453, + "z_score": 11.485074043273926, "measurement": "right sidebearings" }, { "check_id": "suspicious_sidebearings", "code": "large-rsb-variation", "severity": "WARN", - "glyph": "Lacute", + "glyph": "zcaron", "location": { - "wght": 700.0 + "wght": 450.006103515625 }, - "z_score": 16.05118751525879, + "z_score": 11.485074043273926, "measurement": "right sidebearings" }, { @@ -86726,7 +86726,7 @@ "location": { "wght": 300.0 }, - "z_score": 13.38908863067627, + "z_score": 13.38908576965332, "measurement": "advance widths" }, { @@ -86737,7 +86737,7 @@ "location": { "wght": 350.0 }, - "z_score": 13.670393943786621, + "z_score": 13.670392036437988, "measurement": "advance widths" }, { @@ -86748,7 +86748,7 @@ "location": { "wght": 449.98779296875 }, - "z_score": 13.67434310913086, + "z_score": 13.674341201782227, "measurement": "advance widths" }, { @@ -86759,7 +86759,7 @@ "location": { "wght": 450.006103515625 }, - "z_score": 13.67434310913086, + "z_score": 13.674341201782227, "measurement": "advance widths" }, { @@ -86770,7 +86770,7 @@ "location": { "wght": 499.993896484375 }, - "z_score": 13.945965766906738, + "z_score": 13.945974349975586, "measurement": "advance widths" }, { @@ -86803,7 +86803,7 @@ "location": { "wght": 700.0 }, - "z_score": 14.436285972595215, + "z_score": 14.436286926269531, "measurement": "advance widths" } ], diff --git a/proofs/warp/release.json b/proofs/warp/release.json new file mode 100644 index 0000000..24d65df --- /dev/null +++ b/proofs/warp/release.json @@ -0,0 +1,244 @@ +{ + "styles": { + "Roman": { + "source_hashes_sha256": { + "Light.ttf": "f566fe279540ea6a5e2443d9c943e59ad09f706791e48b980ec2723d5afdfd92", + "Weight350.ttf": "a9cfed3b1c9164c2f4f248a993cd853c8892eaa0f58df1225b056fd53a26fc46", + "Regular.ttf": "919a26f669a14f2a2da56ffa9c1f23310716bc3289f30caae72b56238df4bc15", + "Weight450.ttf": "719eb3325b88c67368d8d033b03c07f6a4d868dda77fa12b59e52f46e7bcc05a", + "Medium.ttf": "b81b305dab6ed083961581ca93789d9d5620d86628eb17af3607f20e1855154f", + "SemiBold.ttf": "128e1a5d639afe44e083220ebc084c02573c8a2e355e0485957987c1b10800c1", + "Bold.ttf": "c925d49833a839671062b92acb6349f61717511afe20a0c92bb9a9aa1b757cb0" + }, + "source_outline_hashes_sha256": { + "Light.ttf": "be4d11823c3728984327c4ee5c97141c6b85532a7bc08e54c634ff7f64598be7", + "Weight350.ttf": "d3b458bdb9fdeaa618c997060cbeadcec6e0109817e07db0e1dc686b3a327436", + "Regular.ttf": "9c5f976839860880bdd580341493e2bfe47cdc13dcceeab9d928f78812d4f37a", + "Weight450.ttf": "87e2f072a027c7aabc8c5df4acc3229530a7bdcec41c12a037c3ac9b7ebfa364", + "Medium.ttf": "60e19e52d15a1dd62f0069f2e230216ca729319b1521cff91d2d63fbaed60ac5", + "SemiBold.ttf": "5a55a984a01d7af8355d23bafe1184255df12d753d8ac2042b28d5747be99f24", + "Bold.ttf": "72d4ad96cf45850e066bb5b3d5f741df327a34b94983e33637e5361b7b10403d" + }, + "file_size_bytes": 7448792, + "instances": { + "300": { + "max_units": 0.9970611680325906, + "vertex_bound_units": 0.9770611680325906, + "glyph": "napostrophe", + "curve_flatness_units": 0.01, + "method": "Corresponding vertices bound the full flattened boundaries" + }, + "400": { + "max_units": 0.02, + "vertex_bound_units": 0.0, + "glyph": null, + "curve_flatness_units": 0.01, + "method": "Corresponding vertices bound the full flattened boundaries" + }, + "500": { + "max_units": 0.9970611680325934, + "vertex_bound_units": 0.9770611680325934, + "glyph": "Epsilontonos", + "curve_flatness_units": 0.01, + "method": "Corresponding vertices bound the full flattened boundaries" + }, + "600": { + "max_units": 0.9857743355031501, + "vertex_bound_units": 0.9657743355031501, + "glyph": "ellipsis", + "curve_flatness_units": 0.01, + "method": "Corresponding vertices bound the full flattened boundaries" + }, + "700": { + "max_units": 0.52, + "vertex_bound_units": 0.5, + "glyph": "exclam", + "curve_flatness_units": 0.01, + "method": "Corresponding vertices bound the full flattened boundaries" + } + }, + "fidelity": { + "325": { + "max_percent": 4.994, + "glyph": "radical.ext", + "ppem": 128, + "passed": true + }, + "350": { + "max_percent": 3.26, + "glyph": "v", + "ppem": 128, + "passed": true + }, + "375": { + "max_percent": 3.9829999999999997, + "glyph": "summation", + "ppem": 128, + "passed": true + }, + "425": { + "max_percent": 4.377000000000001, + "glyph": "one.lf", + "ppem": 128, + "passed": true + }, + "450": { + "max_percent": 2.868, + "glyph": "radical.bot", + "ppem": 128, + "passed": true + }, + "475": { + "max_percent": 3.2359999999999998, + "glyph": "N", + "ppem": 128, + "passed": true + }, + "550": { + "max_percent": 3.443, + "glyph": "radical.ext", + "ppem": 128, + "passed": true + }, + "650": { + "max_percent": 3.396, + "glyph": "u1D6F6", + "ppem": 128, + "passed": true + } + }, + "numerical_passed": true + }, + "Italic": { + "source_hashes_sha256": { + "LightItalic.ttf": "23d930d463542ac9f5ff2341675d7a11dbebdd61b5f956381ef15621bb96f37b", + "Weight350Italic.ttf": "e369c087ccaa586b8cd4027a0bff01dee4e1f09ed40ff13a3239146f6aae1285", + "Italic.ttf": "33e5de3ab68d79d58a0db7cd9a2124b9f16929e6e6a908ad5386db8e2ec320e0", + "Weight450Italic.ttf": "26b2c13024945901633600e867affa08bd31622f519042563db6ca0402dd52af", + "MediumItalic.ttf": "d59f232e376c748857097df4f2d69a507bd3121a4a94cb54562a2c8bce2de77f", + "SemiBoldItalic.ttf": "9e208360433505bafa47d65dc25ba79c6305c6a3aa9e5280b600354b724d33b3", + "BoldItalic.ttf": "3781b24cc643d3cfda8a19b64af50ba73e42bd7de614c598820bea1b6297b61e" + }, + "source_outline_hashes_sha256": { + "LightItalic.ttf": "b23ec5460689bcea78de78fa24d7926086b6fd8789f3e8edae2ea34fc3bd262e", + "Weight350Italic.ttf": "23bf1710c83f8938f1d2e6f270df49e39e5ffa53873b6fbb06b82ace314cfc6b", + "Italic.ttf": "419901755e2bec12c5960aca43f9a98011ce9125a95c5e57c1b25bc5890479e4", + "Weight450Italic.ttf": "dd90b0c710bd54e3eb5dcedcb40c0e90e59a9107163d2ecb5158d437655ac82f", + "MediumItalic.ttf": "b1191d0cd8a001087503e2448a0e48de5b621e94a422edbd0e4327f6e3da81e6", + "SemiBoldItalic.ttf": "60a8ee7ba6aff4a09b63c78dc86ecc3812a8c78ed1896ca9ff328c5ea88f66fd", + "BoldItalic.ttf": "e84a742379d72da24b6777cc843ada8bd61fa1aab6c9bf6400f43571d95ba0cd" + }, + "file_size_bytes": 6679608, + "instances": { + "300": { + "max_units": 0.9970611680325802, + "vertex_bound_units": 0.9770611680325801, + "glyph": "integral.size4", + "curve_flatness_units": 0.01, + "method": "Corresponding vertices bound the full flattened boundaries" + }, + "400": { + "max_units": 0.02, + "vertex_bound_units": 0.0, + "glyph": null, + "curve_flatness_units": 0.01, + "method": "Corresponding vertices bound the full flattened boundaries" + }, + "500": { + "max_units": 0.9970611680325934, + "vertex_bound_units": 0.9770611680325934, + "glyph": "onehalf", + "curve_flatness_units": 0.01, + "method": "Corresponding vertices bound the full flattened boundaries" + }, + "600": { + "max_units": 0.9833320221819143, + "vertex_bound_units": 0.9633320221819143, + "glyph": "Tcaron", + "curve_flatness_units": 0.01, + "method": "Corresponding vertices bound the full flattened boundaries" + }, + "700": { + "max_units": 0.52, + "vertex_bound_units": 0.5, + "glyph": "exclam", + "curve_flatness_units": 0.01, + "method": "Corresponding vertices bound the full flattened boundaries" + } + }, + "fidelity": { + "325": { + "max_percent": 4.994, + "glyph": "radical.ext", + "ppem": 128, + "passed": true + }, + "350": { + "max_percent": 3.27, + "glyph": "tildecomb.case", + "ppem": 128, + "passed": true + }, + "375": { + "max_percent": 4.1000000000000005, + "glyph": "macroncomb.case", + "ppem": 128, + "passed": true + }, + "425": { + "max_percent": 4.064, + "glyph": "one.lf", + "ppem": 128, + "passed": true + }, + "450": { + "max_percent": 3.057, + "glyph": "tildecomb.case", + "ppem": 128, + "passed": true + }, + "475": { + "max_percent": 2.9739999999999998, + "glyph": "parenright.size4", + "ppem": 128, + "passed": true + }, + "550": { + "max_percent": 3.443, + "glyph": "radical.ext", + "ppem": 128, + "passed": true + }, + "650": { + "max_percent": 3.396, + "glyph": "u1D6F6", + "ppem": 128, + "passed": true + } + }, + "numerical_passed": true + } + }, + "variable_fonts": { + "MachineMadeWarp[wght].ttf": { + "sha256": "8b71974938743a80a845f000655350f36973750ea9954424d63bf5c9e1765743", + "size_bytes": 7448792, + "slope": "Roman" + }, + "MachineMadeWarp-Italic[wght].ttf": { + "sha256": "66f96b90d481f0735dae5473357ad8263715dd44039477060c98a62a522f9d5a", + "size_bytes": 6679608, + "slope": "Italic" + } + }, + "web_fonts": { + "MachineMadeWarp-Italic[wght].woff2": { + "sha256": "028fe7b4999d26e18c7ff139fca384a45411b97ce98555005e5546fc91741b32", + "size_bytes": 1561220 + }, + "MachineMadeWarp[wght].woff2": { + "sha256": "37c055d173f735ec3e8208227acd5cb7e97c7aee9e351b7e5db01c6d945a1ff2", + "size_bytes": 1830476 + } + } +} diff --git a/warp/CHANGELOG.md b/warp/CHANGELOG.md index ce1e8b4..d7309dc 100644 --- a/warp/CHANGELOG.md +++ b/warp/CHANGELOG.md @@ -2,6 +2,21 @@ ## Unreleased +## 0.3.0 + +### Added + +- Roman and Italic variable TTF and WOFF2 fonts, with weights from 300 to 700. +- Clean variable builds that replay inspected contour corrections and run the numerical gates. +- Release archives with variable fonts, pinned file checks and SHA-256 sums for every font. +- Tests for archive contents and missing or changed variable fonts. + +### Changed + +- Raised the timeout of the release job and of the Warp build job to 240 minutes and added variable font inspection. A full run on a hosted runner needs about 64 minutes for the tests and the build alone. +- Set the package and font versions to 0.3.0 and 0.300. + + - Added eight measured side-bearing findings and an exact comparison that rejects missing or unlisted findings. - Fixed the measurement mode accepting a saved proof without source hashes: it now needs a hash for each of the seven masters. A correction now updates the saved hashes and correction list at once, so a failed measurement can be retried. @@ -10,7 +25,7 @@ - Fixed correction replay to resolve composites before rotating their bases, preserving the frozen source outlines. - Fixed correction order so reported composites resolve before any base glyph rotates. - Last inspected files: Roman 7,448,792 bytes; Italic 6,679,608 bytes. Both report 0 FAIL and 0 ERROR. -- The verdict is not verified because Roman has three new side-bearing findings and Italic has five. +- The inspected ladder is verified with eight accepted side-bearing findings: three in Roman and five in Italic. - Reduced variable font size by sharing identical outlines and variation data, with IUP tolerances for each weight. - Added checks that rebuild both fonts and limit each file to 9,437,184 bytes. - Added a mode that measures corrected masters and leaves Fontspector results unknown. diff --git a/warp/RELEASE-NOTES-0.3.md b/warp/RELEASE-NOTES-0.3.md new file mode 100644 index 0000000..0948f41 --- /dev/null +++ b/warp/RELEASE-NOTES-0.3.md @@ -0,0 +1,23 @@ +# machine-made Warp 0.3.0 + +Warp now includes Roman and Italic variable fonts with weights from 300 to 700. +Each comes as TTF and WOFF2. +The six static styles remain available as TTF, OTF and WOFF2. +The fonts report version 0.300. + +The inspected ladder measured a maximum interpolation difference of 0.9971 font units in each slope. +The largest raster difference from the pen drawing was 4.994 percent in each slope. +Roman used 7,448,792 bytes; Italic used 6,679,608 bytes. +Both were below the 9,437,184-byte limit. +The inspected sources had zero contour start findings. + +Fontspector reported zero FAIL, FATAL and ERROR results for each inspected font. +Eight side-bearing findings were accepted: three in Roman and five in Italic. +Six concern the ellipsis: dot spacing follows the changing stem width. +Two concern Italic zcaron: its right side bearing changes by 19 units between weights 400 and 500. +These measurements come from inspecting the versioned 0.3.0 variable fonts with Fontspector 1.9.0. +The release build also checks that its source outlines match the inspected sources and runs the numerical gates again. + +The archive includes an OCR report made during packaging preparation. +Its Tesseract version and measured error rates are recorded in readability.json. +SHA256SUMS lists the SHA-256 hash of every font in the archive. diff --git a/warp/STATUS.md b/warp/STATUS.md index 2036214..a514f7d 100644 --- a/warp/STATUS.md +++ b/warp/STATUS.md @@ -5,11 +5,11 @@ Correction replay now resolves composites before rotating their bases, preservin | Field | Value | | --- | --- | | Family | machine-made Warp, machine-made Warp Display | -| Version | 0.2 (font version 0.200) | -| Pull request | Weight ladder, branch warp-wght-ladder | -| Stage | Warp 0.2 built: 6 static styles (TTF hinted, OTF, WOFF2) with an OpenType MATH table | -| Gate now | Both variable fonts fit 9,437,184 bytes. Numerical gates pass. Fontspector reports 0 FAIL and 0 ERROR for both. | -| Next | Investigate the new side-bearing findings (3 in Roman, 5 in Italic). The optical-size axis remains open. | +| Version | 0.3.0 (font version 0.300) | +| Pull request | Variable font release preparation | +| Stage | Warp 0.3 includes six static styles and Roman and Italic variable TTF and WOFF2 fonts, weights 300 to 700 | +| Gate now | The clean build replays the inspected corrections, compares the source outline hashes and runs the numerical gates. The 0.3.0 fonts were inspected with Fontspector 1.9.0: verified with accepted findings, 0 FAIL and 0 ERROR. | +| Next | Tag and release Warp 0.3.0 (the founder's step). The optical-size axis remains open. | | Last local run | 2026-11-19, after the correction-order fix: Roman is 7,448,792 bytes; Italic is 6,679,608 bytes. Both report 0 FAIL and 0 ERROR. The verdict is verified with accepted findings: the eight new side-bearing findings are listed with their causes. | ## Variable font size (2026-11-17) @@ -41,7 +41,7 @@ It records their hashes and leaves the previous interpolation report intact. Checks of fresh builds compare compiled outlines and metrics separately from metadata. Moving contours keep their deltas when IUP would omit the entire contour. The focused weight ladder suite passed 36 tests, including fresh builds of both fonts. -The full Warp suite passed 161 tests. The byte guard for the released styles passed. +The full Warp suite passed 168 tests, including the release packaging tests. The byte guard for the released styles passed. The committed inspection reports 0 FAIL, 0 ERROR and 0 start-point findings for both files. The saved verdict is **verified with accepted findings**: the inspection run on 2026-11-19 matches the eight accepted findings in both directions, with 0 FAIL and 0 ERROR. Both slopes add advance-width findings for ellipsis at 350, 449.98779296875 and 450.006103515625. diff --git a/warp/loom/build.py b/warp/loom/build.py index 2cceee7..25eeb59 100644 --- a/warp/loom/build.py +++ b/warp/loom/build.py @@ -41,7 +41,7 @@ from loom.latin_ext import OGONEK, mathit_def from loom.sketch import G, GI -VERSION = (0, 200) # 0.200: Warp 0.2 +VERSION = (0, 300) # 0.300: Warp 0.3 COPYRIGHT = "Copyright 2026 The machine-made Warp Project Authors (https://github.com/machine-made/type)" LICENSE_DESCRIPTION = ( "This Font Software is licensed under the SIL Open Font License, " diff --git a/warp/pyproject.toml b/warp/pyproject.toml index 071722b..b443de2 100644 --- a/warp/pyproject.toml +++ b/warp/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "warp-loom" -version = "0.2.0" +version = "0.3.0" description = "Generator for the machine-made Warp typeface." requires-python = ">=3.13" license = "Apache-2.0" diff --git a/warp/scripts/build.sh b/warp/scripts/build.sh index a966349..e082229 100755 --- a/warp/scripts/build.sh +++ b/warp/scripts/build.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# Build Warp 0.2: six static styles as UFO, then TTF (hinted), OTF and WOFF2. +# Build Warp 0.3: six static styles and the Roman and Italic weight ladders. # Usage: warp/scripts/build.sh (from any directory) set -euo pipefail WARP="$(cd "$(dirname "$0")/.." && pwd)" @@ -10,6 +10,7 @@ export SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-1793059200}" # 2026-10-27 00:00 JOBS="${WARP_JOBS:-$(nproc 2>/dev/null || echo 1)}" cd "$WARP" +static_start=$SECONDS python -m loom.build --out build --jobs "$JOBS" rm -rf "$OUT" @@ -27,3 +28,30 @@ for f in "$OUT"/ttf/*.ttf; do done python tools/finish.py --static "$OUT"/ttf/*.ttf "$OUT"/otf/*.otf python tools/finish.py --woff2-dir "$OUT/webfonts" --woff2 "$OUT"/ttf/*.ttf + +echo "Static build: $((SECONDS - static_start)) seconds" +ladder_start=$SECONDS +python tools/vf_ladder.py --skip-fontspector --out "$ROOT/build/warp-vf" +mkdir -p "$OUT/vf" +cp "$ROOT/build/warp-vf/"*'[wght].ttf' "$OUT/vf/" +python tools/finish.py --woff2-dir "$OUT/vf" --woff2 "$OUT/vf/"*.ttf +python - "$ROOT" <<'PIN_WEB' +import hashlib +import json +import sys +from pathlib import Path + +root = Path(sys.argv[1]) +path = root / "build/warp-vf/release.json" +report = json.loads(path.read_text()) +for style in report["styles"].values(): + for measurement in style["fidelity"].values(): + measurement.pop("glyphs", None) +report["web_fonts"] = { + font.name: {"sha256": hashlib.sha256(font.read_bytes()).hexdigest(), + "size_bytes": font.stat().st_size} + for font in sorted((root / "fonts/warp/vf").glob("*.woff2")) +} +path.write_text(json.dumps(report, indent=1, ensure_ascii=False) + "\n") +PIN_WEB +echo "Ladder build and WOFF2: $((SECONDS - ladder_start)) seconds" diff --git a/warp/scripts/check.sh b/warp/scripts/check.sh index d4cbd29..9c0bd58 100755 --- a/warp/scripts/check.sh +++ b/warp/scripts/check.sh @@ -24,4 +24,27 @@ run text-ttf "$FONTS"/ttf/MachineMadeWarp-*.ttf run display-ttf "$FONTS"/ttf/MachineMadeWarpDisplay-*.ttf run text-otf "$FONTS"/otf/MachineMadeWarp-*.otf run display-otf "$FONTS"/otf/MachineMadeWarpDisplay-*.otf +# Inspect each variable font separately, then match the accepted findings. +python - "$FS" "$REPORTS" "$WARP" <<'CHECK_VARIABLE' +import json +import sys +from pathlib import Path + +sys.path.insert(0, str(Path(sys.argv[3]) / "tools")) +import vf_ladder + +proof = json.loads((vf_ladder.PROOFS / "ladder.json").read_text()) +accepted = json.loads((vf_ladder.PROOFS / "accepted_findings.json").read_text()) +for slope, suffix in (("Roman", ""), ("Italic", "-Italic")): + path = vf_ladder.ROOT / "fonts/warp/vf" / f"MachineMadeWarp{suffix}[wght].ttf" + counts, interpolation = vf_ladder.inspect_font(sys.argv[1], path, Path(sys.argv[2]), slope) + raw = json.loads((Path(sys.argv[2]) / f"fontspector-{slope}.json").read_text()) + baseline = [vf_ladder.finding_identity(r) for r in proof["previous_fontspector_findings"][slope]] + findings = [r for r in vf_ladder.fontspector_findings(raw) + if vf_ladder.finding_identity(r) not in baseline] + verdict, _, _ = vf_ladder.accepted_findings_verdict(findings, accepted[slope]) + if interpolation or any(counts[k] for k in ("FAIL", "FATAL", "ERROR")) or verdict == "not verified": + raise SystemExit(f"{slope}: variable font inspection failed") + print(f"{slope}: {verdict}; {counts}") +CHECK_VARIABLE exit "$status" diff --git a/warp/tests/test_release.py b/warp/tests/test_release.py new file mode 100644 index 0000000..b043e21 --- /dev/null +++ b/warp/tests/test_release.py @@ -0,0 +1,169 @@ +# SPDX-License-Identifier: Apache-2.0 +"""Exercise the release archive and reject missing or altered variable fonts.""" + +import hashlib +import json +import shutil +import subprocess +import sys +import zipfile +from pathlib import Path + +import pytest + +ROOT = Path(__file__).resolve().parents[2] + + +def package(root, out): + return subprocess.run( + [ + "bash", + str(root / ".github/scripts/package_release.sh"), + "warp", + "0.3.0", + str(out), + ], + cwd=root, + capture_output=True, + text=True, + ) + + +@pytest.fixture(scope="module") +def readability_report(tmp_path_factory): + report = tmp_path_factory.mktemp("ocr") / "readability.json" + subprocess.run( + [ + sys.executable, + str(ROOT / "warp/tools/readability.py"), + "--gate", + "--out", + str(report), + ], + cwd=ROOT, + check=True, + capture_output=True, + text=True, + ) + return report + + +def test_release_archive(tmp_path, readability_report): + out = tmp_path / "release" + out.mkdir() + shutil.copy2(readability_report, out / "readability.json") + result = package(ROOT, out) + assert result.returncode == 0, result.stderr + with zipfile.ZipFile(out / "machine-made-warp-0.3.0.zip") as archive: + archive.extractall(tmp_path / "unpacked") + folder = tmp_path / "unpacked/machine-made-warp-0.3.0" + expected = { + p.relative_to(ROOT / "fonts/warp").as_posix() + for p in (ROOT / "fonts/warp").rglob("*") + if p.suffix in {".ttf", ".otf", ".woff2"} + } + assert len(expected) == 22 + sums = dict( + line.split(" ", 1)[::-1] + for line in (folder / "SHA256SUMS").read_text().splitlines() + ) + assert set(sums) == expected + for name, digest in sums.items(): + assert hashlib.sha256((folder / name).read_bytes()).hexdigest() == digest + assert (folder / name).read_bytes() == (ROOT / "fonts/warp" / name).read_bytes() + for name in ("OFL.txt", "RELEASE-NOTES.md", "readability.json"): + assert (folder / name).is_file() + pins = json.loads((ROOT / "proofs/warp/release.json").read_text()) + for name, row in pins["variable_fonts"].items(): + assert sums[f"vf/{name}"] == row["sha256"] + first_zip = (out / "machine-made-warp-0.3.0.zip").read_bytes() + assert package(ROOT, out).returncode == 0 # Repeat in the same output folder. + assert (out / "machine-made-warp-0.3.0.zip").read_bytes() == first_zip + subprocess.run( + ["sha256sum", "-c", "SHA256SUMS"], + cwd=out, + check=True, + capture_output=True, + text=True, + ) + + +@pytest.mark.parametrize("damage", ["missing", "hash", "web", "ladder"]) +def test_release_rejects_damaged_variable_font(tmp_path, damage, readability_report): + root = tmp_path / "tree" + for rel in ("fonts/warp", "proofs/warp", "warp"): + # The fonts and proofs are small compared with build intermediates. + source = ROOT / rel + if rel == "warp": + (root / rel).mkdir(parents=True) + for name in ("OFL.txt", "RELEASE-NOTES-0.3.md"): + shutil.copy2(source / name, root / rel / name) + else: + shutil.copytree(source, root / rel) + script = root / ".github/scripts/package_release.sh" + script.parent.mkdir(parents=True) + shutil.copy2(ROOT / ".github/scripts/package_release.sh", script) + out = tmp_path / "release" + out.mkdir() + shutil.copy2(readability_report, out / "readability.json") + font = root / "fonts/warp/vf/MachineMadeWarp[wght].ttf" + if damage == "missing": + font.unlink() + elif damage == "hash": + data = bytearray(font.read_bytes()) + data[-1] ^= 1 # Keep the size unchanged to exercise the hash check. + font.write_bytes(data) + elif damage == "web": + shutil.copy2( + root / "fonts/warp/vf/MachineMadeWarp-Italic[wght].woff2", + font.with_suffix(".woff2"), + ) + else: + path = root / "proofs/warp/ladder.json" + proof = json.loads(path.read_text()) + proof["styles"]["Roman"]["file_size_bytes"] += 1 + path.write_text(json.dumps(proof)) + result = package(root, out) + assert result.returncode != 0 + assert "error:" in result.stderr + assert not (out / "machine-made-warp-0.3.0.zip").exists() + + +@pytest.mark.parametrize("passed", [True, False]) +def test_clean_measurement_preserves_inspected_proofs(tmp_path, monkeypatch, passed): + sys.path.insert(0, str(ROOT / "warp/tools")) + import vf_ladder + + proofs, out = tmp_path / "proofs", tmp_path / "output" + shutil.copytree(ROOT / "proofs/warp", proofs) + originals = {p.name: p.read_bytes() for p in proofs.iterdir() if p.is_file()} + monkeypatch.setattr(vf_ladder, "PROOFS", proofs) + seen = [] + + def measure(italic, folder, executable, release_proof): + assert executable is None + seen.append(release_proof) + path = folder / f"test-{italic}.ttf" + path.write_bytes(b"measured") + return ( + dict( + source_hashes_sha256={}, + source_outline_hashes_sha256={}, + file_size_bytes=8, + instances={}, + fidelity={}, + numerical_passed=passed, + ), + [], + path, + ) + + monkeypatch.setattr(vf_ladder, "run_slope", measure) + assert vf_ladder.main(["--skip-fontspector", "--out", str(out)]) == int(not passed) + assert len(seen) == 2 + assert { + p.name: p.read_bytes() for p in proofs.iterdir() if p.is_file() + } == originals + measured = json.loads((out / "release.json").read_text()) + assert "verdict" not in measured + assert all("fontspector" not in row for row in measured["styles"].values()) diff --git a/warp/tools/vf_ladder.py b/warp/tools/vf_ladder.py index 4ee6ebc..807b1cb 100644 --- a/warp/tools/vf_ladder.py +++ b/warp/tools/vf_ladder.py @@ -868,6 +868,28 @@ def prepare_slope(italic: bool, out: Path) -> dict[str, Rotations]: return rotations +def prepare_release_slope( + italic: bool, out: Path, saved: Record +) -> dict[str, Rotations]: + """Rebuild the inspected outline indexing without running the inspector.""" + statics = compiled_sources(italic, out) + rotations = {} + for weight, font in statics.items(): + if weight != 400: + rotations[str(weight)] = align_static( + font, statics[400], B.weight_style(weight, italic) + ) + # Replay each inspection batch in its original order. + corrections = saved["start_point_corrections"] + for attempt in sorted({row["attempt"] for row in corrections}): + apply_corrections(statics, [r for r in corrections if r["attempt"] == attempt]) + build_vf(statics, list(B.MASTER_WEIGHTS), italic, out) + for name, expected in saved["source_outline_hashes_sha256"].items(): + if source_outline_hash(out / name) != expected: + raise ValueError(f"Inspected source outlines changed: {name}") + return rotations + + def rebuild_aligned_slope(italic: bool, out: Path) -> None: """Re-encode saved, corrected masters without inspecting or rotating them.""" weights = list(B.MASTER_WEIGHTS) @@ -987,6 +1009,7 @@ def run_slope( executable: str | None, reuse_aligned_sources: bool = False, on_correction: Callable[[list[Record]], None] | None = None, + release_proof: Record | None = None, ) -> tuple[Record, list[Record], Path]: slope = "Italic" if italic else "Roman" weights = list(B.MASTER_WEIGHTS) @@ -994,7 +1017,9 @@ def run_slope( path = out / f"MachineMadeWarp{suffix}[wght].ttf" # Each builder exits before inspection. Clearing Python objects alone # can leave its allocator holding gigabytes of unused font memory. - if reuse_aligned_sources: + if release_proof is not None: + rotations = worker_process(prepare_release_slope, italic, out, release_proof) + elif reuse_aligned_sources: worker_process(rebuild_aligned_slope, italic, out) rotations = {} else: @@ -1084,6 +1109,47 @@ def run_slope( return report, findings, path +def release_build(out: Path) -> int: + """Measure clean release builds; leave all inspected proofs untouched.""" + proof = json.loads((PROOFS / "ladder.json").read_text()) + interpolation = json.loads((PROOFS / "interpolation.json").read_text()) + if interpolation["start_point_count"] != 0: + raise ValueError("Inspected start-point count must be zero") + report: Record = {"styles": {}, "variable_fonts": {}} + passed = True + for italic in (False, True): + slope = "Italic" if italic else "Roman" + saved = proof["styles"][slope] + expected_names = {f"{B.weight_style(w, italic)}.ttf" for w in B.MASTER_WEIGHTS} + if set(saved["source_outline_hashes_sha256"]) != expected_names: + raise ValueError(f"Missing inspected source outline hashes for {slope}") + row, _, path = run_slope(italic, out, None, release_proof=saved) + # These are new numerical measurements, not a new inspection verdict. + report["styles"][slope] = { + key: row[key] + for key in ( + "source_hashes_sha256", + "source_outline_hashes_sha256", + "file_size_bytes", + "instances", + "fidelity", + "numerical_passed", + ) + } + for measurement in report["styles"][slope]["fidelity"].values(): + measurement.pop( + "glyphs", None + ) # Full rasters stay in --out/*-fidelity.json. + report["variable_fonts"][path.name] = { + "sha256": hashlib.sha256(path.read_bytes()).hexdigest(), + "size_bytes": path.stat().st_size, + "slope": slope, + } + passed &= row["numerical_passed"] + write_json(out / "release.json", report) + return int(not passed) + + def main(argv: list[str] | None = None) -> int: ap = argparse.ArgumentParser(description=__doc__) ap.add_argument("--out", type=Path, default=OUT) @@ -1091,7 +1157,7 @@ def main(argv: list[str] | None = None) -> int: ap.add_argument( "--skip-fontspector", action="store_true", - help="Measure without inspection; the verdict stays not verified", + help="Measure without inspection; clean builds leave inspected proofs untouched", ) ap.add_argument( "--reuse-aligned-sources", @@ -1099,13 +1165,13 @@ def main(argv: list[str] | None = None) -> int: help="Rebuild from the saved, corrected source TTFs in --out", ) args = ap.parse_args(argv) - if args.skip_fontspector and not args.reuse_aligned_sources: - ap.error("--skip-fontspector requires --reuse-aligned-sources") if not args.skip_fontspector and not args.fontspector: ap.error("Fontspector is required; put it on PATH or use --fontspector") os.environ["SOURCE_DATE_EPOCH"] = "1793059200" out = args.out.resolve() out.mkdir(parents=True, exist_ok=True) + if args.skip_fontspector and not args.reuse_aligned_sources: + return release_build(out) report = { "styles": {}, "incompatible": [],