Interesting PDF bugs – Dealing with three type of fonts

One of the issues we get a lot with PDFs is the issue of non-embedded fonts. There are types of fonts in a PDF file:-

1. Fonts belonging to the 8 defined families (Arial, Helvetica,etc) defined as being in a PDF Viewer.

2. Embedded fonts – all the font data is included in the PDF so we can draw the fonts.

3. Non-embedded fonts. Because Adobe does not enforce the first 2 cases, it is perfectly possible to have a font where we only have the name (ie Frigate). The PDF Creator is relying on the user having a local copy of a font called Frigate which the viewer will then use. This also assumes my version of Frigate is the same as yours.

This makes like very hard for a PDF viewer (especially if you want to be cross platform or run on a virtual machine). So this is how we deal with such fonts:-

A. If there is a local font of the same name available use that.

B. If there seems to be an obvious match (Arial Bold would seem a good match for ArialMT and ArialNarrow while we can use TimesNewRoman is TimesNewRomanPS). We do this through a mix of pattern matching and our lookup table in FontMappings class.

This works very well but it is not perfect. So what do we do about Frigate?

This post is part of our “Fonts Articles Index” in these articles we explore Fonts.

Related Posts:

The following two tabs change content below.

Mark Stephens

System Architect and Lead Developer at IDRSolutions
Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX. He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.
Markee174

About Mark Stephens

Mark Stephens has been working with Java and PDF since 1999 and has diversified into HTML5, SVG and JavaFX.

He also enjoys speaking at conferences and has been a Speaker at user groups, Business of Software, Seybold and JavaOne conferences. He has a very dry sense of humor and an MA in Medieval History for which he has not yet found a practical use.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>