Detecting font width

http://stackoverflow.com/questions/378887/how-do-i-calculate-a-strings-width-in-ruby