|
Author |
Topic: string pixel length (Read 965 times) |
|
eskimoblood
|
string pixel length
« on: Mar 18th, 2005, 1:36pm » |
|
Is there a easy way to calculate the pixel length of a string.
|
|
|
|
toxi
|
Re: string pixel length
« Reply #1 on: Mar 18th, 2005, 2:18pm » |
|
erm... do you mean the pixel width of a string... a) at a certain font size in 2D (no scale, no rotation) b) like option a) but with transformation c) at a certain font size in 3D do you want to use the default text engine or FastText (2d only) if the latter, you can use a function from the version of the class i've posted over here... the method is suitable called "getPixelWidth()" the other options are more involved and will probably be require some hacks, but really we'll need more context from you first...
|
http://toxi.co.uk/
|
|
|
eskimoblood
|
Re: string pixel length
« Reply #2 on: Mar 18th, 2005, 4:46pm » |
|
I wanna draw a string in a rect, and therefor I need the width of the string. I use the default text engine because I'll need some letters like üöä.
|
|
|
|
fry
|
Re: string pixel length
« Reply #3 on: Mar 18th, 2005, 6:12pm » |
|
font.width() is what you're looking for: BFont font = loadFont("Arial-48.vlw"); float size = font.width("potato");
|
|
|
|
eskimoblood
|
Re: string pixel length
« Reply #4 on: Mar 19th, 2005, 2:01pm » |
|
Cool, that's it.
|
|
|
|
|