From: Jeremy Bopp Date: 2011-12-08T05:34:03+09:00 Subject: Re: Truncation using Pixels On 12/07/2011 12:40 PM, Dhanuja B. wrote: > Is there any method available to truncate string based on Pixels in > Ruby? I'm not aware of any built-in method to do this, and I suspect it will depend greatly on how exactly you're trying to render the string to the display device. For instance font selection and point size are probably the biggest factors that determine the rendered representation of a string, and those are generally variable. The tools available to you to figure out the string size in pixels almost certainly varies depending on the library or framework you're using to handle the actual work. So, first of all, how do you plan to render your strings, disregarding the overall length in pixels? Are you going to have them inserted into a web page that is viewed by a browser, or are you using something like GTK, QT, etc. as a conventional graphical user interface, or are you doing something else? Can you provide an example of truncating strings the way you need in another language? -Jeremy