Skip to content

Add CGM Input

Jonathan Neuhauser requested to merge joneuhauser/extensions:cgm-input into master

What does the merge request do?

Adds a CGM importer. This was previously covered by UniConvertor.

CGM is a somewhat historic file format - all test files I found online are from the last millenial - but still somewhat interesting because it's an ISO standard. It's a matter of digital preservation, there are very few tools available to read these files and at best they have a half-broken PostScript export.

Implementation notes

With the parser, I aimed to support as much as necessary (and supporting more is difficult because there are no programs available to generate test files!). Most files work with a very small subset of commands. Hence, Markers, Patterns / Hatches, NURBS, CMYK and other obscure stuff was not added.

I tried out a new approach for the parser that heavily relies on typing and introspection to write readable and boilerplate-light code. Worked fine for me.

Test coverage is achieved through a single GPL licensed CGM file I could find (abydos.cgm) from the Abydos project, as well as tests for individual commands - both on the parsing side and conversion side, partially tiny snippets from other test files that fall below the bar for copyrighted material, and some synthetic data.

Summary for release notes

Add back an importer for CGM (Computer Graphics Metafile), which was removed with Inkscape 1.0.

Checklist

  • Add unit tests (if applicable)
  • Changes to inkex/ are well documented
  • Clean merge request history
Edited by Jonathan Neuhauser

Merge request reports