Site iconJava PDF Blog

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.