|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.tensegrity.graphics.swt.SWTTextOperations
The SWTTextOperations class is the implementation of the
TextOperations interface for the SWT toolkit.
An instance of this class has to be registered on the GraphicConfiguration
class in order to inform the graphics API that it is running in the
context of the SWT toolkit.
Notice that due to limitations on the SWT ,
the following method currently have an empty implementation:
Device
GraphicConfiguration.registerTextOperationsInstance(TextOperations)| Field Summary |
| Fields inherited from interface com.tensegrity.graphics.TextOperations |
HORIZONTAL_ALIGNMENT_INDEX, LINETYPE_STRIKETHROUGH, LINETYPE_UNDERLINE, VERTICAL_ALIGNMENT_INDEX |
| Constructor Summary | |
SWTTextOperations()
Default constructor. |
|
| Method Summary | |
BoundingBox |
computeBoundingBox(java.lang.Object[] fontdata,
BoundingBox bbox,
Transform2D xform,
java.lang.String text,
int[] alignments,
double textScaleX,
double textScaleY)
|
BoundingBox |
computeBoundingBox(java.lang.Object[] fontdata,
BoundingBox bbox,
Transform2D xform,
java.lang.String text,
int[] alignments,
double textScaleX,
double textScaleY,
boolean mutliline)
|
double |
computeHeight(FontFormat font,
Transform2D xform,
java.lang.String text)
Computes the height of the text given by text when using
the FontFormat given by font and the
transformation given by xform. |
double |
computeHeight(FontFormat font,
Transform2D xform,
java.lang.String text,
boolean multiline)
Computes the height of the text given by text when using
the FontFormat given by font and the
transformation given by xform. |
double |
computeHeight(java.lang.Object[] fontdata,
Transform2D xform,
java.lang.String text)
Computes the height of the text given by text when using
the FontFormat rendering data given by fontdata
and the transformation given by xform. |
double |
computeHeight(java.lang.Object[] fontdata,
Transform2D xform,
java.lang.String text,
boolean multiline)
Computes the height of the text given by text when using
the FontFormat rendering data given by fontdata
and the transformation given by xform. |
Coordinate[] |
computeLineCoordinates(FontFormat font,
Transform2D xform,
java.lang.String text,
int lineType)
Computes the start and end coordinates of a line decorating a text given by text when using the FontFormat given by
font and the transformation given by xform. |
Coordinate[] |
computeLineCoordinates(java.lang.Object[] fontData,
Transform2D xform,
java.lang.String text,
int lineType)
Computes the start and end coordinates of a line decorating a text given by text when using the FontFormat given by
font and the transformation given by xform. |
Coordinate |
computeOrigin(java.lang.Object[] fontdata,
BoundingBox bbox,
Transform2D xform,
java.lang.String text,
int[] alignments,
double[] lineScales)
Computes the origin for the text given by text within the
BoundingBox given by bbox with respect to the
alignments given by alignments, the FontFormat
rendering data given by fontdata and the transformation
given by xform. |
Coordinate |
computeOrigin(java.lang.Object[] fontdata,
BoundingBox bbox,
Transform2D xform,
java.lang.String text,
int[] alignments,
double[] lineScales,
boolean multiline)
Computes the origin for the text given by text within the
BoundingBox given by bbox with respect to the
alignments given by alignments, the FontFormat
rendering data given by fontdata and the transformation
given by xform. |
Coordinate |
computeOrigin(java.lang.Object[] fontdata,
BoundingBox bbox,
Transform2D xform,
java.lang.String text,
int[] alignments,
double textScaleX,
double textScaleY)
Computes the origin for the text given by text within the
BoundingBox given by bbox with respect to the
alignments given by alignments, the FontFormat
rendering data given by fontdata, the transformation
given by xform and the text scalings in x and y direction
given by textScaleX and textScaleY. |
Coordinate |
computeOrigin(java.lang.Object[] fontdata,
BoundingBox bbox,
Transform2D xform,
java.lang.String text,
int[] alignments,
double textScaleX,
double textScaleY,
boolean multiline)
Computes the origin for the text given by text within the
BoundingBox given by bbox with respect to the
alignments given by alignments, the FontFormat
rendering data given by fontdata, the transformation
given by xform and the text scalings in x and y direction
given by textScaleX and textScaleY. |
double |
computeWidth(FontFormat font,
Transform2D xform,
java.lang.String text)
Computes the width of the text given by text when using the
FontFormat given by font and the
transformation given by xform. |
double |
computeWidth(java.lang.Object[] fontdata,
Transform2D xform,
java.lang.String text)
Computes the width of the text given by text when using the
FontFormat rendering data given by fontdata
and the transformation given by xform. |
java.lang.String |
cutToWidth(FontFormat font,
Transform2D xform,
java.lang.String text,
int width)
Cuts the text given by text to the given width
with respect to the FontFormat given by font
and the transformation given by xform. |
java.lang.String |
cutToWidth(FontFormat font,
Transform2D xform,
java.lang.String text,
int width,
double textScaleX,
double textScaleY)
Cuts the text given by text to the given width
with respect to the FontFormat given by font,
the transformation given by xform and the text scalings in
x and y direction given by textScaleX and
textScaleY. |
java.lang.String |
cutToWidth(FontFormat font,
Transform2D xform,
java.lang.String text,
int width,
double textScaleX,
double textScaleY,
boolean keepFirstCharacter)
Cuts the text given by text to the given width
with respect to the FontFormat given by font,
the transformation given by xform and the text scalings in
x and y direction given by textScaleX and
textScaleY. |
java.lang.String |
cutToWidth(java.lang.Object[] fontdata,
Transform2D xform,
java.lang.String text,
int width)
Cuts the text given by text to the given width
with respect to the FontFormat redering data given by
fontdata and the transformation given by
xform. |
java.lang.String |
cutToWidth(java.lang.Object[] fontdata,
Transform2D xform,
java.lang.String text,
int width,
double textScaleX,
double textScaleY)
Cuts the text given by text to the given width
with respect to the FontFormat redering data given by
fontdata, the transformation given by xform
and the text scalings in x and y direction given by
textScaleX and textScaleY. |
java.lang.String |
cutToWidth(java.lang.Object[] fontdata,
Transform2D xform,
java.lang.String text,
int width,
double textScaleX,
double textScaleY,
boolean keepFirstCharacter)
Cuts the text given by text to the given width
with respect to the FontFormat redering data given by
fontdata, the transformation given by xform
and the text scalings in x and y direction given by
textScaleX and textScaleY. |
void |
disableAntiAliasing()
Not implemented in the context of the SWT toolkit. |
void |
disableFractionalMetrics()
Not implemented in the context of the SWT toolkit. |
void |
enableAntiAliasing()
Not implemented in the context of the SWT toolkit. |
void |
enableFractionalMetrics()
Not implemented in the context of the SWT toolkit. |
static int |
getAscent(org.eclipse.swt.graphics.Font f)
Returns the ascent for Font f. |
static int |
getDescent(org.eclipse.swt.graphics.Font f)
Returns the ascent for Font f. |
static int |
getLeadingArea(org.eclipse.swt.graphics.Font f)
Returns the leading area for Font f. |
protected static org.eclipse.swt.graphics.Point |
getTextDimension(java.lang.String s,
org.eclipse.swt.graphics.Font f)
Returns the dimensions of the String s using the font f. |
static BoundingBox |
getTextExtents(java.lang.String text,
org.eclipse.swt.graphics.Font f)
Returns the Dimensions of the given text, converting newlines and tabs appropriately. |
static int |
getTextHeight(java.lang.String s,
org.eclipse.swt.graphics.Font f)
Returns the height of s in Font f. |
static int |
getTextWidth(java.lang.String s,
org.eclipse.swt.graphics.Font f)
Returns the width of s in Font f. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public SWTTextOperations()
Default constructor.
| Method Detail |
public void enableAntiAliasing()
enableAntiAliasing in interface TextOperationsTextOperations.enableAntiAliasing()public void disableAntiAliasing()
disableAntiAliasing in interface TextOperationsTextOperations.disableAntiAliasing()public void enableFractionalMetrics()
enableFractionalMetrics in interface TextOperationsTextOperations.enableFractionalMetrics()public void disableFractionalMetrics()
disableFractionalMetrics in interface TextOperationsTextOperations.disableFractionalMetrics()
public double computeWidth(FontFormat font,
Transform2D xform,
java.lang.String text)
TextOperationstext when using the
FontFormat given by font and the
transformation given by xform.
computeWidth in interface TextOperationsfont - the FontFormat to use for the calculationxform - the transformation to use for the calculationtext - the text to calculate the width for
public double computeWidth(java.lang.Object[] fontdata,
Transform2D xform,
java.lang.String text)
TextOperationstext when using the
FontFormat rendering data given by fontdata
and the transformation given by xform.
computeWidth in interface TextOperationsfontdata - the FontFormat rendering data to use for
the calculationxform - the transformation to use for the calculationtext - the text to calculate the width for
public double computeHeight(java.lang.Object[] fontdata,
Transform2D xform,
java.lang.String text)
TextOperationstext when using
the FontFormat rendering data given by fontdata
and the transformation given by xform.
computeHeight in interface TextOperationsfontdata - the FontFormat rendering data to use for
the calculationxform - the transformation to use for the calculationtext - the text to calculate the height for
public double computeHeight(FontFormat font,
Transform2D xform,
java.lang.String text)
TextOperationstext when using
the FontFormat given by font and the
transformation given by xform.
computeHeight in interface TextOperationsfont - the FontFormat to use for the calculationxform - the transformation to use for the calculationtext - the text to calculate the height for
public Coordinate computeOrigin(java.lang.Object[] fontdata,
BoundingBox bbox,
Transform2D xform,
java.lang.String text,
int[] alignments,
double textScaleX,
double textScaleY)
TextOperationstext within the
BoundingBox given by bbox with respect to the
alignments given by alignments, the FontFormat
rendering data given by fontdata, the transformation
given by xform and the text scalings in x and y direction
given by textScaleX and textScaleY.
computeOrigin in interface TextOperationsfontdata - the FontFormat rendering data to use for
the calculationbbox - the BoundingBox to calculate the origin withinxform - the transformation to use for the calculationtext - the text to calculate the origin foralignments - the alignments for the texttextScaleX - the current scale for the text in x direction
(view zoom)textScaleY - the current scale for the text in y direction
(view zoom)
public BoundingBox computeBoundingBox(java.lang.Object[] fontdata,
BoundingBox bbox,
Transform2D xform,
java.lang.String text,
int[] alignments,
double textScaleX,
double textScaleY)
computeBoundingBox in interface TextOperations
protected static org.eclipse.swt.graphics.Point getTextDimension(java.lang.String s,
org.eclipse.swt.graphics.Font f)
s - the stringf - the font
GC.textExtent(String)
public static BoundingBox getTextExtents(java.lang.String text,
org.eclipse.swt.graphics.Font f)
text - the textf - the font
public static int getTextWidth(java.lang.String s,
org.eclipse.swt.graphics.Font f)
s - the stringf - the font
public static int getAscent(org.eclipse.swt.graphics.Font f)
f - the font
public static int getLeadingArea(org.eclipse.swt.graphics.Font f)
f - the font
public static int getDescent(org.eclipse.swt.graphics.Font f)
f - the font
public static int getTextHeight(java.lang.String s,
org.eclipse.swt.graphics.Font f)
s - the stringf - the font
public java.lang.String cutToWidth(FontFormat font,
Transform2D xform,
java.lang.String text,
int width)
TextOperationstext to the given width
with respect to the FontFormat given by font
and the transformation given by xform.
cutToWidth in interface TextOperationsfont - the FontFormat to use for the calculationxform - the transformation to use for the calculationtext - the text to cutwidth - the maximum width for the remaining text
public java.lang.String cutToWidth(FontFormat font,
Transform2D xform,
java.lang.String text,
int width,
double textScaleX,
double textScaleY,
boolean keepFirstCharacter)
TextOperationstext to the given width
with respect to the FontFormat given by font,
the transformation given by xform and the text scalings in
x and y direction given by textScaleX and
textScaleY.
cutToWidth in interface TextOperationsfont - the FontFormat to use for the calculationxform - the transformation to use for the calculationtext - the text to cutwidth - the maximum width for the remaining texttextScaleX - the current scale for the text in x direction
(view zoom)textScaleY - the current scale for the text in y direction
(view zoom)keepFirstCharacter - true, to keep the first character of the line,
even if it doesn't fit into the width
public java.lang.String cutToWidth(java.lang.Object[] fontdata,
Transform2D xform,
java.lang.String text,
int width)
TextOperationstext to the given width
with respect to the FontFormat redering data given by
fontdata and the transformation given by
xform.
cutToWidth in interface TextOperationsfontdata - the FontFormat to use for the calculationxform - the transformation to use for the calculationtext - the text to cutwidth - the maximum width for the remaining text
public java.lang.String cutToWidth(FontFormat font,
Transform2D xform,
java.lang.String text,
int width,
double textScaleX,
double textScaleY)
TextOperationstext to the given width
with respect to the FontFormat given by font,
the transformation given by xform and the text scalings in
x and y direction given by textScaleX and
textScaleY.
cutToWidth in interface TextOperationsfont - the FontFormat to use for the calculationxform - the transformation to use for the calculationtext - the text to cutwidth - the maximum width for the remaining texttextScaleX - the current scale for the text in x direction
(view zoom)textScaleY - the current scale for the text in y direction
(view zoom)
public java.lang.String cutToWidth(java.lang.Object[] fontdata,
Transform2D xform,
java.lang.String text,
int width,
double textScaleX,
double textScaleY,
boolean keepFirstCharacter)
TextOperationstext to the given width
with respect to the FontFormat redering data given by
fontdata, the transformation given by xform
and the text scalings in x and y direction given by
textScaleX and textScaleY.
cutToWidth in interface TextOperationsfontdata - the FontFormat to use for the calculationxform - the transformation to use for the calculationtext - the text to cutwidth - the maximum width for the remaining texttextScaleX - the current scale for the text in x direction
(view zoom)textScaleY - the current scale for the text in y direction
(view zoom)keepFirstCharacter - true, to keep the first character of the line,
even if it doesn't fit into the width
public java.lang.String cutToWidth(java.lang.Object[] fontdata,
Transform2D xform,
java.lang.String text,
int width,
double textScaleX,
double textScaleY)
TextOperationstext to the given width
with respect to the FontFormat redering data given by
fontdata, the transformation given by xform
and the text scalings in x and y direction given by
textScaleX and textScaleY.
cutToWidth in interface TextOperationsfontdata - the FontFormat to use for the calculationxform - the transformation to use for the calculationtext - the text to cutwidth - the maximum width for the remaining texttextScaleX - the current scale for the text in x direction
(view zoom)textScaleY - the current scale for the text in y direction
(view zoom)
public Coordinate computeOrigin(java.lang.Object[] fontdata,
BoundingBox bbox,
Transform2D xform,
java.lang.String text,
int[] alignments,
double[] lineScales)
TextOperationstext within the
BoundingBox given by bbox with respect to the
alignments given by alignments, the FontFormat
rendering data given by fontdata and the transformation
given by xform.
computeOrigin in interface TextOperationsfontdata - the FontFormat rendering data to use for
the calculationbbox - the BoundingBox to calculate the origin withinxform - the transformation to use for the calculationtext - the text to calculate the origin foralignments - the alignments for the textlineScales -
public Coordinate[] computeLineCoordinates(FontFormat font,
Transform2D xform,
java.lang.String text,
int lineType)
TextOperationstext when using the FontFormat given by
font and the transformation given by xform.
computeLineCoordinates in interface TextOperationsfont - the FontFormat to use for the calculationxform - the transformation to use for the calculationtext - the text to calculate the width forlineType - The type of line:
TextOperations.LINETYPE_UNDERLINE: Line under the text
TextOperations.LINETYPE_STRIKETHROUGH: Line through the text
public Coordinate[] computeLineCoordinates(java.lang.Object[] fontData,
Transform2D xform,
java.lang.String text,
int lineType)
TextOperationstext when using the FontFormat given by
font and the transformation given by xform.
computeLineCoordinates in interface TextOperationsfontData - the font format data to use for the calculationxform - the transformation to use for the calculationtext - the text to calculate the width forlineType - The type of line:
TextOperations.LINETYPE_UNDERLINE: Line under the text
TextOperations.LINETYPE_STRIKETHROUGH: Line through the text
public double computeHeight(FontFormat font,
Transform2D xform,
java.lang.String text,
boolean multiline)
TextOperationstext when using
the FontFormat given by font and the
transformation given by xform.
computeHeight in interface TextOperationsfont - the FontFormat to use for the calculationxform - the transformation to use for the calculationtext - the text to calculate the height formultiline - if true, the line spacing will be included in the height
public double computeHeight(java.lang.Object[] fontdata,
Transform2D xform,
java.lang.String text,
boolean multiline)
TextOperationstext when using
the FontFormat rendering data given by fontdata
and the transformation given by xform.
computeHeight in interface TextOperationsfontdata - the FontFormat rendering data to use for
the calculationxform - the transformation to use for the calculationtext - the text to calculate the height formultiline - if true, the line spacing will be included in the height
public Coordinate computeOrigin(java.lang.Object[] fontdata,
BoundingBox bbox,
Transform2D xform,
java.lang.String text,
int[] alignments,
double[] lineScales,
boolean multiline)
TextOperationstext within the
BoundingBox given by bbox with respect to the
alignments given by alignments, the FontFormat
rendering data given by fontdata and the transformation
given by xform.
computeOrigin in interface TextOperationsfontdata - the FontFormat rendering data to use for
the calculationbbox - the BoundingBox to calculate the origin withinxform - the transformation to use for the calculationtext - the text to calculate the origin foralignments - the alignments for the textlineScales - multiline - if true, the line spacing will be included in the height
public BoundingBox computeBoundingBox(java.lang.Object[] fontdata,
BoundingBox bbox,
Transform2D xform,
java.lang.String text,
int[] alignments,
double textScaleX,
double textScaleY,
boolean mutliline)
computeBoundingBox in interface TextOperations
public Coordinate computeOrigin(java.lang.Object[] fontdata,
BoundingBox bbox,
Transform2D xform,
java.lang.String text,
int[] alignments,
double textScaleX,
double textScaleY,
boolean multiline)
TextOperationstext within the
BoundingBox given by bbox with respect to the
alignments given by alignments, the FontFormat
rendering data given by fontdata, the transformation
given by xform and the text scalings in x and y direction
given by textScaleX and textScaleY.
computeOrigin in interface TextOperationsfontdata - the FontFormat rendering data to use for
the calculationbbox - the BoundingBox to calculate the origin withinxform - the transformation to use for the calculationtext - the text to calculate the origin foralignments - the alignments for the texttextScaleX - the current scale for the text in x direction
(view zoom)textScaleY - the current scale for the text in y direction
(view zoom)multiline - if true, the line spacing will be included in the height
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||