FontWidth()? Don't make me laugh!

Blitz3D Forums/Blitz3D Programming/FontWidth()? Don't make me laugh!

Adam Novagen(Posted 2007) [#1]
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?


_33(Posted 2007) [#2]
Use FastText, and you'll have all those, and some more...


big10p(Posted 2007) [#3]
; 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



Boiled Sweets(Posted 2007) [#4]
Use Sprite Candy


big10p(Posted 2007) [#5]
The result is the font width.

[edit]Oh, you've edited your post. I'll change the code to make it more obvious, anyway...


Adam Novagen(Posted 2007) [#6]
Thanks, big10p. Hey, _33, what's FastText?


bytecode77(Posted 2007) [#7]
and instead of stringheight you use fontheight...

i thought fontwidth and stringheight should be taken off the command list some day!?

hm whatever...


_33(Posted 2007) [#8]
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


Adam Novagen(Posted 2007) [#9]
Thanks _33... And er... Thanks, dude from Russia... ?

^_