Fonts from Multiple Resource Files

Typically, a font is contained in a single font resource file. However, the information for some fonts is spread among several files. For example, Type 1 multiple master fonts require two files:

  • .pfm for the font metrics
  • .pfb for the font bits

To add a font from multiple files to the system, use the AddFontResource or AddFontResourceEx functions. The lpszFilename parameter in these functions must point to a string that contains the file names separated by the vertical bar or pipe ( | ). For example, to specify abcxxxxx.pfm and abcxxxxx.pfb for a Type 1 font, use the string "abcxxxxx.pfm | abcxxxxx.pfb."

AddFontResourceEx differs from AddFontResource in that the application calling AddFontResourceEx can specify the font as private to itself or non-enumerable.

To add a font from a memory image, use AddFontResourceEx. This allows an application to use a font that is embedded in a document or a webpage.

To remove a font that came from multiple resource files, call RemoveFontResource or RemoveFontResourceEx, depending on the function used to add the font. You must specify the same flags that were used to add the font. To remove a font that was added from a memory image, use RemoveFontMemResourceEx.

Using a font that comes from multiple font-resource files is identical to using a font from a single resource file.