Skip to content

Replace emf2svg with pure-Ruby emfsvg gem - #65

Merged
ronaldtse merged 2 commits into
mainfrom
replace-emf2svg-with-emfsvg
Jul 26, 2026
Merged

Replace emf2svg with pure-Ruby emfsvg gem#65
ronaldtse merged 2 commits into
mainfrom
replace-emf2svg-with-emfsvg

Conversation

@ronaldtse

@ronaldtse ronaldtse commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Replaces the emf2svg gem (FFI wrapper around GPLv2 libemf2svg) with the pure-Ruby emfsvg gem from claricle. Vectory now uses emfsvg for both EMF → SVG and SVG → EMF, dropping the Inkscape dependency for SVG ↔ EMF.

Closes #66.

Changes

  • vectory.gemspec: emf2svgemfsvg "~> 0.1", ">= 0.1.2" (0.1.2 ships the SVG → EMF direction)
  • lib/vectory/emf.rb: require "emfsvg"; to_svg collapses from tmpdir + from_file to Svg.from_content(Emfsvg.from_bytes(content))
  • lib/vectory/svg.rb: to_emf swaps from InkscapeWrapper.convert to Emf.from_content(Emfsvg.from_svg(content))
  • spec/examples/emf2svg/spec/examples/emfsvg/ (renamed; 3 spec files updated)
  • spec/vectory/svg_spec.rb: drop the to_emf case from the Inkscape error-propagation context (no longer applies)
  • README.adoc, docs//*.adoc**: terminology refresh; conversion matrix updated so SVG ↔ EMF shows emfsvg for both directions
  • Dropped untracked BUGREPORT.svg-to-emf-windows.md (historical emf2svg note, no longer relevant)

Test plan

  • bundle exec rspec — 193/193 pass
  • No new rubocop offenses on changed files

Remaining Inkscape usage

After this PR, Inkscape is still used by:

  • Svg#to_eps, Svg#to_ps, Svg#to_pdf (SVG → EPS/PS/PDF)
  • Pdf#to_svg (PDF → SVG)
  • Eps#to_svg and Ps#to_svg via the Ghostscript + Inkscape two-step (EPS/PS → PDF → SVG)

EPS/PS → SVG could move to postsvg (pure Ruby) — tracked in #67. SVG → EPS/PS/PDF and PDF → SVG still have no pure-Ruby replacement and remain on Inkscape.

Notes

The error class raised by Svg#to_emf on conversion failure changes from Vectory::ConversionError to Emfsvg::Error (no longer wrapped through InkscapeWrapper). Documented here as a contract change.

Swap the FFI wrapper (emf2svg-ruby around GPLv2 libemf2svg) for the
pure-Ruby emfsvg gem.

- vectory.gemspec: depend on emfsvg ~> 0.1
- lib/vectory/emf.rb: require "emfsvg"; collapse tmpdir dance to
  Svg.from_content(Emfsvg.from_bytes(content))
- spec/examples/emf2svg/ renamed to spec/examples/emfsvg/
- README.adoc and docs/**/*.adoc: terminology updates
@github-actions

Copy link
Copy Markdown

🔗 Link Check Failed


Please fix the broken links and push a new commit.

emfsvg 0.1.2 ships SVG-to-EMF translation. Vectory's Svg#to_emf now
calls Emfsvg.from_svg directly instead of shelling out to Inkscape,
dropping the Inkscape dependency for SVG/EMF (still needed for
SVG/EPS/PS/PDF).

- vectory.gemspec: require emfsvg >= 0.1.2
- lib/vectory/svg.rb: to_emf = Emf.from_content(Emfsvg.from_svg(content))
- spec/vectory/svg_spec.rb: drop stale Inkscape error-propagation test for to_emf
- docs/features/{conversion,index}.adoc, getting-started/core-concepts.adoc,
  understanding/architecture.adoc: reflect new SVG/EMF path

Closes #66
@github-actions

Copy link
Copy Markdown

🔗 Link Check Failed


Please fix the broken links and push a new commit.

@ronaldtse
ronaldtse merged commit cdb757f into main Jul 26, 2026
15 of 16 checks passed
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.

Replace Inkscape SVG→EMF with emfsvg once 0.2 ships

1 participant