public class FlowUtilities
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static FlowUtilities |
INSTANCE
a singleton default instance
|
Constructor and Description |
---|
FlowUtilities() |
Modifier and Type | Method and Description |
---|---|
protected float |
getAverageCharWidth(TextFragmentBox fragment,
Font font)
Gets the average character width.
|
protected Rectangle |
getTextLayoutBounds(java.lang.String s,
Font f,
int start,
int end) |
protected TextUtilities |
getTextUtilities()
Returns an instance of a
TextUtililities class on which text
calculations can be performed. |
protected void |
setupFragment(TextFragmentBox fragment,
Font font,
java.lang.String string)
Sets up the fragment width based using the font and string passed in.
|
protected int |
wrapFragmentInContext(TextFragmentBox frag,
java.lang.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.
|
public static FlowUtilities INSTANCE
protected float getAverageCharWidth(TextFragmentBox fragment, Font font)
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.protected final void setupFragment(TextFragmentBox fragment, Font font, java.lang.String string)
fragment
- the text fragment whose width will be setfont
- the font to be used in the calculationstring
- the string to be used in the calculationprotected final int wrapFragmentInContext(TextFragmentBox frag, java.lang.String string, FlowContext context, org.eclipse.draw2d.text.FlowUtilities.LookAhead lookahead, Font font, int wrapping)
frag
- the TextFragmentBoxstring
- the Stringfont
- the Font used for measuringcontext
- the flow contextwrapping
- the word wrap styleprotected Rectangle getTextLayoutBounds(java.lang.String s, Font f, int start, int end)
TextLayout#getBounds()
protected TextUtilities getTextUtilities()
TextUtililities
class on which text
calculations can be performed. Clients may override to customize.TextUtililities
instanceCopyright (c) IBM Corp. and others 2000, 2011. All Rights Reserved.