You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by Tony Scerri <to...@gmail.com> on 2009/09/16 12:12:33 UTC

Adobe CFF/Type2 to Type1 Font Convertor - Any Interest?

Hi

I had a bunch of PDFs which used Adobe CFF/Type2 fonts which arent supported
in PDFbox. I was wondering what the current plan/view on this topic is with
respect for adding support. Is this something that will come out of FontBox
or some other library?

Anyway I went of on one of those coding rambles for the hell of it and went
down the path of seeing what it would take to make them render using PDFBox
through AWT. Annoyingly Java uses a library beneath the scene which would
appear to support CFF/Typ2 but just wasnt exposed through the java APIs for
some reason, maybe licenseing who knows. So with AWT the only way is to
either write some glyph rendering code which there didnt seem to be an API
for dropping new glyph renderers in, you'd simply have to go over in via AWT
drawing API, or the route I pursued was to convert CFF/Type2 to Type1 fonts.


So i ended up writting a few classes which now does this on the fly changing
the embeded fonts byte stream from one to the other. Its not supporting all
features (mainly hinting and flex) available in the font types, but the core
necessary to draw each glyph in some fasion appears to be functioning.

I was wondering if this is something for the PDFBox project itself or
FontBox maybe. Or is there an existing way to do this already which just
needs incorporating into PDFBox. I'm happy to contribute the code (after
some cleanup) and maybe some discussion on the best approach. Right now it
fits into the PDType1Font class when it detects the filestream for CFF font
it passses it over to my class which converts it and embeds it back into
tthe PDF font stream so the remainder of the code picks it up as a Type1
font.

Tony

Tony