#include once "window9.bi"

Function LoadFont(ByRef sFileName  As USTRING, _
					ByVal iHeight    As long, _
					ByVal corner     As Long,_
					ByVal Bold       As Long,_
					ByVal Italic     As Long,_
					ByVal Underline  As Long,_
					ByVal StrikeOut  As Long) As integer Export
	Bold=iif(Bold,700,400)
	Dim As HDC dc = CreateDC("DISPLAY",0,0,0)
	var size = -MulDiv(iHeight, GetDeviceCaps(dc, LOGPIXELSY), 72)
	DeleteDC(dc)
	#ifdef UNICODE
		Return CInt(CreateFont(size, 0, corner*10, 0, _
		Bold, _
		Italic, _
		Underline, _
		StrikeOut, _
		DEFAULT_CHARSET, _
		OUT_DEFAULT_PRECIS, _
		CLIP_DEFAULT_PRECIS, _
		DEFAULT_QUALITY, _
		DEFAULT_PITCH Or FF_DONTCARE, _
		*sFileName))
	#else	
		Return CInt(CreateFont(size, 0, corner*10, 0, _
		Bold, _
		Italic, _
		Underline, _
		StrikeOut, _
		DEFAULT_CHARSET, _
		OUT_DEFAULT_PRECIS, _
		CLIP_DEFAULT_PRECIS, _
		DEFAULT_QUALITY, _
		DEFAULT_PITCH Or FF_DONTCARE, _
		sFileName))
	#EndIf
End Function

sub FreeFont(iFont as integer)
	
	DeleteObject(Cast(Any Ptr,iFont))
	
End Sub
