1 Star 0 Fork 4.9K

famoustang / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
OHOS-Text.md 15.45 KB
一键复制 编辑 原始数据 按行查看 历史
wenjun 提交于 2020-09-08 10:08 . add OpenHarmony 1.0 baseline

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

 
1
https://gitee.com/famoustang/docs.git
git@gitee.com:famoustang/docs.git
famoustang
docs
docs
master

搜索帮助