Other way to draw text using font size?

BlitzMax Forums/BlitzMax Programming/Other way to draw text using font size?

orgos(Posted 2008) [#1]
I see in the help to draw some text the function is drawtext, but if i want to draw some text in any size I must load the fontimage in that size, so if i want to use some font and draw some text in various size the only way is loading each imageFont in each size?

Exist other way to draw text in many font size?


Brucey(Posted 2008) [#2]
What happens is, the font file is loaded and glyphs cached at the requested size. Each font object is designed to work on a fixed size, otherwise the cached glyphs would need to be recreated on each size change - breaking the efficiency of the cache.

One option - to save you loading a file each time - is to IncBin the font file, so that it is retrieved from RAM instead.

Either that, or you could (you have all source available) create your own Font renderer and use that instead.


dmaz(Posted 2008) [#3]
just use SetScale before drawtext. generally the result is good enough if you load it at a larger size and adjust down.

all the gfx commands work with drawtext...


Grey Alien(Posted 2008) [#4]
warning: I've found drawtext to be very slow and affect the framerate badly. I suggest you writ a bitmap font type instead.


orgos(Posted 2008) [#5]
Thanks Grey Alien I consider that in first case.