Zoom working strange with text [message #235253] |
Thu, 07 June 2007 13:38  |
Eclipse User |
|
|
|
Originally posted by: mgauthier.trisotech.com
Hi,
I'm having a hard time finding which cause the zooming behavior to act in a
very strange way with all the text elements: only some of them are actually
zoomed in/out. They all use the same font (the default Eclipse font, which
is Tahoma). The figure is zoomed in but the text flow it content doesn't for
most of the figure. If I move some shape around or if I play with the
scrolled bar or with the square region in the Outline, it sometime pick the
right size, but the behavior seems random. The shape are simply figure using
a TextFlow added to a flow page.
By looking in the new thread, I found someone who had the same problem
(thread 'Adding children editparts with zoom does not scale the text')
Unfortunately, the thread didn't lead to a solution. However, Randy Hudson
said "I suspect you might have been calling push/pop in a non-symmetric
way?", but I don't know what he meant by that.
Any clue to where I should start looking?
Thanks
Melanie
Attachment: zoom100.gif
(Size: 3.36KB, Downloaded 193 times)
Attachment: zoom150.gif
(Size: 4.13KB, Downloaded 183 times)
|
|
|
|
|
|
|
Re: Zoom working strange with text [message #236062 is a reply to message #235422] |
Wed, 20 June 2007 10:37  |
Eclipse User |
|
|
|
Originally posted by: mgauthier.trisotech.com
Here's an update about that scaling problem...
My college found a way to patch the problem but couldn't figure what was
causing it in the first place. All the push and pop are properly done, he
checked that in the debugger.
The way he fixed the problem is by setting the font each time the figure
is painted, which allow the first figure - that had always scaled properly
- and all the following to work well with the zoom.
Here is the new paintFigure method of our shape which extends Figure:
graphics.pushState();
try {
if (shape != null) {
shape.paint(graphics);
}
if (label != null) {
Font font = new Font(getFont().getDevice(),
getFont().getFontData());
graphics.setFont(font);
flowPage.paint(graphics);
font.dispose();
}
} finally {
graphics.popState();
}
The line "flowPage.setParent(this);" has also been added to the creation
of the shape to make sure the flowPage has a parent, but it didn't make
any difference.
Note that when a figure is painted alone (when it is selected for
example), it was scaling properly even before the patch. The problem
occurs when more than one figure is painted.
Since our solution seems to go around the problem instead of solving it,
feel free to give your input if you know what could really causing it!
Thanks
Melanie
|
|
|
Powered by
FUDForum. Page generated in 0.04026 seconds