Skip to Content

How do I subset a font using only the Adobe PDF Library?

Estimated Reading Time: 1 Minutes

In the Adobe Samples directory, the FontEmbed sample illustrates both embedding and subsetting a font.

The difficult part is creating the font. You must use one of the font creation methods that include the PDEFontCreateFlags:

  1. PDEFontCreateFromSysFont()
  2. PDEFontCreateFromSysFontAndEncoding()
  3. PDEFontCreatefromSysFontWithParams

The Flags kPDEFontCreateEmbedded and kPDEFontWillSubset must be on. You cannot, of course, subset if you do not embed. A font must be embedded in the PDF document first, and then it will be subset, where characters that are not needed are removed from that embedded font.

After all the type is set using this font, you must call PDEFontSubsetNow() to create the subset font, and PDEFontEmbedNow() to insert the font subset into the document.

If you are in an environment where some fonts may need to be embedded and subset, and others not, you may use the method PDEFontGetCreateNeedFlags() to test whether a given font needs to be subset or embedded.

How do I subset a font using only the Adobe PDF Library?
  • COMMENT

  • Get notified when new articles are added to the knowledge base.