Function Reference


Retrieves the unique name of the font based on its typeface name, character set, and style

#include <WinAPIGdi.au3>
_WinAPI_GetFontName ( $sFaceName [, $iStyle = 0 [, $iCharSet = 1]] )


$sFaceName The typeface name of the font (not including style). For example, "Arial", "Tahoma", etc.
$iStyle [optional] The style of the font.
It can be one or more of the following values:
$iCharSet [optional] The character set.
It can be one of the following values:
    $DEFAULT_CHARSET (Default)
Korean language edition of Windows:
Middle East language edition of Windows:
Thai language edition of Windows:

Return Value

Success: The unique name of the font.
Failure: Empty string and sets the @error flag to non-zero.


This function can be used to get the appropriate font name on different language versions of the OS.
For example, in the english version you can write "Arial Bold", however, for the russian version this font must be specified as "Arial Ïîëóæèðíûé".
Nevertheless, most fonts use only english names and must be specified explicitly.


#include <FontConstants.au3>
#include <WinAPIGdi.au3>

Local Const $sFaceName = 'Arial'

ConsoleWrite($sFaceName & ' Regular => ' & _WinAPI_GetFontName($sFaceName, $FS_REGULAR) & @CRLF)
ConsoleWrite($sFaceName & ' Bold => ' & _WinAPI_GetFontName($sFaceName, $FS_BOLD) & @CRLF)
ConsoleWrite($sFaceName & ' Italic => ' & _WinAPI_GetFontName($sFaceName, $FS_ITALIC) & @CRLF)
ConsoleWrite($sFaceName & ' Bold Italic => ' & _WinAPI_GetFontName($sFaceName, BitOR($FS_BOLD, $FS_ITALIC)) & @CRLF)