Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » best way of accessing the size of text between tabs on each line?
best way of accessing the size of text between tabs on each line? [message #504663] Mon, 21 December 2009 18:31 Go to next message
Nick Gravgaard is currently offline Nick Gravgaard
Messages: 6
Registered: July 2009
Junior Member
Hello.

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?

Any advice will be greatly appreciated.

Thanks in advance.
Re: best way of accessing the size of text between tabs on each line? [message #504887 is a reply to message #504663] Wed, 23 December 2009 05:38 Go to previous message
Praveen  is currently offline Praveen
Messages: 86
Registered: July 2009
Member
> 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.
Re: best way of accessing the size of text between tabs on each line? [message #504903 is a reply to message #504887] Wed, 23 December 2009 03:55 Go to previous message
Nick Gravgaard is currently offline Nick Gravgaard
Messages: 6
Registered: July 2009
Junior Member
Thanks for replying Praveen, but that wasn't exactly what I meant.

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.

Any ideas?
Previous Topic:SWT fullscreen
Next Topic:Create a File RTF or PDF whit text formatted and images
Goto Forum:
  


Current Time: Sat Apr 19 21:50:59 EDT 2014

Powered by FUDForum. Page generated in 0.03638 seconds