Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » draw2d: How to get the height of word wrapped text
draw2d: How to get the height of word wrapped text [message #1720438] Mon, 18 January 2016 16:10 Go to next message
Chris Domin is currently offline Chris DominFriend
Messages: 2
Registered: January 2016
Junior Member
So I have the following code:

TextFlow textWrapper = new TextFlow(_title);
FlowPage flowPage = new FlowPage();
flowPage.add(textWrapper);

The standard way of wrapping text. For my project I now need to somehow figure out what the height of this text will be when placed in a container with a fixed width.

This seems simple but I have been unable to figure out how to get this value. A lot of similar threads mention the getPreferedSize() method but this doesn't seem to return the proper height. Any suggestions would be helpful.
Re: draw2d: How to get the height of word wrapped text [message #1720531 is a reply to message #1720438] Tue, 19 January 2016 08:23 Go to previous message
Alexander Nyssen is currently offline Alexander NyssenFriend
Messages: 235
Registered: July 2009
Location: L√ľnen
Senior Member
I think you may do something like FlowUtilities.getTextLayoutBounds(String, Font, int, int), just that you will need to set the width on the internally used TextLayout to reflect the wrapping.
Previous Topic:Docking palette of widgets within the editor
Next Topic:DirectedGraph: nodes out of order
Goto Forum:
  


Current Time: Sun Nov 18 16:04:56 GMT 2018

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

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

Back to the top