Java PDF Blog

PDF solutions for big and small customers

Java and PDF development - our personal experiences and discoveries

Download JPedal

Download JPedal PDF viewers

PDF to Image service

Try our PDF to image conversion service now.

Java PDF Ebook Solution

Try our Ebook solution now.

Subscribe

Your email:

Java PDF blog

Current Articles | RSS Feed RSS Feed

PDF with odd Type3 fonts in Ghostscript 8.50

Posted by Mark Stephens on Wed, Jan 06, 2010 @ 10:28 AM
Submit to Digg digg it |  Add to delicious  delicious |  Submit to StumbleUpon StumbleUpon | Submit to Reddit reddit 

As the developers of a PDF renderer, we spend a lot of time analysing PDF files and working out exactly what is going on. Recently we came across an intriguing font issue with a PDF file created in Ghostscript. It is worth relating as it is interesting in terms of Font technologies and for seeing what might be happening in Ghostscript...

Over the years, Adobe has added several font technologies to the PDF specification, including Type3, Type1, Truetype and OpenType. Type3 was one of the first and is not often used now because the quality of the other font technolgies is superior. However, one tool which does make extensive use of Type3 fonts is Ghostscript - the Open Source PDF 'printing' library.

The way Type 3 works is that it allows you to define each character using the same commands as are used to define the PDF itself - so each character can be like a mini-PDF drawn in the space of the character. Most examples we have seen up until now have been reasonably simple with either images or shapes used to drawn the letters.

We were sent a PDF file last week to look at - it still amazes me after 10 years of developing a PDF library how many different ways people have managed to interpret the Specification and produce files which still work in Acrobat. We drilled down and fixed the issue, but what made it interesting was what was happening in the file.

In this file, each Type 3 font character had been created by adding instructions to draw a Type1 font character - so the Type3 font definition for the letter A just drew a letter A, and so forth. The Type 3 font is essentially acting as a wrapper for a Type1 font. This works but it is a fairly hacky and inefficient way to do things - it would be far better to just use a Type1 font which would also offer lots of other advantages. But PDFs are often created by tools which are just patched and patched - most users do not see the internal guts of a PDF so they do not appreciate what is going on. If it looks okay, they are happy with that.

This suggests to me that maybe Ghostscript is being patched and patched - sometimes code reaches a point where it is time to take a block and rewrite it properly...

COMMENTS

Currently, there are no comments. Be the first to post one!
Post Comment
Name
 *
Email
 *
Website (optional)
Comment
 *

Allowed tags: <a> link, <b> bold, <i> italics