Repository navigation
swiftdraw-diff: render text with the resvg CLI when PNGs are given too - #225
Merged
Merged
Conversation
resvg's test-suite PNGs were drawn with the suite's Noto fonts, so text in them never matches SwiftDraw's fallback fonts. With --resvg and --resvg-png, files containing <text> now always use the resvg CLI (fallback fonts, --font-size 16); other files keep their PNG when usable. With --resvg-png alone, the summary says how many text files are compared against PNGs with other fonts. Each file records its resvg source (resvgSource: png|cli) in scores.json and compare.json; the summary counts text files rendered by the CLI and marks CLI-rendered files when PNGs were given.
swhitty
force-pushed
the
claude/diff-text-cli-fallback
branch
from
November 17, 2026 20:22
a337862 to
953915d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #225 +/- ##
=======================================
Coverage 95.23% 95.23%
=======================================
Files 296 296
Lines 31260 31260
=======================================
+ Hits 29771 29772 +1
+ Misses 1489 1488 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #209.
resvg's test-suite PNGs were drawn with the suite's own Noto fonts. When
--resvg-pngwas used, every file containing<text>was compared against glyphs that SwiftDraw, which uses Times, Helvetica and Courier, can never match.Changes
--resvgand--resvg-png, any file containing<text>is rendered by the resvg CLI, with the fallback-font flags and--font-size 16. Every other file keeps its PNG when the PNG is usable.--resvg-pngalone, behaviour is unchanged. The summary now says how many text files were compared against pre-rendered PNGs, which may use other fonts, and suggests adding--resvg.scores.jsonandcompare.jsongainresvgSource(pngorcli) for each file. The summary counts the text files the CLI rendered. When PNGs were given, it marks CLI-rendered files:(resvg CLI)in report mode,[…, resvg CLI]in compare. The references line readsresvg PNGs (…), resvg 0.50.0 for text and unusable PNGs.--resvg-pnghelp and AGENTS.md's resvg-suite paragraph are updated.Options.prefersResvgPNG, with unit tests.Verification
swift test --package-path Tools/swiftdraw-diff: 27 tests in 6 suites pass.compare --base origin/main --resvg Samples.bundle: 181 of 181 unchanged, no regressions.main(7a54105) with--resvg --resvg-png sibling --scale 2(1,801 files):All 430 text files now use the CLI; the other 1,342 files keep their PNG, and 28 files without a usable PNG fall back to the CLI as before. No file's verdict got worse, and no non-text file's score changed at all. The pass gain is in text files only:
text/text/🤖 Generated with Claude Code