Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » Rendering tabs in text with Draw2d
Rendering tabs in text with Draw2d [message #189812] Fri, 29 July 2005 17:09 Go to next message
Josh Knauer is currently offline Josh KnauerFriend
Messages: 12
Registered: July 2009
Junior Member
Hi,

I'm looking into the best way to render tabs with draw2d. Currently \t is
not rendered at all by TextFlow, which is probably the correct behaviour :)
I'm considering a couple of options:

1) Create a new textflow of a fixed width for each tab character and just
use the regular ParagraphTextLayout. The obvious problem with this is that
my tabs will not line up nicely across lines, which is kind of what tabs are
for, no I wouldn't call this a very good solution :) Has anyone tried this
approach before? I'm assuming this will be a quick and easy fix, but am I
missing something that will come back to bite me?

2) Create a new TextLayout that takes tabs into account. This seems like
the correct way to deal with the problem, but will be much more work. Has
anyone done this before?

Are there other options that I'm not aware of? If anyone knows of an
example of someone else rendering tabs with draw2d that I could use as a
reference it would be much appreciated :)

Thanks,

Josh
Re: Rendering tabs in text with Draw2d [message #189843 is a reply to message #189812] Fri, 29 July 2005 18:39 Go to previous message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

It really depends on the behavior you want for the tabs. If you need
center, right, and decimal align, it probably requires a complex solution.
Just jumping to the next multiple of N pixels could be done by some extended
interface on the context which inserts a spacing fragment or something. Or,
maybe you could insert the spacing from the TextFlow by checking how much
space is used in the LineBox.

"Joshua Knauer" <joshua.knauer@businessobjects.com> wrote in message
news:dcdns2$cmm$1@news.eclipse.org...
> Hi,
>
> I'm looking into the best way to render tabs with draw2d. Currently \t is
> not rendered at all by TextFlow, which is probably the correct behaviour
> :)
> I'm considering a couple of options:
>
> 1) Create a new textflow of a fixed width for each tab character and just
> use the regular ParagraphTextLayout. The obvious problem with this is
> that
> my tabs will not line up nicely across lines, which is kind of what tabs
> are
> for, no I wouldn't call this a very good solution :) Has anyone tried
> this
> approach before? I'm assuming this will be a quick and easy fix, but am I
> missing something that will come back to bite me?
>
> 2) Create a new TextLayout that takes tabs into account. This seems like
> the correct way to deal with the problem, but will be much more work. Has
> anyone done this before?
>
> Are there other options that I'm not aware of? If anyone knows of an
> example of someone else rendering tabs with draw2d that I could use as a
> reference it would be much appreciated :)
>
> Thanks,
>
> Josh
>
>
Previous Topic:Creating new paragraphs while editing in the GEF sample text editor
Next Topic:Using the Polyline
Goto Forum:
  


Current Time: Thu Dec 12 20:37:30 GMT 2024

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

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

Back to the top