Font Installation and Deletion
An application can use a font to draw text only if that font is either resident on a specified device or installed in the system font table. The font table is an internal array that identifies all nondevice fonts that are available to an application. An application can retrieve the names of fonts currently installed on a device or stored in the internal font table by calling the EnumFontFamilies or ChooseFont functions.
To temporarily install a font, call AddFontResource or AddFontResourceEx. These functions load a font that is stored in a font-resource file. However, this is a temporary installation because after a reboot the font will not be present.
To install a font that will remain after the system is rebooted, use one of the following methods:
- Go to the Control Panel, click the Fonts icon, and select Install New Fonts from the File menu. The font is available to an application even before the reboot. However, in a terminal server situation the font is available for the current session but is not available for other sessions until after a reboot.
- Copy the font into the %windir%\fonts folder. Then, either go to the Control Panel and click the Fonts icon, or call AddFontResource or AddFontResourceEx. The font is available to an application even before the reboot. However, in a terminal server situation the font is available for the current session but is not available for other sessions until after a reboot. If you only copy the font into the %windir%\fonts folder, the font will be available only after the system is rebooted.
When an application finishes using an installed font, it must remove that font by calling the RemoveFontResource function.
Whenever an application calls the functions that add and delete font resources, it should also call the SendMessage function and send a WM_FONTCHANGE message to all top-level windows in the system. This message notifies other applications that the internal font table has been altered by an application that added or removed a font.