Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 29, 2025

Validates that font text models convert BezierCurve arcs back to BezierSeeds during SVG export, ensuring no arc (A) commands appear in the output.

Changes

  • Test: Added textFromFontNoArcsInSVG() validating ArbutusSlab-Regular and NewRocker-Regular fonts export without arc commands using "Hello World" test string to validate multiple character shapes
  • Documentation: Added .github/copilot-instructions.md documenting build artifacts and lockfiles that should never be committed (but not gitignored)
  • Reverted: Restored build artifacts and lockfiles to their original state

Test Coverage

The test creates text models with "Hello World" and validates:

  • SVG export completes successfully
  • All path elements in the output are checked
  • No arc (A/a) commands are present in any path data
  • BezierSeeds (Q/C commands) are used instead
var textModel = new makerjs.models.Text(font, 'Hello World', 100);
var svg = makerjs.exporter.toSVG(textModel);
var pathMatches = svg.match(/<path[^>]*d=['"]([^'"]*)['"]/g);
pathMatches.forEach(function(pathElement) {
    var pathData = pathDataMatch[1];
    var hasArcCommand = /\b[Aa]\b/.test(pathData);
    assert.ok(!hasArcCommand, 'SVG path should not contain arc (A/a) commands');
});

The test confirms BezierCurves generated from fonts are properly unified back to BezierSeeds (Q/C commands) rather than remaining as approximating arcs during SVG export, validating across diverse character shapes including uppercase, lowercase, and letters with various curves.

Testing

  • ✅ All 4 Text tests pass
  • ✅ Font rendering validated for multiple character shapes
  • ✅ No regressions in existing functionality
Original prompt

add a test for a font - that there should be no arcs in SVG output. Hoping that complete conversion back to BezierSeeds happens.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Add test to ensure no arcs in SVG output Add test to verify fonts export to SVG without arc commands Dec 29, 2025
Copilot AI requested a review from danmarshall December 29, 2025 03:44
@danmarshall
Copy link
Contributor

@copilot undo your commits to these files:
docs/target/js/browser.maker.js
package-lock.json
packages/fonts/gen.js

Copy link
Contributor Author

Copilot AI commented Jan 9, 2026

@copilot undo your commits to these files:
docs/target/js/browser.maker.js
package-lock.json
...

Done. Reverted these files to their original state in commit e2e2dcd.

@danmarshall danmarshall marked this pull request as ready for review January 9, 2026 04:32
@danmarshall
Copy link
Contributor

@copilot nice work. can we do more characters than just 'A'

Copy link
Contributor Author

Copilot AI commented Jan 9, 2026

@copilot nice work. can we do more characters than just 'A'

Done. Expanded the test to use "Hello World" instead of just 'A', and updated the test to check all path elements in the SVG output. Commit 3d6aeba.

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.

2 participants