Problems caused by Arial font in PDF files

Arial is a very popular font for use in PDF files. It is also one of the font families assumed to be present for PDF viewing. However we have found it can be rather problematic. The reason for this is that there is more than ONE version of Arial floating around. Recounting a recent issue I looked into for our PDF viewer will show this issue more clearly.

We had a PDF file which contained columns of text on a page. On our viewer, they were not aligned correctly. Digging into the file it turned out that the alignment was being achieved using spaces in Arial. There were no widths defined for the space character, so we used the Arial space width defined in the AFM files. But Acrobat was using the space width from the Arial truetype font (and these values are not identical). So we could fix it by adding Arial.tff to our setup.

The problem is that we are quite often dealing with at least 3 different types of Arial – there is the Arial defined in the AFM files and then there is Arial as a local or embedded font (I have seen it in both non-CID TrueType, a CID version and Type1 versions). Because we are working in Java we also have access to a font from Java called ‘Arial‘ which actually contains some broken glyphs. And all of these fonts are available in slightly different versions. This can cause issues when trying to show some documents.

So it is worth including the width information of all fonts in your PDF files. A good policy is to embed your fonts as a matter of course and then you do not end up with documents which rely on local fonts on your machine to appear correctly.

This post is part of our “Understanding the PDF File Format” series. In each article, we discuss a PDF feature, bug, gotcha or tip. If you wish to learn more about PDF, we have 13 years worth of PDF knowledge and tips, so click here to visit our series index!

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>