OHOS::Text

Overview

Related Modules:

Graphic

Description:

Represents the base class of Text, providing the text attribute setting and text drawing capabilities for components that require font display.

Since:

1.0

Version:

1.0

Summary

Public Member Functions

Public Member Function Name

Description

Text ()

 

A constructor used to create a Text instance.

~Text ()

virtual 

A destructor used to delete the Text instance.

SetText (const char text)

void 

Sets the content for this text.

GetText () const

const char  

Obtains the content of this text.

SetFont (const char *name, uint8_t size)

void 

Sets the font name and size.

SetFontId (uint8_t fontId)

void 

Sets the font ID.

GetFontId () const

uint8_t 

Obtains the font ID.

SetDirect (UITextLanguageDirect direct)

void 

Sets the direction for this text.

GetDirect () const

UITextLanguageDirect 

Obtains the direction of this text.

SetAlign (UITextLanguageAlignment horizontalAlign, UITextLanguageAlignment verticalAlign=TEXT_ALIGNMENT_TOP)

void 

Sets the alignment mode for this text.

GetHorAlign () const

UITextLanguageAlignment 

Obtains the horizontal alignment mode.

GetVerAlign () const

UITextLanguageAlignment 

Obtains the vertical alignment mode.

SetTextRotation (LabelRotateDegree angle)

void 

Sets the clockwise rotation angle for this text.

GetTextRotation () const

LabelRotateDegree 

Obtains the clockwise rotation degree of this text.

GetTextRotateDegree () const

uint16_t 

Obtains the number of text rotation degrees.

GetTextSize () const

Point 

Obtains the size of this text.

SetExpandWidth (bool expand)

void 

Sets whether to adapt the component width to this text.

IsExpandWidth () const

bool 

Checks whether the component width adapts to this text.

SetExpandHeight (bool expand)

void 

Sets whether to adapt the component height to this text.

IsExpandHeight () const

bool 

Checks whether the component height adapts to this text.

GetEllipsisIndex (const Rect &textRect, const Style &style)

uint16_t 

Obtains the index of the character from where text will be replaced by ellipses based on the text rectangle and style.

Static Public Attributes

Static Public Attribute Name

Description

TEXT_ELLIPSIS_END_INV = 0xFFFF