Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] TextLayout and GC advanced graphics on Windows (GDI+) buggy?

Hi Stephan, it's me.

The eclipse list not other kind of list:) the guys will tell you in
wrong topos, the right room is newsgroup.(Wawu I not read news so
long)

Maybe it's answer:
1)recompute the bounding according to zoom parameter and
resize of canvas, meanwhile
2)reevaluate the font size in favor of zoom parameter, then modify
style attribute objects, at last,
3)repaint OK.

BTW:
1)Draw2D scaledgraphics.(zoom) method maybe help.
2)You familiar with AGG, so maybe JNI AGG render and just blit result
image to backend buffer, maybe a idea(not so bad:).

Best Regards,
Qinxian

致敬
向雅


2012/7/16 Stephan Aßmus <superstippi@xxxxxx>:
> Hi all,
>
> I am writing an SWT/JFace application involving styled text editing. It is
> based around a modified StyledText widget that supports page layout.
>
> Now I want to add support for zooming the text. The StyledText widget may
> display hundreds of pages of text. The initial layout process is expensive
> and may take several seconds. After that, SpacedTextLayouts are cached as
> needed.
>
> Zooming the text shall be very fast, for example in response to the widget
> becoming wider. The actual text layout (i.e. how words wrap) does not change
> because of zooming. That means I can't have the whole layout redone when the
> zoom changes.
>
> I thought it would be a good idea to set a Transform on the GC used for
> drawing. On GTK, I am having trouble with the selection rendering. It simply
> stops working, even when an identity transform is set. On MacOS X,
> everything works correctly. Both GTK and MacOS versions show some expected
> bugs due to incorrect rounding on my part.
>
> On Windows however, everything is completely garbled. Text is rendered at
> completely unexpected offsets, weirdly clipped, and even some unrelated
> parts of the widget suddenly appear at completely wrong places, even when
> those are drawn at totally different places in the code and even though I
> restore all previous settings of the GC (like setTransform(null) +
> setAdvanced(false)). I have tried to google for problems in this area. All I
> could find is that some bugs did exist for this use-case and that they have
> been fixed.
>
> When digging into the code for TextLayout on Windows, I see that it has two
> pretty much separate code paths for when GDI+ is used versus not. Has this
> simply not been tested for a while and nobody noticed?
>
> Are there any other ideas or recommendations for implementing the zooming
> without relayouting all the text?
>
> Best regards,
> -Stephan
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top