Adds the font resource from the specified file to the system font table
#include <WinAPIGdi.au3>
_WinAPI_AddFontResourceEx ( $sFont [, $iFlag = 0 [, $bNotify = False]] )
$sFont | String that contains a valid font file name. This parameter can specify any of the following files: .fon - Font resource file. .fnt - Raw bitmap font file. .ttf - Raw TrueType file. .ttc - East Asian Windows: TrueType font collection. .fot - TrueType resource file. .otf - PostScript OpenType font. .mmm - Multiple master Type1 font resource file. It must be used with .pfm and .pfb files. .pfb - Type 1 font bits file. It is used with a .pfm file. .pfm - Type 1 font metrics file. It is used with a .pfb file. To add a font whose information comes from several resource files, they must be separated by a "|". For example, abcxxxxx.pfm|abcxxxxx.pfb. |
$iFlag | [optional] The characteristics of the font to be added to the system. This parameter can be one of the following values. $FR_PRIVATE $FR_NOT_ENUM |
$bNotify | [optional] Specifies whether sends a WM_FONTCHANGE message, valid values: True - Send the WM_FONTCHANGE message to all top-level windows after changing the pool of font resources. False - Don't send (Default). |
Success: | The value that specifies the number of fonts added. |
Failure: | 0. |
This function installs the font only for the current session. When the system restarts, the font will not be present.
To have the font installed even after restarting the system, the font must be listed in the registry.
Search AddFontResourceEx in MSDN Library.
#include <APIGdiConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WinAPIGdi.au3>
_WinAPI_AddFontResourceEx(@ScriptDir & '\Extras\SF Square Head Bold.ttf', $FR_PRIVATE)
GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 400, 100)
GUICtrlCreateLabel('Simple Text', 10, 25, 380, 50, $SS_CENTER)
GUICtrlSetFont(-1, 38, -1, -1, 'SF Square Head Bold')
GUICtrlSetColor(-1, 0xF06000)
GUISetState(@SW_SHOW)
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE