Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » GEF diagrams are non-portable(GEF diagrams' appearance very much depends on the screen DPI setting of an operating system)
GEF diagrams are non-portable [message #636207] Fri, 29 October 2010 16:09 Go to next message
Denis Nedelyaev is currently offline Denis NedelyaevFriend
Messages: 2
Registered: October 2010
Junior Member
It seems that GEF diagrams' appearance very much depends on the screen DPI setting of an operating system. So when I change DPI my pretty UML diagram becomes absolutely disfigured. Also if I should send the diagram to an another person, then it is very probable that he will see the diagram which has very little similarity to the diagram which was sent, for he may have a different screen settings.

Thus unfortunately it seems that GEF diagrams are non-portable.

I think it is a bug certainly. And I think a new technique must be developed to allow GEF-based editors to create DPI independent diagrams.

I have not found that it discussed before. Shall I open a new bug report?

I am much interested in resolving it. and I have intention to help by patches when any resolution plan will be outlined by the team.
Re: GEF diagrams are non-portable [message #636249 is a reply to message #636207] Fri, 29 October 2010 20:44 Go to previous messageGo to next message
Jens von Pilgrim is currently offline Jens von PilgrimFriend
Messages: 295
Registered: July 2009
Senior Member
On 29.10.10 18:09, Denis Nedelyaev wrote:
> I think it is a bug certainly. And I think a new technique must be
> developed to allow GEF-based editors to create DPI independent diagrams.

From what I know about GEF, there are only pixels used for almost
everything. However, fonts probably change their actual size in pixels
depending on the screen DPI, I assume text (labels etc) would be your
problem, are they?

> I have not found that it discussed before. Shall I open a new bug report?

There is a mechanism in GMF, called MapMode. See
http://www.eclipse.org/forums/index.php?t=msg&goto=24500 9&
for a (short) discussion (or better a brief description) about that.

Cheers,

Jens
Re: GEF diagrams are non-portable [message #636271 is a reply to message #636249] Sat, 30 October 2010 07:25 Go to previous messageGo to next message
Denis Nedelyaev is currently offline Denis NedelyaevFriend
Messages: 2
Registered: October 2010
Junior Member
> However, fonts probably change their actual size in pixels
depending on the screen DPI, I assume text (labels etc) would be your
problem, are they?

Yes, the problem is in the text rendering.


> There is a mechanism in GMF, called MapMode.

I think, it just converts logical units to device units and can't help to resolve the text rendering problem. Also the problem must be solved at level of GEF, not GMF.

Probable one of best ways to resolve it is to use the Java2D capabilities of off-screen rendering instead of drawing text using SWT directly.
Re: GEF diagrams are non-portable [message #636302 is a reply to message #636271] Sat, 30 October 2010 15:25 Go to previous messageGo to next message
Jens von Pilgrim is currently offline Jens von PilgrimFriend
Messages: 295
Registered: July 2009
Senior Member
On 30.10.10 09:25, Denis Nedelyaev wrote:
>> There is a mechanism in GMF, called MapMode.
>
> I think, it just converts logical units to device units and can't help
> to resolve the text rendering problem.

Actually I'm not really using this feature (I only know it because I
always has problems with it...)

Also the problem must be solved
> at level of GEF, not GMF.

That's probably true. Actually it's Draw2D where this problem has to be
solved.

> Probable one of best ways to resolve it is to use the Java2D
> capabilities of off-screen rendering instead of drawing text using SWT
> directly.

This would be too much work and not really necessary. However, Kristian
has implemented text rendering using Java2D for GEF3D, so if you need
that you may look at that (it's somewhere in Draw3D). Anyway, I figure
it would be sufficient to simply adjust text size to the screen's DPI
settings. That is, you only have to implement your own
org.eclipse.draw2d.Graphics class (by extending one of the existing
implementations) and correct the text size.

Cheers,
Jens
Re: GEF diagrams are non-portable [message #640942 is a reply to message #636207] Tue, 23 November 2010 15:53 Go to previous message
h1055071 is currently offline h1055071Friend
Messages: 335
Registered: July 2009
Senior Member
On 29/10/2010 17:09, Denis Nedelyaev wrote:
> It seems that GEF diagrams' appearance very much depends on the screen
> DPI setting of an operating system. So when I change DPI my pretty UML
> diagram becomes absolutely disfigured. Also if I should send the diagram
> to an another person, then it is very probable that he will see the
> diagram which has very little similarity to the diagram which was sent,
> for he may have a different screen settings.
>
> Thus unfortunately it seems that GEF diagrams are non-portable.
>
> I think it is a bug certainly. And I think a new technique must be
> developed to allow GEF-based editors to create DPI independent diagrams.
>
> I have not found that it discussed before. Shall I open a new bug report?
>
> I am much interested in resolving it. and I have intention to help by
> patches when any resolution plan will be outlined by the team.

I wrote a routine to adjust the font size for GEF figures if on Windows
and the DPI is not the usual 96 DPI. It's basically this:

public static Font getAdjustedWindowsFont(Font font) {
int DPI = font.getDevice().getDPI().y;
if(DPI != 96) {
FontData[] fd = font.getFontData();
double factor = (double)96 / DPI;
fd[0].height *= factor;
}

return font;
}
Previous Topic:Some exception when I opened the gef editor
Next Topic:activating antialiasing for the SCALED_FEEDBACK_LAYER
Goto Forum:
  


Current Time: Mon Dec 22 16:26:02 GMT 2014

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

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