pdfsizeopt icon indicating copy to clipboard operation
pdfsizeopt copied to clipboard

converting Type1 fonts to Type1C (CFF) without Ghostscript

Open pts opened this issue 8 years ago • 2 comments

This would affect function in GenerateType1CFontsFromType1, and it would make Type1CConverter and psproc.TYPE1C_CONVERTER obsolete.

These have to be implemented:

  • A Type1 font program parser in Python. This is tricky, there are many corner cases and unconforming Type1 font inputs.
  • A /CharStrings format converter from /FontType 1 to /FontType 2 in C (because Python would be too slow; a proof of concept could be implemented in Python instead). This is tricky, there are many corner cases.
  • An eexec decoding filter in C (because Python would be too slow).

Maybe t1lib (http://www.t1lib.org/) or parts of the Ghostscript source code can be reused, but these look complicated and may have their own bugs. Probably code of libpoppler is better, but it's in C++ (rather than C).

pts avatar Nov 14 '17 10:11 pts

I recommend increasing the priority of this one from "enhancement." Ghostscript versions that work with pdfsizeopt are being removed from most systems at my workplace due to the vulnerabilities referenced at https://bugs.ghostscript.com/show_bug.cgi?id=700362.

FontForge has some type1 parsing ability in C that looks fairly straightforward (see the psfont.h file) as another avenue to explore.

squinky86 avatar Dec 14 '18 15:12 squinky86

I'd be happy to make this high priority and implement it soon, but for that pdfsizeopt would neet to get funding. Without funding I can't foresee that I'd use time for this instead of my other projects.

Please note that more work needs to be done to get rid of Ghostscript as a dependency: https://github.com/pts/pdfsizeopt/issues/63

In the meantime, please follow the installation instructions on https://github.com/pts/pdfsizeopt , and you'd be unaffected by Ghostscript upgrades on your system.

pts avatar Dec 14 '18 17:12 pts