InstallShield 2016 » InstallScript Language Reference
The RegisterFontResource function registers or unregisters the font resource specified by szFileName. This function is called by the default code for the OnInstalledFontFile and OnUninstallingFontFile event handler functions.
Syntax
RegisterFontResource ( szFileName, svFontTitle, bRegister, nOptions );
Parameters
Parameter |
Description |
|||||||||
szFileName |
Specifies the fully qualified file name of the font file (.fnt, .fon, .fot, .mmm, .otf, .pfb, .pfm, .ttc, or .ttf file) to be registered or unregistered. Typically you would install a font file to FOLDER_FONTS. Only a font file that exists on the target system can be registered, and you must unregister a font file before you remove it from the system. |
|||||||||
svFontTitle |
This parameter must be a variable name and not a literal value. When RegisterFontResource is called, this parameter specifies the title for the font, if its value is not a null string (""); when RegisterFontResource returns, this parameter contains the title that was used when registering or unregistering the font file. If the font file being registered or unregistered is a TrueType font file, you can specify in this parameter a string variable whose value is a null string. In this case RegisterFontResource attempts to get the title by internally calling GetTrueTypeFontFileInfo; if this fails, the file name of the font file is used as the title. If the REGFONT_OPTION_DONTUPDATEREGISTRY option is specified in this function's fourth argument, svFontTitle is ignored. |
|||||||||
bRegister |
Specifies whether to register the font resource (TRUE) or unregister the font resource (FALSE). |
|||||||||
nOptions |
Specifies various options. Pass one of the following constants in this parameter, or combine these constants using the OR operator (|):
PostMessage( HWND_BROADCAST, WM_FONTCHANGE, 0, 0 ); You would typically use this flag if you are calling RegisterFontResource multiple times to update multiple fonts and then calling PostMessage.
|
Return Values
Return Value |
Description |
>= ISERR_SUCCESS |
Indicates that the function successfully registered or unregistered the font. |
< ISERR_SUCCESS |
Indicates that the function was unable to register or unregister the font. |
Additional Information
• | Font information is written to HKEY_LOCAL_MACHINE in all cases, so typically in order to install a font the end user must have administrator privileges on the system. |
• | The function calls PostMessage instead of SendMessage to send the WM_FONTCHANGE message. This is because SendMessage (when used with HWND_BROADCAST) waits for all open windows to respond to the message before returning, which could cause the installation to freeze if an open window on the system fails to respond to the message. Since the function calls PostMessage, the function could return before Windows has processed the message and released the font from the font cache; so when using this function to uninstall fonts, it is recommended that you wait a few seconds (by calling Delay) before removing the font file. |
• | If you call this function in a feature event or a file install event (such as OnInstallingFile or OnInstalledFile) the font registration is associated with the corresponding feature and the font is automatically unregistered before the file or feature is uninstalled. |
See Also
InstallShield 2016 Help LibraryMay 2017 |
Copyright Information | Flexera Software |