Skip to content

Drop external tools: vectory is now pure Ruby (0.11.0) - #69

Merged
ronaldtse merged 2 commits into
mainfrom
drop-external-tools
Jul 27, 2026
Merged

Drop external tools: vectory is now pure Ruby (0.11.0)#69
ronaldtse merged 2 commits into
mainfrom
drop-external-tools

Conversation

@ronaldtse

Copy link
Copy Markdown
Contributor

Summary

Vectory no longer shells out to Inkscape, Ghostscript, or any external binary. All conversions are pure Ruby:

  • SVG ↔ EMF: emfsvg
  • EPS/PS ↔ SVG: postsvg
  • Cross-format (e.g. Eps → Ps): two-step via SVG intermediate

Dimensions come from format-native metadata (SVG attributes/viewBox, EMF header bounds, EPS/PS %%BoundingBox). No Inkscape query calls.

BREAKING: PDF support removed. Vectory::Pdf, *.to_pdf, and related infrastructure are gone. Vectory is now SVG/EPS/PS/EMF only. The library is no longer a wrapper around external tools — it is a pure-Ruby pairwise vector converter.

Bumps to 0.11.0 (minor: pre-1.0 semver treats breaking changes as minor).

Deleted

  • lib/vectory/pdf.rb
  • lib/vectory/inkscape_wrapper.rb
  • lib/vectory/ghostscript_wrapper.rb
  • lib/vectory/platform.rb (only used by wrappers)
  • lib/vectory/conversion.rb + lib/vectory/conversion/*.rb (strategy registry for external tools)
  • Ukiryu runtime dependency (only used by wrappers)
  • Errors: InkscapeNotFoundError, GhostscriptNotFoundError, InkscapeQueryError
  • CLI status codes for those errors
  • Configuration: inkscape_path, ghostscript_path accessors and their env-var loaders
  • spec/vectory/pdf_spec.rb, spec/vectory/inkscape_wrapper_spec.rb

Rewired

  • Svg#to_eps, Svg#to_ps: now Postsvg.to_eps/to_ps
  • Eps#to_ps, Eps#to_emf, Ps#to_eps, Ps#to_emf: now via SVG intermediate (no PDF)
  • Emf#to_eps, Emf#to_ps: now via SVG intermediate (no Inkscape)
  • Emf#height/width: from Emf.parse(content).header.bounds
  • Svg#height/width: width/height attr → viewBox → NotImplementedError
  • Vector#height/width fallback: now raises NotImplementedError (was: Inkscape)

Added

  • scripts/regenerate_fixtures.rb — one-shot script to regenerate all spec/examples/*/ref.* via the new pipeline

Test plan

  • bundle exec rspec — 170/170 pass (was 193; removed 23 stale tests for Inkscape/Ghostscript/PDF error paths and PDF class itself)
  • Test fixtures regenerated via the new pipeline
  • Pre-existing rubocop warnings unchanged (svg_mapping.rb A-z range, gemspec mfa/test_files)

Caveats

postsvg and emfsvg have known upstream limitations:

  • postsvg: no text/font rendering, no image embedding, no gradients/patterns, no CMYK, no PS Level 2/3 advanced ops
  • emfsvg: SVG → EMF covers a smaller subset than EMF → SVG

EPS/PS/SVG files using those features will silently degrade. Acceptable for vectory's test fixtures (verified by the regeneration script). Real-world users with complex files may see regressions vs the old Ghostscript + Inkscape path; track upstream postsvg/emfsvg to know when coverage improves.

Vectory no longer shells out to Inkscape, Ghostscript, or any other
external binary. All format conversions are handled by pure-Ruby gems:

- SVG / EMF: emfsvg (both directions)
- EPS/PS / SVG: postsvg (both directions)
- Cross-format (e.g. Eps to Ps): two-step via SVG intermediate
- Emf dimensions: emf header bounds (no Inkscape query)
- Svg dimensions: width/height attribute, then viewBox

BREAKING: PDF support removed. Vectory::Pdf, *.to_pdf, and related
infrastructure are gone. The library is now SVG/EPS/PS/EMF only.

Code removed:
- lib/vectory/pdf.rb
- lib/vectory/inkscape_wrapper.rb
- lib/vectory/ghostscript_wrapper.rb
- lib/vectory/platform.rb (only used by wrappers)
- lib/vectory/conversion/* (strategy registry for external tools)
- Ukiryu dependency (only used by wrappers)
- Errors: InkscapeNotFoundError, GhostscriptNotFoundError,
  InkscapeQueryError
- CLI status codes for those errors
- Configuration: inkscape_path, ghostscript_path accessors

Test fixtures regenerated via scripts/regenerate_fixtures.rb.

Version bumped to 0.11.0 (minor: breaking change in pre-1.0 semver).
@ronaldtse
ronaldtse merged commit 381a571 into main Jul 27, 2026
14 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.

1 participant