aWishResigned
01-15-2008, 04:29 PM
Hey guys, I was just wondering, what method (if any) do you use to gauge the length of a dynamic text field?
To give an example, say I had a category object and when you roll your mouse over it, a bar extends the length of the category name. To set the width of this bar, I've taken the average length of a character of text at the font size (about 5-7px) and multiplied it by the total number of characters. Sadly, I don't know how to account for an abundance of extra wide or thin letters and sometimes, the bar comes up short or overshoots the letters.
Does anyone happen to have a better way to do this?
To give an example, say I had a category object and when you roll your mouse over it, a bar extends the length of the category name. To set the width of this bar, I've taken the average length of a character of text at the font size (about 5-7px) and multiplied it by the total number of characters. Sadly, I don't know how to account for an abundance of extra wide or thin letters and sometimes, the bar comes up short or overshoots the letters.
Does anyone happen to have a better way to do this?