Funktionreferenz


_WinAPI_GetFontResourceInfo


Retrieves the fontname from the specified font resource file

#include <WinAPIGdi.au3>
_WinAPI_GetFontResourceInfo ( $sFont [, $bForce = False [, $iFlag = Default]] )

Parameter

$sFont String that names a font resource file.
To retrieve a fontname whose information comes from several resource files, they must be separated by a "|" .
For example, abcxxxxx.pfm | abcxxxxx.pfb.
$bForce [optional] Specifies whether adds a file to the font table, valid values:
    True - Forced add the specified file to the system font table and remove it after retrieving the fontname.
    False - Don't add and remove (Default).
$iFlag [optional] An integer value. See _WinAPI_GetFontMemoryResourceInfo() for value definition.

Rückgabewert

Success: The name of the font or Font information according to $iFlag.
Failure: Empty string and sets the @error flag to non-zero, call _WinAPI_GetLastError() to get extended error information.

Bemerkungen

not documented in MSDN

Beispiel

Beispiel 1

#include <Array.au3>
#include <File.au3>
#include <WinAPIGdi.au3>
#include <WinAPIShellEx.au3>

Example()

Func Example()
    Local $aFileList = _FileListToArray(_WinAPI_ShellGetSpecialFolderPath($CSIDL_FONTS), '*.ttf', 1)
    Local $aFontList[UBound($aFileList) - 1][2]

    For $i = 1 To $aFileList[0]
        $aFontList[$i - 1][0] = $aFileList[$i]
        $aFontList[$i - 1][1] = _WinAPI_GetFontResourceInfo($aFileList[$i], 1)
    Next

    _ArrayDisplay($aFontList, '_WinAPI_GetFontResourceInfo')

EndFunc   ;==>Example

Beispiel 2

#include <Array.au3>
#include <File.au3>
#include <WinAPIGdi.au3>
#include <WinAPIShellEx.au3>

Example()

Func Example()
    Local $aFileList = _FileListToArray(_WinAPI_ShellGetSpecialFolderPath($CSIDL_FONTS), '*.ttf', 1)
    Local $aFontList[UBound($aFileList) - 1][2]

    For $i = 1 To $aFileList[0]
        $aFontList[$i - 1][0] = $aFileList[$i]
        $aFontList[$i - 1][1] = _WinAPI_GetFontResourceInfo($aFileList[$i], Default, 1)
    Next

    _ArrayDisplay($aFontList, '_WinAPI_GetFontResourceInfo (Name der Schriftfamilie)')

EndFunc   ;==>Example

Beispiel 3

#include <WinAPIGdi.au3>

Example()

Func Example()
    Local $sFile = "Extras\SF Square Head Bold.ttf"

    ConsoleWrite(_WinAPI_GetFontResourceInfo($sFile, True) & @CRLF)
    ConsoleWrite(@CRLF)

    FontGetInfoFromFile($sFile, 0, "Copyright")
    FontGetInfoFromFile($sFile, 1, "Font Family name")
    FontGetInfoFromFile($sFile, 2, "Font SubFamily name")
    FontGetInfoFromFile($sFile, 3, "Unique font identifier")
    FontGetInfoFromFile($sFile, 4, "Font full name")
    FontGetInfoFromFile($sFile, 5, "Version string")
    FontGetInfoFromFile($sFile, 6, "Postscript name")
    FontGetInfoFromFile($sFile, 7, "Trademark")
    FontGetInfoFromFile($sFile, 8, "Manufacturer Name")
    FontGetInfoFromFile($sFile, 9, "Designer")
    FontGetInfoFromFile($sFile, 10, "Description")
    FontGetInfoFromFile($sFile, 11, "URL Vendor")
    FontGetInfoFromFile($sFile, 16, "Preferred Family (Windows only)")
    FontGetInfoFromFile($sFile, 17, "Preferred SubFamily (Windows only)")
    FontGetInfoFromFile($sFile, 18, "Compatible Full (Mac OS only)")
    FontGetInfoFromFile($sFile, 19, "Sample text")
    FontGetInfoFromFile($sFile, 20, "PostScript CID findfont name")

    FontGetInfoFromFile($sFile, 256, "Font-specific names")

EndFunc   ;==>Example

Func FontGetInfoFromFile($sFile, $n, $sElement)
    Local $s = _WinAPI_GetFontResourceInfo($sFile, Default, $n)
    If Not @error And $s Then ConsoleWrite($sElement & " = " & $s & @CRLF)
EndFunc   ;==>FontGetInfoFromFile