FontWidth()? Don't make me laugh!
Blitz3D Forums/Blitz3D Programming/FontWidth()? Don't make me laugh!
| ||
Okay, am I the only person who's noticed that FontWidth() returns incorrect values for almost any font other than the Blitz default? It's a serious pain, since I'm trying to create a function that can display text in a wrapped paragraph, regardless of size; anyone know how to get the CORRECT value? |
| ||
Use FastText, and you'll have all those, and some more... |
| ||
; Find width of font (i.e. the widest character in the font). font_width = 0 For n = 32 To 255 w = StringWidth(Chr$(n)) If w > font_width Then font_width = w Next |
| ||
Use Sprite Candy |
| ||
The result is the font width. [edit]Oh, you've edited your post. I'll change the code to make it more obvious, anyway... |
| ||
Thanks, big10p. Hey, _33, what's FastText? |
| ||
and instead of stringheight you use fontheight... i thought fontwidth and stringheight should be taken off the command list some day!? hm whatever... |
| ||
ADAM, FastTExt is a DLL that a dude from Russia created couple months ago, and it's pretty good for handling all sort of text at a pixel precision level. You might want to weed through this thread: http://www.blitzbasic.com/Community/posts.php?topic=68216 |
| ||
Thanks _33... And er... Thanks, dude from Russia... ? ^_ |