Simple way to calculate pixel width of a string?

BlitzMax Forums/BlitzMax Beginners Area/Simple way to calculate pixel width of a string?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I'm trying to calculate the width of a string with default font. I was thinking of assigning a width value for each characters but I have a question:

How to calculate how many of a character you have in a string? Like how many "e" or what not.

I tried doing this:
Local length:Int = Len text:string
width = length*9

hmm or maybe there's an easier way?