Using Bitmapped fonts

BlitzMax Forums/BlitzMax Programming/Using Bitmapped fonts

Triforce Guardian(Posted 2006) [#1]
I was wondering how to use bitmapped fonts. I would perfer those over ttf fonts.


Grisu(Posted 2006) [#2]
From what I know bmx already uses bmpfonts.
Each time you load a font, a bmp of it is created.
So you won't gain any increase of runtime speed from it.


Scott Shaver(Posted 2006) [#3]
My bitmap font module can be found here

http://www.scottshaver2000.com/blitz/bmaxmods/sas.mod.zip

it has the source code.

Strict 
Framework BRL.GlMax2D
Import SAS.bitmapfont
Graphics 800,600,32

Incbin "34-small.png"
Global scrollerFont:BitmapFont = BitmapFont.Create(24, 24, "incbin::34-small", ".png", 0, 0, 0, 1)

Global scrollerFontControl:BitmapFontControl = BitmapFontControl.Create()
scrollerFontControl.sineSmooth=0

HideMouse()

While Not KeyHit(KEY_ESCAPE)
	Cls
scrollerFont.DrawString(scrollerFontControl, 0, 0, "Hello there")
	Flip
Wend





An example of it in use can be found here:

http://www.scottshaver2000.com/blitz/demo5/demo5.zip


ImaginaryHuman(Posted 2006) [#4]
Max loads truetype fonts and renders them into a pixmap before uploading (afaik). So you actually draw a bitmap. Would be nice(r) to have ttf fonts load and be turned into polygons for realtime scaling/rotations/distortions.


popcade(Posted 2006) [#5]
@Scott:

Your modules are really great!, big thanks.


Scott Shaver(Posted 2006) [#6]
no problem :)


Triforce Guardian(Posted 2006) [#7]
thank you! this really helped!


Grey Alien(Posted 2006) [#8]
so basically you only need a bitmap font function if you don't want to use ttf fonts or you need some extra fancy function I guess.