Managing subset characters when embedding fonts in a PDF document
Estimated Reading Time: 2 MinutesThe last parameter of the dlpdffontcreateembedded or dlpdffontcreatewithmetricsembedded calls, both used to embed fonts in a PDF document, is the Subset flag. This flag specifies whether you want the entire font embedded in the PDF document, or only a subset of those glyphs that are actually used.
If you are embedding a Type 0 or CJKV font (Chinese/Japanese/Korean/Vietnamese), you must subset it as well. These are extremely large font sets; the Unicode 5 Han Chinese font set has some 70,000 characters. Embedding all of these characters into a PDF document is not standard practice.
Otherwise, your decision on what characters in an embedded font you will decide to include tin the subset in a PDF document depends on whether anyone will need to edit or add content to this document after you create it. If the entire font is embedded in the file, including the glyphs that are not actually used to display or print it in its current form, you can make any changes you like to the document with that font. If you embed a subset, any text you add to the document later will be limited to the characters available in that subset.
You might want to consider the final size of the PDF document as well. If you are working with a small PDF document that may not matter, and the file size may not increase significantly if you are working with a standard font.
Note that when a font is subset, it is stored under a unique name, with a custom prefix, such as “ELM+Arial,Bold.” That way, if the PDF document is combined with another PDF document later, using the same font, or perhaps a different subset of the same font, one font set will not overwrite the other.
The font information of the new combined document may appear to list the same font more than once, as those unique prefixes are not shown to the viewer when the font information is displayed. You will see only a notation that the fonts are embedded and subset.
Note that some fonts are not licensed for embedding in a PDF document, so you can’t subset characters from those fonts either. If you try to use a font that has this restriction, the Library will return an exception and refuse to embed the font.
Microsoft offers a free utility called the Font Properties Extension that allows you to check for problems like this in fonts before you try to embed them.