KLayout Manual: Main Index » Class Index » API reference - Class Text

API reference - Class Text

Notation used in Ruby API documentation

Description: A text object

A text object has a point (location), a text, a text transformation, a text size and a font id. Text size and font id are provided to be be able to render the text correctly.

Public constructors

new TextnewDefault constructor
new Textnew(string string,
const Trans trans)
Constructor with string and transformation
new Textnew(string string,
const Trans trans,
int height,
int font)
Constructor with string, transformation, text height and font

Public methods

[const]bool!=(const Text text)Inequality
[const]bool<(const Text t)Less operator
[const]bool==(const Text text)Equality
[const]voidassign(const Text other)Assign the contents of another object to self
voidcreateEnsures the C++ object is created
voiddestroyExplicitly destroy the object
[const]booldestroyed?Returns a value indicating whether the object was already destroyed
[const]TextdupCreates a copy of self
intfontGet the font number
voidfont=(int f)Set the font number
inthalignGet the horizontal alignment
voidhalign=(int a)Set the horizontal alignment
[const]boolis_const_object?Returns a value indicating whether the reference is a const reference
Textmove(const Point distance)Moves the text by a certain distance
Textmoved(const Point distance)Returns the text moved by a certain distance
[const]intsizeGet the text height
voidsize=(int s)Set the text height of this object
[const]stringstringGet the text string
voidstring=(string text)Assign a text string to this object
[const]stringto_sConvert to a string
[const]TranstransGet the transformation
voidtrans=(const Trans t)Assign a transformation (text position and orientation) to this object
[const]Texttransformed(const Trans t)Transform the text with the given simple transformation
[const]Texttransformed_cplx(const ICplxTrans t)Transform the text with the given complex transformation
[const]DTexttransformed_cplx(const CplxTrans t)Transform the text with the given complex transformation
intvalignGet the vertical alignment
voidvalign=(int a)Set the vertical alignment

Public static methods and constants

Textfrom_dtext(const DText double_text)Construct an integer coordinate text object from a floating-point coordinate text

Deprecated methods (protected, public, static, non-static and constructors)

[static]new Textnew_st(string string,
const Trans trans)
Use of this method is deprecated. Use new instead
[static]new Textnew_sthf(string string,
const Trans trans,
int height,
int font)
Use of this method is deprecated. Use new instead

Detailed description

[const] bool !=(const Text text)

Description: Inequality

Return true, if this text object and the given text are not equal

[const] bool <(const Text t)

Description: Less operator

t:The object to compare against

This operator is provided to establish some, not necessarily a certain sorting order

[const] bool ==(const Text text)

Description: Equality

Return true, if this text object and the given text are equal

[const] void assign(const Text other)

Description: Assign the contents of another object to self

This method assigns the contents of another object to self. This is a deep copy that does not only copy the reference but the actual content.

void create

Description: Ensures the C++ object is created

Use this method to ensure the C++ object is created, for example to ensure that resources are allocated. Usually C++ objects are created on demand and not necessarily when the script object is created.

void destroy

Description: Explicitly destroy the object

Explicitly destroy the object on C++ side if it was owned by the Ruby interpreter. Subsequent access to this object will throw an exception. If the object is not owned by Ruby, this method will do nothing.

[const] bool destroyed?

Description: Returns a value indicating whether the object was already destroyed

This method returns true, if the object was destroyed, either explicitly or by the C++ side. The latter may happen, if the object is owned by a C++ object which got destroyed itself.

[const] Text dup

Description: Creates a copy of self

int font

Description: Get the font number

void font=(int f)

Description: Set the font number

[static] Text from_dtext(const DText double_text)

Description: Construct an integer coordinate text object from a floating-point coordinate text

int halign

Description: Get the horizontal alignment

See halign= for a description of this property.

void halign=(int a)

Description: Set the horizontal alignment

This property specifies how the text is aligned relative to the anchor point. Allowed values for this property are 0 (left), 1 (center) and 2 (right). This property has been introduced in version 0.22.

[const] bool is_const_object?

Description: Returns a value indicating whether the reference is a const reference

This method returns true, if self is a const reference. In that case, only const methods may be called on self.

Text move(const Point distance)

Description: Moves the text by a certain distance

p:The offset to move the text.
Returns:A reference to this text object

Moves the text by a given offset and returns the moved text. Does not check for coordinate overflows.

Text moved(const Point distance)

Description: Returns the text moved by a certain distance

p:The offset to move the text.
Returns:The moved text.

Moves the text by a given offset and returns the moved text. Does not modify *this. Does not check for coordinate overflows.

[static] new Text new

Description: Default constructor

Creates a text with unit transformation and empty text.

[static] new Text new(string string,const Trans trans)

Description: Constructor with string and transformation

A string and a transformation is provided to this constructor. The transformation specifies the location and orientation of the text object.

[static] new Text new(string string,const Trans trans,int height,int font)

Description: Constructor with string, transformation, text height and font

A string and a transformation is provided to this constructor. The transformation specifies the location and orientation of the text object. In addition, the text height and font can be specified.

[static] new Text new_st(string string,const Trans trans)

Description: Constructor with string and transformation

This method is deprecated. Use method 'new' instead

[static] new Text new_sthf(string string,const Trans trans,int height,int font)

Description: Constructor with string, transformation, text height and font

This method is deprecated. Use method 'new' instead

[const] int size

Description: Get the text height

void size=(int s)

Description: Set the text height of this object

[const] string string

Description: Get the text string

void string=(string text)

Description: Assign a text string to this object

[const] string to_s

Description: Convert to a string

[const] Trans trans

Description: Get the transformation

void trans=(const Trans t)

Description: Assign a transformation (text position and orientation) to this object

[const] Text transformed(const Trans t)

Description: Transform the text with the given simple transformation

t:The transformation to apply
Returns:The transformed text

[const] Text transformed_cplx(const ICplxTrans t)

Description: Transform the text with the given complex transformation

t:The magnifying transformation to apply
Returns:The transformed text (in this case an integer coordinate object now)

This method has been introduced in version 0.18.

[const] DText transformed_cplx(const CplxTrans t)

Description: Transform the text with the given complex transformation

t:The magnifying transformation to apply
Returns:The transformed text (a DText now)

int valign

Description: Get the vertical alignment

See valign= for a description of this property.

void valign=(int a)

Description: Set the vertical alignment

This property specifies how the text is aligned relative to the anchor point. Allowed values for this property are 0 (top), 1 (center) and 2 (bottom). This property has been introduced in version 0.22.