Fonts

Blitz3D Forums/Blitz3D Beginners Area/Fonts

JBR(Posted 2004) [#1]
Hello, new to fonts and have a few questions.

1) I have Windows XP and looking in Control Panel -> fonts I find about 70 fonts. Can I use any of these in Blitz without having to have it in my programs directory?

2) If I download a font from the internet should I put it in the same directory as my program, so that it is available to all people running my prog?

3) Does blitz look in the programs directory first?

4) The fonts look a bit blocky when viewed large, but the same font opened in windows looks much smoother. Is there a way to get 'smooth' fonts in blitz?

Any help appreciated
Marg


jhocking(Posted 2004) [#2]
Using fonts installed on the system does not require the font be in the program's directory, but to ensure you end-user will see the font correctly you should have the font along with your program. That said however bitmap fonts much faster than using the Text command, plus the fonts can have all sorts of cool visual effects and antialiasing in 3D mode. There are a few free font systems to play with (look in GuiLibs in the Toolbox, plus look in the Code Archives) or purchase FONText; I have it and it works great.


_PJ_(Posted 2004) [#3]
Using fonts installed on the system does not require the font be in the program's directory,

---

I use WinXP and a lot of fonts (even standard ones) dont work even though they are installed. As a precaution, I habitually copy every font I may use into my game folder.


eBusiness(Posted 2004) [#4]
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"



Stevie G(Posted 2004) [#5]
WriteByte outdat,Len(Chr(a)/aascale)


Error ... operator cannot be applied to strings,,


eBusiness(Posted 2004) [#6]
Sorry, misplaced bracket. That file contain the width of each character, usefull when you print the text.