# Function Reference

# _WinAPI_EnumFontFamilies

Enumerates all uniquely-named fonts in the system that match the specified font characteristics

#include <WinAPIGdi.au3>
_WinAPI_EnumFontFamilies ( [$hDC = 0 [, $sFaceName = '' [, $iCharSet = $DEFAULT_CHARSET [, $iFontType = 0x07 [, $sPattern = '' [, $bExclude = False]]]]]] )

## Parameters

$hDC | [optional] A handle to the device context from which to enumerate the fonts. If this parameter is 0, the function uses a DC for the application's current screen.
$sFaceName | [optional] The typeface name of the font. If this parameter is an empty string (Default), the function enumerates one font is each available typeface name. If this parameter is a valid typeface name, the function enumerates all fonts with the specified name.
$iCharSet | [optional] The character set. It can be one of the following predefined values. If this parameter is set to $DEFAULT_CHARSET (Default), the function enumerates all uniquely-named fonts in all character sets. If there are two fonts with the same name, only one is enumerated. If this parameter is set to a valid character set value, the function enumerates only fonts in the specified character set. $ANSI_CHARSET $BALTIC_CHARSET $CHINESEBIG5_CHARSET $DEFAULT_CHARSET (Default) $EASTEUROPE_CHARSET $GB2312_CHARSET $GREEK_CHARSET $HANGEUL_CHARSET $MAC_CHARSET $OEM_CHARSET $RUSSIAN_CHARSET $SHIFTJIS_CHARSET $SYMBOL_CHARSET $TURKISH_CHARSET $VIETNAMESE_CHARSET Korean language edition of Windows: $JOHAB_CHARSET Middle East language edition of Windows: $ARABIC_CHARSET $HEBREW_CHARSET Thai language edition of Windows: $THAI_CHARSET
$iFontType | [optional] The type of the fonts to enumerating. This parameter can be 0 (vector fonts), (-1) (all fonts), or any combination of the following values. $DEVICE_FONTTYPE (Default) $RASTER_FONTTYPE (Default) $TRUETYPE_FONTTYPE (Default)
$sPattern | [optional] The pattern string to include (exclude) the fonts in (from) the enumerating. This makes sense only if the typeface name is not specified. This string can contain wildcard characters. The pattern will be ignored if this parameter is omitted or an empty string.
$bExclude | [optional] Specifies whether to use the pattern to exclude the fonts, valid values: True - Exclude the matching fonts. False - Include the matching fonts (Default).

## Return Value

Success: | The 2D array containing the following information: [0][0] - Number of rows in array (n) [0][1] - Unused [n][0] - The typeface name of the font. [n][1] - The style of the font. [n][2] - The unique name of the font. [n][3] - The script, that is, the character set, of the font. [n][4] - The type of the font ($*_FONTTYPE). [n][5] - The pitch, technology, and family of the font (same as in the TEXTMETRIC structure). [n][6] - The character set of the font ($*_CHARSET). [n][7] - The font flags ($NTM_*).
Failure: | Sets the @error flag to non-zero.

## Remarks

The fonts for many East Asian languages have two typeface names: an English name and a localized name.
The function returns the English typeface name if the system locale does not match the language of the font.
When the graphics mode on the device context is set to $GM_ADVANCED and the $DEVICE_FONTTYPE flag is specified,
_WinAPI_EnumFontFamilies() returns a list of Type 1 and OpenType fonts on the system.
When the graphics mode is not set to $GM_ADVANCED, this function returns a list of Type 1, OpenType, and TrueType fonts on the system.

## See Also

Search EnumFontFamiliesEx in MSDN Library.

## Example

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

    ; Enumerates all uniquely-named fonts excluding "@" fonts, which is designed for vertical text, in the ANSI character set
    Local $aData = _WinAPI_EnumFontFamilies(0, '', $ANSI_CHARSET, BitOR($DEVICE_FONTTYPE, $TRUETYPE_FONTTYPE), '@*', 1)
    If Not @error Then
        _ArrayDisplay($aData, '_WinAPI_EnumFontFamilies')
    EndIf

    ; Enumerates all styles of "Arial" font in the ANSI character set
    $aData = _WinAPI_EnumFontFamilies(0, 'Arial', $ANSI_CHARSET)
    If Not @error Then
        _ArrayDisplay($aData, '_WinAPI_EnumFontFamilies')
    EndIf