Fonts

Blitz3D Forums/Blitz3D Beginners Area/Fonts

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Here is a good piece of code for AA fonts, don't mind what it's drawing on the screen.
Const fsize=20
Const imgsize=24
Const offset=2
Const fontname$="Arial"
Const aascale=8
Const fcolorr=255
Const fcolorg=255
Const fcolorb=255
Const bcolorr=0
Const bcolorg=0
Const bcolorb=0
Graphics 640,480,32,1
font=LoadFont(fontname,fsize*aascale)
outimg=CreateImage(imgsize*16,imgsize*16)
midimg=CreateImage(imgsize*aascale,imgsize*aascale)
ClsColor 0,0,0
Color 0,0,255
SetFont font
outdat=WriteFile("charlen.dat")
For a=0 To 255
	SetBuffer ImageBuffer(midimg)
	Cls
	Text offset*aascale,offset*aascale,Chr(a)
	For d=0 To imgsize-1
	For e=0 To imgsize-1
		colval=256*256*256*aascale*aascale
		For b=0 To aascale-1
		For c=0 To aascale-1
			colval=colval+ReadPixel(d*aascale+b,e*aascale+c)
		Next
		Next
		colval=colval/(aascale*aascale)
		c2=256-colval
		WritePixel d+(a Mod 16)*imgsize,e+(a/16)*imgsize,((fcolorr*colval/256)+(bcolorr*c2/256))*256*256+((fcolorg*colval/256)+(bcolorg*c2/256))*256+((fcolorb*colval/256)+(bcolorb*c2/256)),ImageBuffer(outimg)
	Next
	Next
	WriteByte outdat,Len(Chr(a))/aascale
	SetBuffer FrontBuffer()
	Print a
	If KeyHit(1) Then End
Next
SaveImage outimg,"font.bmp"