There are some decent functions out there that will truncate a string on a word boundary. Those are helpful.
it's not impossible to truncate based on pixels.
I say it's possible but really you don't want to do that. It's nasty, and will do weird things on your page because the truncation of long strings can take a second or more. A couple of years ago I built a MooTools class that did pixel-perfect truncation, and tried it out on our website... the effect was so awful we trashed it and went with a simple character limit instead.