Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » TextFlow and FlowPage producing ugly-cropped texts
TextFlow and FlowPage producing ugly-cropped texts [message #486943] Mon, 21 September 2009 05:09 Go to next message
Johannes Michler is currently offline Johannes Michler
Messages: 21
Registered: July 2009
Junior Member
Hi,

where implementing a tool using GEF. For drawing some labels, we've
implemented the following Figure:
public class PetriNetLabelFigure extends Figure {

private TextFlow textFlow;
private FlowPage flowPage;

public PetriNetLabelFigure() {
setBackgroundColor(ColorConstants.tooltipBackground);
setForegroundColor(ColorConstants.tooltipForeground);
flowPage = new FlowPage();
textFlow = new TextFlow();
textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
ParagraphTextLayout.WORD_WRAP_SOFT));
flowPage.add(textFlow);
setLayoutManager(new StackLayout());
add(flowPage);
}
....


This works so far, except for 2 problems:
1) While zooming, with some text-lengths in the flowPage (we're setting
these using textFlow.setText) and some zoom-levels, the last character of
the text gets truncated. I consider this a bug, so we posted this under
https://bugs.eclipse.org/bugs/show_bug.cgi?id=288745
2) When changing the windows font-size from 96 dpi to 120 dpi and opening my
drawings, the text gets truncated very ugly. Is there a way to make TextFlow
and FlowPage independent of the windows "font-size" (set unter
system-display-advanced) ? This problems makes GEF nearly unusable in our
context, since having different dpi-settings is commonly used here.


