paintFigure and Display question [message #140377] |
Mon, 28 June 2004 10:30 |
steven melzer Messages: 38 Registered: July 2009 |
Member |
|
|
i would like to use a TextLayout in place of the TextFlow/FlowPage. My
reason is to support multiple fonts. so i wrote a TextFigure with the
following paintFigure method:
protected void paintFigure(Graphics graphics) {
super.paintFigure(graphics);
GC gc = new GC(Display.getCurrent());
Rectangle spAbs = this.getClientArea().getCopy();
Point p1 = control.toDisplay(spAbs.x, spAbs.y);
textLayout.draw(gc, p1.x, p1.y);
}
what happens is when you add text from the TextCellEditor, nothing is
displayed on the figure. but if you grab the figure's handle and start
moving it around, the text is displayed where it should appear when i am
dragging the figure around. so, i assume the "figure" is overlaying on
top of the text.
what exactly is overlaying my text? and is there a better approach to
doing this?
also, i do not believe scrolling will work with my current approach, but
passing in the Viewport, calling getViewLocation, and translating the
point should fix that i think. thoughts?
if this whole approach is wrong, i can always subclass the TextFlow and
use the TextStyles and positions from the TextLayout class to add multiple
font support to the TextFlow, but i believe this will make the whole text
wrapping logic go crazy.
thanks,
steve
|
|
|
Powered by
FUDForum. Page generated in 0.04337 seconds