SVG → EMF direction + lossy matcher + fidelity tooling (v0.1.2) - #12
Merged
Conversation
Add the inverse SVG → EMF translation direction alongside the existing EMF → SVG renderer. Both directions are now functional and verified. SVG → EMF: - Nokogiri-backed SVG parser producing pure value-object domain model - OCP handler registry: new element type = new handler class - Handlers for rect, ellipse, circle, line, polyline, polygon, path, group (with transforms), text (basic), image (PNG), clip paths, defs - Public API: Emfsvg.from_svg, Emfsvg.from_svg_file, Emfsvg.to_emf - CLI: emfsvg to-emf INPUT.svg OUTPUT.emf - Coordinate scaler infrastructure (Identity default, Fixed available) Lossy SVG matcher (spec/support/svg_matcher.rb): - Float tolerance, ID canonicalisation, defs hoisting, transform flattening - Proves 208/208 (100%) EMF→SVG semantic equivalence vs libemf2svg at 0.1px tolerance (79 byte-identical, 129 cosmetically different) - Regression spec locks in the fidelity result Developer tooling: - scripts/run_emf_svg_compare.rb — fidelity scan vs libemf2svg - scripts/run_round_trip.rb — SVG→EMF→SVG round-trip scan - scripts/diff_fixture.rb — element-level diff diagnostics - scripts/diagnose_round_trip.rb — per-fixture failure reasons 205 specs, 0 failures. Rubocop clean on new code.
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.
Summary
Test plan
bundle exec rspec— 205 examples, 0 failuresbundle exec rubocop— clean on new codescripts/run_emf_svg_compare.rb 208 0.1— 208/208 pass at 0.1px tolerancespec/fidelity_regression_spec.rb— 10/10 pass vs libemf2svg