Is there a better way to format a label with automatic word-wrap? It would
be great if our drawings would look the same when getting openend again. Can
I do some manual scaling? Any hints?
http://dev.eclipse.org/newslists/news.eclipse.platform.swt/m sg23152.html
seems to have the same problems, but there is no solution given over there
:-(


-orgler
Re: TextFlow and FlowPage producing ugly-cropped texts [message #487123 is a reply to message #486943] Mon, 21 September 2009 22:52 Go to previous messageGo to next message
Eclipse User
Originally posted by: robinkirk.bigfoot.com

Johannes wrote:
Hey, I had the same issue, i got around it by sublassing TextFlow and
overriding paintFigure(), and increasing the clip area based on the zoom
level, using graphics.setClip() and graphics.getAbsoluteScale(). The
text will paint outside the figures bounds, but it achieved the desired
result and text is not trimmed. I would also like a correct solution if
anyone has one.



> Hi,
>
> where implementing a tool using GEF. For drawing some labels, we've
> implemented the following Figure:
> public class PetriNetLabelFigure extends Figure {
>
> private TextFlow textFlow;
> private FlowPage flowPage;
>
> public PetriNetLabelFigure() {
> setBackgroundColor(ColorConstants.tooltipBackground);
> setForegroundColor(ColorConstants.tooltipForeground);
> flowPage = new FlowPage();
> textFlow = new TextFlow();
> textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
> ParagraphTextLayout.WORD_WRAP_SOFT));
> flowPage.add(textFlow);
> setLayoutManager(new StackLayout());
> add(flowPage);
> }
> ...
>
>
> This works so far, except for 2 problems:
> 1) While zooming, with some text-lengths in the flowPage (we're setting
> these using textFlow.setText) and some zoom-levels, the last character
> of the text gets truncated. I consider this a bug, so we posted this
> under https://bugs.eclipse.org/bugs/show_bug.cgi?id=288745
> 2) When changing the windows font-size from 96 dpi to 120 dpi and
> opening my drawings, the text gets truncated very ugly. Is there a way
> to make TextFlow and FlowPage independent of the windows "font-size"
> (set unter system-display-advanced) ? This problems makes GEF nearly
> unusable in our context, since having different dpi-settings is commonly
> used here.
>
>
> Is there a better way to format a label with automatic word-wrap? It
> would be great if our drawings would look the same when getting openend
> again. Can I do some manual scaling? Any hints?
> http://dev.eclipse.org/newslists/news.eclipse.platform.swt/m sg23152.html
> seems to have the same problems, but there is no solution given over
> there :-(
>
>
> -orgler
Re: TextFlow and FlowPage producing ugly-cropped texts [message #487473 is a reply to message #487123] Wed, 23 September 2009 07:30 Go to previous messageGo to next message
Johannes Michler is currently offline Johannes Michler
Messages: 21
Registered: July 2009
Junior Member
Hi robin,

thanks for your quick reply. Could you provide me some code? I don't really
understand the code in the paintFigure() method so I'm running into problems
when trying to implement your hints :-(

-Johannes


"robin kirk" <robinkirk@bigfoot.com> schrieb im Newsbeitrag
news:h99e5j$3fe$1@build.eclipse.org...
> Johannes wrote:
> Hey, I had the same issue, i got around it by sublassing TextFlow and
> overriding paintFigure(), and increasing the clip area based on the zoom
> level, using graphics.setClip() and graphics.getAbsoluteScale(). The text
> will paint outside the figures bounds, but it achieved the desired result
> and text is not trimmed. I would also like a correct solution if anyone
> has one.
>
>
>
>> Hi,
>>
>> where implementing a tool using GEF. For drawing some labels, we've
>> implemented the following Figure:
>> public class PetriNetLabelFigure extends Figure {
>>
>> private TextFlow textFlow;
>> private FlowPage flowPage;
>>
>> public PetriNetLabelFigure() {
>> setBackgroundColor(ColorConstants.tooltipBackground);
>> setForegroundColor(ColorConstants.tooltipForeground);
>> flowPage = new FlowPage();
>> textFlow = new TextFlow();
>> textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
>> ParagraphTextLayout.WORD_WRAP_SOFT));
>> flowPage.add(textFlow);
>> setLayoutManager(new StackLayout());
>> add(flowPage);
>> }
>> ...
>>
>>
>> This works so far, except for 2 problems:
>> 1) While zooming, with some text-lengths in the flowPage (we're setting
>> these using textFlow.setText) and some zoom-levels, the last character of
>> the text gets truncated. I consider this a bug, so we posted this under
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=288745
>> 2) When changing the windows font-size from 96 dpi to 120 dpi and opening
>> my drawings, the text gets truncated very ugly. Is there a way to make
>> TextFlow and FlowPage independent of the windows "font-size" (set unter
>> system-display-advanced) ? This problems makes GEF nearly unusable in our
>> context, since having different dpi-settings is commonly used here.
>>
>>
>> Is there a better way to format a label with automatic word-wrap? It
>> would be great if our drawings would look the same when getting openend
>> again. Can I do some manual scaling? Any hints?
>> http://dev.eclipse.org/newslists/news.eclipse.platform.swt/m sg23152.html
>> seems to have the same problems, but there is no solution given over
>> there :-(
>>
>>
>> -orgler
Re: TextFlow and FlowPage producing ugly-cropped texts [message #487928 is a reply to message #487473] Thu, 24 September 2009 17:20 Go to previous message
Eclipse User
Originally posted by: robinkirk.bigfoot.com

Johannes wrote:
> Hi robin,
>
> thanks for your quick reply. Could you provide me some code? I don't
> really understand the code in the paintFigure() method so I'm running
> into problems when trying to implement your hints :-(

protected void paintFigure(Graphics graphics) {
//set the larger clip region

graphics.setClip(getBounds().getCopy().resize((int)(graphics .getAbsoluteScale()*3),0));

super.paintFigure(graphics);

}


>
> -Johannes
>
>
> "robin kirk" <robinkirk@bigfoot.com> schrieb im Newsbeitrag
> news:h99e5j$3fe$1@build.eclipse.org...
>> Johannes wrote:
>> Hey, I had the same issue, i got around it by sublassing TextFlow and
>> overriding paintFigure(), and increasing the clip area based on the
>> zoom level, using graphics.setClip() and graphics.getAbsoluteScale().
>> The text will paint outside the figures bounds, but it achieved the
>> desired result and text is not trimmed. I would also like a correct
>> solution if anyone has one.
>>
>>
>>
>>> Hi,
>>>
>>> where implementing a tool using GEF. For drawing some labels, we've
>>> implemented the following Figure:
>>> public class PetriNetLabelFigure extends Figure {
>>>
>>> private TextFlow textFlow;
>>> private FlowPage flowPage;
>>>
>>> public PetriNetLabelFigure() {
>>> setBackgroundColor(ColorConstants.tooltipBackground);
>>> setForegroundColor(ColorConstants.tooltipForeground);
>>> flowPage = new FlowPage();
>>> textFlow = new TextFlow();
>>> textFlow.setLayoutManager(new ParagraphTextLayout(textFlow,
>>> ParagraphTextLayout.WORD_WRAP_SOFT));
>>> flowPage.add(textFlow);
>>> setLayoutManager(new StackLayout());
>>> add(flowPage);
>>> }
>>> ...
>>>
>>>
>>> This works so far, except for 2 problems:
>>> 1) While zooming, with some text-lengths in the flowPage (we're
>>> setting these using textFlow.setText) and some zoom-levels, the last
>>> character of the text gets truncated. I consider this a bug, so we
>>> posted this under https://bugs.eclipse.org/bugs/show_bug.cgi?id=288745
>>> 2) When changing the windows font-size from 96 dpi to 120 dpi and
>>> opening my drawings, the text gets truncated very ugly. Is there a
>>> way to make TextFlow and FlowPage independent of the windows
>>> "font-size" (set unter system-display-advanced) ? This problems makes
>>> GEF nearly unusable in our context, since having different
>>> dpi-settings is commonly used here.
>>>
>>>
>>> Is there a better way to format a label with automatic word-wrap? It
>>> would be great if our drawings would look the same when getting
>>> openend again. Can I do some manual scaling? Any hints?
>>> http://dev.eclipse.org/newslists/news.eclipse.platform.swt/m sg23152.html
>>> seems to have the same problems, but there is no solution given over
>>> there :-(
>>>
>>>
>>> -orgler
>
Previous Topic:GEF png fails when WebSphere run as a Windows Service
Next Topic:[Announce] GEF 3.5.1 is available
Goto Forum:
  


Current Time: Wed Apr 16 00:56:24 EDT 2014

Powered by FUDForum. Page generated in 0.01705 seconds