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.
Can we help you to solve any of these problems?
IDRsolutions has been helping companies to solve these problems since 1999.
|Convert PDF to HTML5 or SVG||Convert PDF forms to HTML5|
|Java SDK for Image files||Java SDK for PDF files|