; Eukalyptus
; http://www.autoit.de/index.php?page=Thread&postID=147502#post147502
#include "MemFont.au3"

Global $bFont
$sFile = @ScriptDir & '\Ethnocentric.ttf'
$hFile = FileOpen($sFile, 16)
$bFont = FileRead($hFile)
FileClose($hFile)


$hGui = GUICreate("Пример 2", 780, 80)
_GDIPlus_Startup()
$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
GUISetState(@SW_SHOW)

$hCollection = _GDIPlus_NewPrivateFontCollection()
$tFont = DllStructCreate('byte[' & BinaryLen($bFont) & ']')
DllStructSetData($tFont, 1, $bFont)
_GDIPlus_PrivateAddMemoryFont($hCollection, DllStructGetPtr($tFont), DllStructGetSize($tFont))
$hBrush = _GDIPlus_BrushCreateSolid(0xFF000000)
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily = _GDIPlus_CreateFontFamilyFromName('Ethnocentric', $hCollection)
$hFont = _GDIPlus_FontCreate($hFamily, 18, 0)
$tLayout = _GDIPlus_RectFCreate(10, 10, 0, 0)
$aInfo = _GDIPlus_GraphicsMeasureString($hGraphics, 'AutoIt Memory Font Example GDI+ .', $hFont, $tLayout, $hFormat)
_GDIPlus_GraphicsDrawStringEx($hGraphics, 'AutoIt Memory Font Example GDI+ .', $hFont, $aInfo[0], $hFormat, $hBrush)
_GDIPlus_FontDispose($hFont)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_DeletePrivateFontCollection($hCollection)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_BrushDispose($hBrush)

While GUIGetMsg() <> -3
	Sleep(10)
WEnd

GUIDelete($hGui)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()