Userlib, set text area font. Without blitzes font system.. need help..

BlitzPlus Forums/BlitzPlus Programming/Userlib, set text area font. Without blitzes font system.. need help..

I am trying to make a function, to set a textarea's font, without using blitz's built-in font system.

Anyone who is more experienced with userlibs n stuff, check below and see what you think. What am I doing wrong ?

;Userlib
;.lib "user32.dll"
;SendMessageBank%(hwnd,msg,wParam,mPAram*):"SendMessageA"

;Code
Global window = CreateWindow("window",400,300,600,300,0,1)
Global logs   = CreateTextArea(0,0,ClientWidth(window),ClientHeight(window),window,0)

Notify Api_SetTextAreaFont(logs,"Blitz")

SetTextAreaText(logs,"aaa"+Chr(10)+"MMM")
WaitEvent()

Function Api_SetTextAreaFont(textarea,name$)
	;change the font of a test area, without using blitz's...
	;..crap font system.
	;
	;Meaning, fonts that dont work with the blitz font system, can now be used in textareas.
	
	;Create blitz struct
	bank = CreateBank(4+4+4+4+4+4+1+1+Len(name$)+1)
	;cbSize
	PokeInt ( bank,  0,  BankSize(bank))
	;dwMask
	PokeInt ( bank,  4,  256 )
	;dwEffects
	PokeInt ( bank,  8,    0 )
	;yHeight
	PokeInt ( bank, 12,   12 )
	;yOffset
	PokeInt ( bank, 16,   12 )
	;crTextColor
	PokeInt ( bank, 20,    0 )
	;bCharSet
	PokeByte( bank, 24,    1 )
	;bPitchAndFamily
	PokeByte( bank, 25,    0 Or 4 )
	;szFaceName
	For i=1 To Len(name$)
		PokeByte(bank,25+i,Asc(Mid$(name$,i,1)))
	Next
	PokeByte(bank,26+Len(names$),0)
	Return SendMessageBank(QueryObject(textarea,1),1024+68,4,bank)
End Function


Btw, there is already a way of loading any font into blitz, but its not ideal.

Try
settextareafont(textarea,requestfont())

This will allow you to pick any font, and it will load absolutly fine, into blitz's textarea gadget. As I said, this is far from helpfull when taken from a programemrs point of view.