PDF Font Tutorial
PDF fonts is a tricky subject and one we frequently get asked about. So I will be writing a set of articles to try and make some sense of the subject. I hope they prove useful and if you have any specific questions, please send me a question and I will make it into an article.
So lets start at the beginning….
PDF files can contain images, Vector graphics and text. All the text can be in any font. There are 5 standard font families which all PDF viewers must contain (Times, Helvetica, Courier, Symbol and ZapfDingbats) so these can be used in any document. You can use any other font – my daughter always uses her Malinka font because she loves the letters made from cats. In this case there are three possible approaches. These are set in the PDF creation tool:-
1. Just include the name of the font and hope it is on everyone’s machine. If it is not, it will be replaced with a Standard font.
2. Embed the font. This means include the actual font data inside the PDF. You can then guarantee that it will be on everyone’s machine because it is in the PDF file (but can only be used by the PDF containing it). The problem with this is that some fonts are very large, so it makes the PDF files much bigger.
3. Embed and subset the font. This means include just the data needed to draw any characters. So if my daughter creates a PDF containing the phrase ‘THE CAT SAT ON THE MAT’, it would embed just the font data for the letters T, H, E, C, A, S, O, N, M. This is a good compromise as it keeps the file small but guarantees the PDF file will appear as you wanted it.
So that is the basic principle. What can make it confusing is that PDF files can use several different types of font technology. And that is what we will cover next.
This post is part of our “Understanding the PDF File Format” series. In each article, we aim to take a specific PDF feature and explain it in simple terms. 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!
Latest posts by Mark Stephens (see all)
- Introducing the new XFA Parser in FormVu - May 16, 2018
- Moving to JPedal release 8 - May 2, 2018
- Which version of Java SE should I use? - April 25, 2018
- How we are improving our code quality with IDEA in 2018 - March 7, 2018
- How we are improving our code quality with NetBeans in 2018 - March 1, 2018