I'm writing a plugin for Eclipse which needs to know the size of text (in pixels) between each tab character on every line. Can anyone tell me the best way to go about doing this? Is this information already kept somewhere, or do I need to cache it myself every time the user inserts or deletes any text? If I need to do the latter, is there an existing mechanism for attaching data to the associated lines?

> I'm writing a plugin for Eclipse which needs to know the size of text
> (in pixels) between each tab character on every line. Can anyone tell me
> the best way to go about doing this?
The API GC.textExtent() might be helpful in your case.

Basically, every time the user inserts or removes any text I need to be able to quickly do calculations using the size of text (in pixels) between each tab character on many lines. This could take a lot of time as potentially every line in a file may need to be processed. The problem then is not how do I measure the width of a string, but rather is the data I need already cached somewhere, and if not how should I go about caching it myself.