TextShape Class

Summary: Represents a text shape.

Module: aspose.imaging.shapes

Full Name: aspose.imaging.shapes.TextShape

Inheritance: RectangleProjectedShape

Aspose.Imaging Version: 24.5.0

Constructors

NameDescription
TextShape()Initializes a new instance of the TextShape class.
TextShape(text, rectangle, font, string_format)Initializes a new instance of the TextShape class.

Properties

NameTypeAccessDescription
boundsRectangleFrGets the object’s bounds.
centerPointFrGets the shape’s center.
fontFontr/wGets or sets the font used to draw the text.
has_segmentsboolrGets a value indicating whether shape has segments.
left_bottomPointFrGets the left bottom rectangle point.
left_topPointFrGets the left top rectangle point.
rectangle_heightdoublerGets the rectangle height.
rectangle_widthdoublerGets the rectangle width.
right_bottomPointFrGets the right bottom rectangle point.
right_topPointFrGets the right top rectangle point.
segmentsShapeSegment[]rGets the shape segments.
textstringr/wGets or sets the drawn text.
text_formatStringFormatr/wGets or sets the text format.

Methods

NameDescription
get_bounds(matrix)Gets the object’s bounds.
get_bounds(matrix, pen)Gets the object’s bounds.
transform(transform)Applies the specified transformation to the shape.

Constructor: TextShape()

 TextShape() 

Initializes a new instance of the TextShape class.

Constructor: TextShape(text, rectangle, font, string_format)

 TextShape(text, rectangle, font, string_format) 

Initializes a new instance of the TextShape class.

Parameters:

ParameterTypeDescription
textstringThe text to draw.
rectangleRectangleFThe text rectangle.
fontFontThe font to use.
string_formatStringFormatThe string format.

Method: get_bounds(matrix)

 get_bounds(matrix) 

Gets the object’s bounds.

Parameters:

ParameterTypeDescription
matrixMatrixThe matrix to apply before bounds will be calculated.

Returns

TypeDescription
RectangleFThe estimated object’s bounds.

Method: get_bounds(matrix, pen)

 get_bounds(matrix, pen) 

Gets the object’s bounds.

Parameters:

ParameterTypeDescription
matrixMatrixThe matrix to apply before bounds will be calculated.
penPenThe pen to use for object. This can influence the object’s bounds size.

Returns

TypeDescription
RectangleFThe estimated object’s bounds.

Method: transform(transform)

 transform(transform) 

Applies the specified transformation to the shape.

Parameters:

ParameterTypeDescription
transformMatrixThe transformation to apply.