Skip to main content


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 23:31 Go to next message
Nick Gravgaard is currently offline Nick GravgaardFriend
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 10:38 Go to previous message
Praveen  is currently offline Praveen Friend
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 08:55 Go to previous message
Nick Gravgaard is currently offline Nick GravgaardFriend
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: Thu Apr 25 19:14:28 GMT 2024

Powered by FUDForum. Page generated in 0.02645 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top