Package org.eclipse.draw2d.text
Class FlowUtilities
java.lang.Object
org.eclipse.draw2d.text.FlowUtilities
Utility class for FlowFigures.
- Since:
- 3.4
- 
Field SummaryFields
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected floatgetAverageCharWidth(TextFragmentBox fragment, Font font) Gets the average character width.protected RectanglegetTextLayoutBounds(String s, Font f, int start, int end) protected TextUtilitiesReturns an instance of aTextUtililitiesclass on which text calculations can be performed.protected final voidsetupFragment(TextFragmentBox fragment, Font font, String string) Sets up the fragment width based using the font and string passed in.protected final intwrapFragmentInContext(TextFragmentBox frag, String string, FlowContext context, org.eclipse.draw2d.text.FlowUtilities.LookAhead lookahead, Font font, int wrapping) Sets up a fragment and returns the number of characters consumed from the given String.
- 
Field Details- 
INSTANCEa singleton default instance
 
- 
- 
Constructor Details- 
FlowUtilitiespublic FlowUtilities()
 
- 
- 
Method Details- 
getAverageCharWidthGets the average character width.- Parameters:
- fragment- the supplied TextFragmentBox to use for calculation. if the length is 0 or if the width is or below 0, the average character width is taken from standard font metrics.
- font- the font to use in case the TextFragmentBox conditions above are true.
- Returns:
- the average character width
 
- 
setupFragmentSets up the fragment width based using the font and string passed in.- Parameters:
- fragment- the text fragment whose width will be set
- font- the font to be used in the calculation
- string- the string to be used in the calculation
 
- 
wrapFragmentInContextprotected final int wrapFragmentInContext(TextFragmentBox frag, String string, FlowContext context, org.eclipse.draw2d.text.FlowUtilities.LookAhead lookahead, Font font, int wrapping) Sets up a fragment and returns the number of characters consumed from the given String. An average character width can be provided as a hint for faster calculation. If a fragment's bidi level is set, a TextLayout will be used to calculate the width.- Parameters:
- frag- the TextFragmentBox
- string- the String
- context- the flow context
- font- the Font used for measuring
- wrapping- the word wrap style
- Returns:
- the number of characters that will fit in the given space; can be 0 (eg., when the first character of the given string is a newline)
 
- 
getTextLayoutBounds- See Also:
 
- 
getTextUtilitiesReturns an instance of aTextUtililitiesclass on which text calculations can be performed. Clients may override to customize.- Returns:
- the TextUtililitiesinstance
- Since:
- 3.4
 
 
-