Problems with calculated text size [message #1072662] |
Tue, 23 July 2013 04:21  |
Eclipse User |
|
|
|
Hi everybody,
I'm trying to layout some diagram and I have some problems with calculating the size of a text. Perhaps someone can enlighten me.
Concretely, I'm trying to display a rectangle and some text under it (you can see the result in the appended screenshot). Both elements are contained in an invisible rectangle. Now I've some problems with calculating the size of the text. I googled and found several forum threads mentioning calculateSize and so forth. I created the following code:
final Shape rectShape = peService.createShape(containerShape, true);
final RoundedRectangle rect = gaService.createRoundedRectangle(rectShape, 40, 40);
MultiText text = gaService.createMultiText(nameShape, businessObject.getName());
text.setHorizontalAlignment(Orientation.ALIGNMENT_CENTER);
final Font textFont = gaService.manageDefaultFont(peService.getDiagramForShape(containerShape));
final IDimension dimension = GraphitiUi.getUiLayoutService().calculateTextSize(text.getValue(), textFont);
... layouting ...
My problem is that I do not understand the unit of the text dimension. The result is width=24 and height=9 but when I use it for the size of the text I can only see a very small part of it. If I multiply both values by 2 everything looks fine. Can someone explain the?
Regards,
Bernhard
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04527 seconds