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.

Interesting PDF bugs – Dealing with three type of fonts

51 sec read

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.

IDRsolutions develop a Java PDF Viewer and SDK, an Adobe forms to HTML5 forms converter, a PDF to HTML5 converter and a Java ImageIO replacement. On the blog our team post anything interesting they learn 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.

PDF to HTML5’s Holy Grail – Vertical positioning for…

It’s safe to say that if someone designed fonts from scratch today they’d be very different on the inside. As with many technologies, the...
Sam Howard
1 min read

WOFF 2.0: What is it, why is it coming,…

WOFF 2.0 is working its way towards being a standard recommended by the W3C, so it seems like a good time to look at...
Sam Howard
2 min read

Web fonts: A quick introduction to Wrapper and Glyph…

I was planning to write about WOFF 2.0 this week, and wanted to link to a previous article I’d written which explains the structure...
Sam Howard
1 min read

Leave a Reply

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