styled_string.h
Overview
Defines text styles and text layout managers for the component whose ArkUI_NodeType is ARKUI_NODE_TEXT on the native side.
File to include: <arkui/styled_string.h>
Library: libace_ndk.z.so
System capability: SystemCapability.ArkUI.ArkUI.Full
Since: 12
Related module: ArkUI_NativeModule
Sample: StyledStringSample
Summary
Structs
| Name | typedef Keyword | Description |
|---|---|---|
| ArkUI_StyledString | ArkUI_StyledString | Defines a styled string object supported by the text component. |
| OH_ArkUI_SpanStyle | OH_ArkUI_SpanStyle | Defines a styled string style object. OH_ArkUI_SpanStyle_Create can be used to create a styled string style object. OH_ArkUI_SpanStyle_Destroy can be used to destroy the styled string style object. After the object is created, OH_ArkUI_SpanStyle_SetStart and OH_ArkUI_SpanStyle_SetLength can be used to set the usage scope of the style. After the object is created, the OH_ArkUI_SpanStyle_SetXXXStyle series APIs can be used to set the specific styles that take effect. For example, you can use OH_ArkUI_SpanStyle_SetTextStyle to set the font style. |
| OH_ArkUI_ImageAttachment | OH_ArkUI_ImageAttachment | Defines an image style object. OH_ArkUI_ImageAttachment_Create can be used to create an image style object. OH_ArkUI_ImageAttachment_Destroy can be used to destroy the image style object. After the object is created, the OH_ArkUI_ImageAttachment_SetXXX series APIs can be used to set the styles that take effect. For example, you can use OH_ArkUI_ImageAttachment_SetPixelMap to set an image source. |
| OH_ArkUI_CustomSpan | OH_ArkUI_CustomSpan | Defines a custom span. OH_ArkUI_CustomSpan_Create can be used to create a custom span object. OH_ArkUI_CustomSpan_Destroy can be used to destroy the custom span object. After the object is created, OH_ArkUI_CustomSpan_RegisterOnMeasureCallback and OH_ArkUI_CustomSpan_RegisterOnDrawCallback can be used to register drawing callback functions. |
| OH_ArkUI_TextStyle | OH_ArkUI_TextStyle | Defines a text font style. OH_ArkUI_TextStyle_Create can be used to create a text font style object. OH_ArkUI_TextStyle_Destroy can be used to destroy the text font style object. After the object is created, the OH_ArkUI_TextStyle_SetXXX series APIs can be used to set the specific styles that take effect. For example, you can use OH_ArkUI_TextStyle_SetFontColor to set a text color. |
| OH_ArkUI_ParagraphStyle | OH_ArkUI_ParagraphStyle | Defines a paragraph style. OH_ArkUI_ParagraphStyle_Create can be used to create a paragraph style object. OH_ArkUI_ParagraphStyle_Destroy can be used to destroy the paragraph style object. After the object is created, the OH_ArkUI_ParagraphStyle_SetXXX series APIs can be used to set the specific styles that take effect. For example, you can use OH_ArkUI_ParagraphStyle_SetTextAlign to set a text alignment method. |
| OH_ArkUI_GestureStyle | OH_ArkUI_GestureStyle | Defines a gesture style. OH_ArkUI_GestureStyle_Create can be used to create a gesture style object. OH_ArkUI_GestureStyle_Destroy can be used to destroy the gesture style object. After the object is created, the OH_ArkUI_GestureStyle_RegisterOnXXXCallback series APIs can be used to register specific event callbacks. For example, you can use OH_ArkUI_GestureStyle_RegisterOnClickCallback to register a click event callback. |
| OH_ArkUI_TextShadowStyle | OH_ArkUI_TextShadowStyle | Defines a text shadow style. OH_ArkUI_TextShadowStyle_Create can be used to create a text shadow style object. OH_ArkUI_TextShadowStyle_Destroy can be used to destroy the text shadow style object. After the object is created, OH_ArkUI_TextShadowStyle_SetTextShadow can be used to set a style. |
| OH_ArkUI_DecorationStyle | OH_ArkUI_DecorationStyle | Defines a text decoration style. OH_ArkUI_DecorationStyle_Create can be used to create a text decoration style object. OH_ArkUI_DecorationStyle_Destroy can be used to destroy the text decoration style object. After the object is created, the OH_ArkUI_DecorationStyle_SetXXX series APIs can be used to set the specific styles that take effect. For example, you can use OH_ArkUI_DecorationStyle_SetTextDecorationType to set the decoration type. |
| OH_ArkUI_BaselineOffsetStyle | OH_ArkUI_BaselineOffsetStyle | Defines a baseline offset style. OH_ArkUI_BaselineOffsetStyle_Create can be used to create a baseline offset style object. OH_ArkUI_BaselineOffsetStyle_Destroy can be used to destroy the baseline offset style object. After the object is created, OH_ArkUI_BaselineOffsetStyle_SetBaselineOffset can be used to set a baseline offset. |
| OH_ArkUI_LetterSpacingStyle | OH_ArkUI_LetterSpacingStyle | Defines a letter spacing style. OH_ArkUI_LetterSpacingStyle_Create can be used to create a letter spacing style object. OH_ArkUI_LetterSpacingStyle_Destroy can be used to destroy the letter spacing style object. After the object is created, OH_ArkUI_LetterSpacingStyle_SetLetterSpacing can be used to set letter spacing. |
| OH_ArkUI_LineHeightStyle | OH_ArkUI_LineHeightStyle | Defines a line height style. OH_ArkUI_LineHeightStyle_Create can be used to create a line height style object. OH_ArkUI_LineHeightStyle_Destroy can be used to destroy the line height style object. After the object is created, OH_ArkUI_LineHeightStyle_SetLineHeight can be used to set fixed line height. Since API version 26.0.0, OH_ArkUI_LineHeightStyle_SetLineHeightMultiple can be used to set the line height multiplier after the object is created. |
| OH_ArkUI_LineSpacingStyle | OH_ArkUI_LineSpacingStyle | Defines a line spacing style. OH_ArkUI_LineSpacingStyle_Create can be used to create a line spacing style object. OH_ArkUI_LineSpacingStyle_Destroy can be used to destroy the line spacing style object. After the object is created, OH_ArkUI_LineSpacingStyle_SetLineSpacing can be used to set a line spacing value. After the object is created, OH_ArkUI_LineSpacingStyle_SetOnlyBetweenLines can be used to set whether the line spacing takes effect only between lines. |
| OH_ArkUI_UrlStyle | OH_ArkUI_UrlStyle | Defines a URL style. OH_ArkUI_UrlStyle_Create can be used to create a URL style object. OH_ArkUI_UrlStyle_Destroy can be used to destroy the URL style object. After the object is created, OH_ArkUI_UrlStyle_SetUrl can be used to set a URL. |
| OH_ArkUI_BackgroundColorStyle | OH_ArkUI_BackgroundColorStyle | Defines a background color style. OH_ArkUI_BackgroundColorStyle_Create can be used to create a background color style object. OH_ArkUI_BackgroundColorStyle_Destroy can be used to destroy the background color style object. After the object is created, OH_ArkUI_BackgroundColorStyle_SetColor and OH_ArkUI_BackgroundColorStyle_SetRadius can be used to set the background color and rounded corners. |
| OH_ArkUI_UserDataSpan | OH_ArkUI_UserDataSpan | Defines a user data span style. OH_ArkUI_UserDataSpan_Create can be used to create a user data span style object. OH_ArkUI_UserDataSpan_Destroy can be used to destroy the user data span style object. After the object is created, OH_ArkUI_UserDataSpan_SetUserData can be used to bind user data. |
| OH_ArkUI_LeadingMarginSpanDrawInfo | OH_ArkUI_LeadingMarginSpanDrawInfo | Defines the custom drawing information for paragraph indentation. OH_ArkUI_LeadingMarginSpanDrawInfo_Create can be used to create a custom drawing information object for paragraph indentation. OH_ArkUI_LeadingMarginSpanDrawInfo_Destroy can be used to destroy the custom drawing information object for paragraph indentation. This object is used to provide the drawing context information of the current line in the callback function registered by OH_ArkUI_ParagraphStyle_RegisterOnDrawLeadingMarginCallback. |
| ArkUI_TextLayoutManager | ArkUI_TextLayoutManager | Defines a text layout manager. |
Enumeration
| Name | typedef Keyword | Description |
|---|---|---|
| OH_ArkUI_StyledStringKey | OH_ArkUI_StyledStringKey | Enumerates the attribute types of a styled string. |
| OH_ArkUI_SuperscriptStyle | OH_ArkUI_SuperscriptStyle | Enumerates the text superscript and subscript styles. |
Functions
Enum Description
OH_ArkUI_StyledStringKey
enum OH_ArkUI_StyledStringKey
Description
Enumerates the styles of a styled string.
Since: 24
| Value | Description |
|---|---|
| OH_ARKUI_STYLEDSTRINGKEY_UNSPECIFIED = -1 | No style is specified. |
| OH_ARKUI_STYLEDSTRINGKEY_FONT = 0 | Text font style. |
| OH_ARKUI_STYLEDSTRINGKEY_DECORATION = 1 | Text decorative line style. |
| OH_ARKUI_STYLEDSTRINGKEY_BASELINE_OFFSET = 2 | Text baseline offset style. |
| OH_ARKUI_STYLEDSTRINGKEY_LETTER_SPACING = 3 | Text letter spacing style. |
| OH_ARKUI_STYLEDSTRINGKEY_TEXT_SHADOW = 4 | Text shadow style. |
| OH_ARKUI_STYLEDSTRINGKEY_LINE_HEIGHT = 5 | Text line height style. |
| OH_ARKUI_STYLEDSTRINGKEY_BACKGROUND_COLOR = 6 | Text background color style. |
| OH_ARKUI_STYLEDSTRINGKEY_URL = 7 | URL style. |
| OH_ARKUI_STYLEDSTRINGKEY_LINE_SPACING = 8 | Text line spacing style. Since: 26.0.0 |
| OH_ARKUI_STYLEDSTRINGKEY_GESTURE = 100 | Gesture style. |
| OH_ARKUI_STYLEDSTRINGKEY_PARAGRAPH_STYLE = 200 | Text paragraph style. |
| OH_ARKUI_STYLEDSTRINGKEY_IMAGE = 300 | Image style. |
| OH_ARKUI_STYLEDSTRINGKEY_CUSTOM_SPAN = 400 | Custom span style. |
| OH_ARKUI_STYLEDSTRINGKEY_USER_DATA = 500 | User data span style. |
OH_ArkUI_SuperscriptStyle
enum OH_ArkUI_SuperscriptStyle
Description
Enumerates the text superscript and subscript styles.
Since: 24
| Value | Description |
|---|---|
| OH_ARKUI_SUPERSCRIPTSTYLE_NORMAL = 0 | Normal text style. |
| OH_ARKUI_SUPERSCRIPTSTYLE_SUPERSCRIPT = 1 | Superscript text style. |
| OH_ARKUI_SUPERSCRIPTSTYLE_SUBSCRIPT = 2 | Subscript text style. |
Function Description
OH_ArkUI_StyledString_Create()
ArkUI_StyledString* OH_ArkUI_StyledString_Create(OH_Drawing_TypographyStyle* style, OH_Drawing_FontCollection* collection)
Description
Creates a pointer to the ArkUI_StyledString object.
Since: 12
Parameters
| Name | Description |
|---|---|
| OH_Drawing_TypographyStyle* style | Pointer to an OH_Drawing_TypographyStyle object, obtained using OH_Drawing_CreateTypographyStyle. |
| OH_Drawing_FontCollection* collection | Pointer to an OH_Drawing_FontCollection object, obtained using OH_Drawing_CreateFontCollection. |
Return value
| Type | Description |
|---|---|
| ArkUI_StyledString* | Pointer to the created ArkUI_StyledString object. If a null pointer is returned, the creation fails. Possible causes include a full application address space or parameter errors, such as a null pointer being passed for the style or collection parameter. |
OH_ArkUI_StyledString_Destroy()
void OH_ArkUI_StyledString_Destroy(ArkUI_StyledString* handle)
Description
Destroys an ArkUI_StyledString object and reclaims the memory occupied by the object.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString* handle | Pointer to an ArkUI_StyledString object. |
OH_ArkUI_StyledString_PushTextStyle()
void OH_ArkUI_StyledString_PushTextStyle(ArkUI_StyledString* handle, OH_Drawing_TextStyle* style)
Description
Pushes a text style to the top of the style stack of a styled string.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString* handle | Pointer to an ArkUI_StyledString object. |
| OH_Drawing_TextStyle* style | Pointer to an OH_Drawing_TextStyle object. |
OH_ArkUI_StyledString_AddText()
void OH_ArkUI_StyledString_AddText(ArkUI_StyledString* handle, const char* content)
Description
Adds text for a styled string.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString* handle | Pointer to an ArkUI_StyledString object. |
| const char* content | Pointer to the text content. |
OH_ArkUI_StyledString_PopTextStyle()
void OH_ArkUI_StyledString_PopTextStyle(ArkUI_StyledString* handle)
Description
Pops the style at the top of the style stack of a styled string.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString* handle | Pointer to an ArkUI_StyledString object. |
OH_ArkUI_StyledString_CreateTypography()
OH_Drawing_Typography* OH_ArkUI_StyledString_CreateTypography(ArkUI_StyledString* handle)
Description
Creates a pointer to the OH_Drawing_Typography object based on an ArkUI_StyledString object for text measurement and typesetting in advance. The lifecycle of the OH_Drawing_Typography object is managed by the application. When destroying the object, the application needs to call the reset method for NODE_TEXT_CONTENT_WITH_STYLED_STRING to prevent crashes caused by wild pointers.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString* handle | Pointer to an ArkUI_StyledString object. |
Return value
| Type | Description |
|---|---|
| OH_Drawing_Typography* | Pointer to the OH_Drawing_Typography object. If a null pointer is returned, the creation fails. A possible cause is that a parameter error, for example, a null pointer for the handle parameter, occurs. |
OH_ArkUI_StyledString_AddPlaceholder()
void OH_ArkUI_StyledString_AddPlaceholder(ArkUI_StyledString* handle, OH_Drawing_PlaceholderSpan* placeholder)
Description
Adds a placeholder.
Since: 12
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString* handle | Pointer to an ArkUI_StyledString object. |
| OH_Drawing_PlaceholderSpan* placeholder | Pointer to an OH_Drawing_PlaceholderSpan object. |
OH_ArkUI_StyledString_Descriptor_Create()
ArkUI_StyledString_Descriptor* OH_ArkUI_StyledString_Descriptor_Create(void)
Description
Creates an ArkUI_StyledString_Descriptor object.
Since: 14
Return value
| Type | Description |
|---|---|
| ArkUI_StyledString_Descriptor* | Pointer to an ArkUI_StyledString_Descriptor object. |
OH_ArkUI_StyledString_Descriptor_Destroy()
void OH_ArkUI_StyledString_Descriptor_Destroy(ArkUI_StyledString_Descriptor* descriptor)
Description
Destroys an ArkUI_StyledString_Descriptor object and reclaims the memory occupied by the object.
Since: 14
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString_Descriptor* descriptor | Pointer to an ArkUI_StyledString_Descriptor object. |
OH_ArkUI_UnmarshallStyledStringDescriptor()
int32_t OH_ArkUI_UnmarshallStyledStringDescriptor(uint8_t* buffer, size_t bufferSize, ArkUI_StyledString_Descriptor* descriptor)
Description
Unmarshals a byte array containing styled string information into a styled string.
Since: 14
Parameters
| Name | Description |
|---|---|
| uint8_t* buffer | Pointer to the byte array to be deserialized. |
| size_t bufferSize | Length of the byte array. |
| ArkUI_StyledString_Descriptor* descriptor | Pointer to an ArkUI_StyledString_Descriptor object. |
Return value
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_MarshallStyledStringDescriptor()
int32_t OH_ArkUI_MarshallStyledStringDescriptor(uint8_t* buffer, size_t bufferSize, ArkUI_StyledString_Descriptor* descriptor, size_t* resultSize)
Description
Marshals the styled string information into a byte array.
Since: 14
Parameters
| Name | Description |
|---|---|
| uint8_t* buffer | Pointer to the byte array where the serialized data will be stored. |
| size_t bufferSize | Length of the byte array. |
| ArkUI_StyledString_Descriptor* descriptor | Pointer to an ArkUI_StyledString_Descriptor object. |
| size_t* resultSize | Pointer to the actual length of the resulting byte array after deserialization. |
Return value
| Type | Description |
|---|---|
| int32_t | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_ConvertToHtml()
const char* OH_ArkUI_ConvertToHtml(ArkUI_StyledString_Descriptor* descriptor)
Description
Converts styled string information into HTML.
Since: 14
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString_Descriptor* descriptor | Pointer to an ArkUI_StyledString_Descriptor object. |
Return value
| Type | Description |
|---|---|
| const char* | Pointer to the HTML object. This pointer is internally managed and is released when OH_ArkUI_StyledString_Descriptor_Destroy() is called. |
OH_ArkUI_StyledString_Descriptor_CreateWithString()
ArkUI_StyledString_Descriptor* OH_ArkUI_StyledString_Descriptor_CreateWithString(const char* value, const OH_ArkUI_SpanStyle** styles, int32_t length)
Description
Creates an ArkUI_StyledString_Descriptor object of the plain text content type.
NOTE
When the object is no longer used, call OH_ArkUI_StyledString_Descriptor_Destroy to destroy it.
Since: 24
Parameters
| Name | Description |
|---|---|
| const char* value | Pointer to text content string of the styled string. |
| const OH_ArkUI_SpanStyle** styles | Pointer to the initialization option of the styled string, which points to an array of the OH_ArkUI_SpanStyle object. |
| int32_t length | Length of the initialization option of the styled string. |
Return value
| Type | Description |
|---|---|
| ArkUI_StyledString_Descriptor* | Pointer to the created ArkUI_StyledString_Descriptor object. If a null pointer is returned, the creation fails. The possible cause is that an input parameter is abnormal. |
OH_ArkUI_StyledString_Descriptor_CreateWithImageAttachment()
ArkUI_StyledString_Descriptor* OH_ArkUI_StyledString_Descriptor_CreateWithImageAttachment(const OH_ArkUI_ImageAttachment* value)
Description
Creates an ArkUI_StyledString_Descriptor object of the image content type.
NOTE
When the object is no longer used, call OH_ArkUI_StyledString_Descriptor_Destroy to destroy it.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ImageAttachment* value | Pointer to the OH_ArkUI_ImageAttachment object. |
Return value
| Type | Description |
|---|---|
| ArkUI_StyledString_Descriptor* | Pointer to the created ArkUI_StyledString_Descriptor object. If a null pointer is returned, the creation fails. The possible cause is that an input parameter is abnormal. |
OH_ArkUI_StyledString_Descriptor_CreateWithCustomSpan()
ArkUI_StyledString_Descriptor* OH_ArkUI_StyledString_Descriptor_CreateWithCustomSpan(const OH_ArkUI_CustomSpan* value)
Description
Creates an ArkUI_StyledString_Descriptor object of the custom span content type.
NOTE
When the object is no longer used, call OH_ArkUI_StyledString_Descriptor_Destroy to destroy it.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_CustomSpan* value | Pointer to the OH_ArkUI_CustomSpan object. |
Return value
| Type | Description |
|---|---|
| ArkUI_StyledString_Descriptor* | Pointer to the created ArkUI_StyledString_Descriptor object. If a null pointer is returned, the creation fails. The possible cause is that an input parameter is abnormal. |
OH_ArkUI_StyledString_Descriptor_GetLength()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_GetLength(const ArkUI_StyledString_Descriptor* descriptor, int32_t* length)
Description
Obtains the length of a styled string.
Since: 24
Parameters
| Name | Description |
|---|---|
| const ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
| int32_t* length | Pointer to the character length. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_StyledString_Descriptor_GetString()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_GetString(const ArkUI_StyledString_Descriptor* descriptor, char* buffer, int32_t bufferSize, int32_t* writeLength)
Description
Obtains the text content of a styled string.
Since: 24
Parameters
| Name | Description |
|---|---|
| const ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
| char* buffer | Pointer to the buffer for storing the text content in the memory. You need to allocate the memory. |
| int32_t bufferSize | Buffer size. |
| int32_t* writeLength | Pointer to the length of the data actually written to the buffer if ARKUI_ERROR_CODE_NO_ERROR is returned. Pointer to the minimum length required for writing the entire string to the buffer if ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR is returned. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. Returns ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR if the buffer size is insufficient. |
OH_ArkUI_StyledString_Descriptor_IsEqual()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_IsEqual(const ArkUI_StyledString_Descriptor* firstDescriptor, const ArkUI_StyledString_Descriptor* secondDescriptor, bool* isEqual)
Description
Checks whether a styled string is the same as another styled string. The two styled strings are the same if they have the same text and style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const ArkUI_StyledString_Descriptor* firstDescriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
| const ArkUI_StyledString_Descriptor* secondDescriptor | Pointer to another ArkUI_StyledString_Descriptor object. |
| bool* isEqual | Pointer to the isEqual parameter indicating whether the two styled strings are the same. true if the two are the same; returns false otherwise. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_StyledString_Descriptor_SubStyledString()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_SubStyledString(const ArkUI_StyledString_Descriptor* descriptor, ArkUI_StyledString_Descriptor* subDescriptor, uint32_t start, uint32_t length)
Description
Obtains a sub-styled string of a styled string.
Since: 24
Parameters
| Name | Description |
|---|---|
| const ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
| ArkUI_StyledString_Descriptor* subDescriptor | Pointer to the ArkUI_StyledString_Descriptor sub-styled string object. |
| uint32_t start | Start position of the sub-styled string. The value range is [0, length of the styled string]. |
| uint32_t length | Length of the sub-styled string. The value range is [0, difference between the length of the styled string and the value of start]. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_StyledString_Descriptor_GetStyles()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_GetStyles(const ArkUI_StyledString_Descriptor* descriptor, uint32_t start, uint32_t length, OH_ArkUI_StyledStringKey styledKey, OH_ArkUI_SpanStyle** styles, uint32_t stylesSize, uint32_t* writeLength)
Description
Obtains the style set within a specified range of a styled string.
Since: 24
Parameters
| Name | Description |
|---|---|
| const ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
| uint32_t start | Start position of the specified range. The value range is [0, length of the styled string]. |
| uint32_t length | Length of the specified range. The value range is [0, difference between the length of the styled string and the value of start]. |
| OH_ArkUI_StyledStringKey styledKey | Style type to be obtained. The value is an enumerated value of OH_ArkUI_StyledStringKey. |
| OH_ArkUI_SpanStyle** styles | Pointer to the buffer of the style object array. |
| uint32_t stylesSize | Size of the buffer for the style object array. |
| uint32_t* writeLength | Pointer to the actual size of the array of the style object obtained from the styled string. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. Returns ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR if the buffer size is insufficient. |
OH_ArkUI_StyledString_Descriptor_FromHtml()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_FromHtml(ArkUI_StyledString_Descriptor* descriptor, const char* html)
Description
Converts an HTML string to a styled string.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
| const char* html | Pointer to the HTML string to be converted into a styled string. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_StyledString_Descriptor_ReplaceString()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_ReplaceString(ArkUI_StyledString_Descriptor* descriptor, uint32_t start, uint32_t length, const char* string)
Description
Replaces the text within a specified range of a styled string.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
| uint32_t start | Start position of the specified range. The value range is [0, length of the styled string]. |
| uint32_t length | Length of the specified range. The value range is [0, difference between the length of the styled string and the value of start]. |
| const char* string | Pointer to the string to replace the content in the target range. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_StyledString_Descriptor_InsertString()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_InsertString(ArkUI_StyledString_Descriptor* descriptor, uint32_t start, const char* string)
Description
Inserts text at a specified position of a styled string.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
| uint32_t start | Insertion position. The value range is [0, length of the styled string]. |
| const char* string | Pointer to the string to insert. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_StyledString_Descriptor_RemoveString()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_RemoveString(ArkUI_StyledString_Descriptor* descriptor, uint32_t start, uint32_t length)
Description
Removes the text within a specified range of a styled string.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
| uint32_t start | Start position of the specified range. The value range is [0, length of the styled string]. |
| uint32_t length | Length of the specified range. The value range is [0, difference between the length of the styled string and the value of start]. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_StyledString_Descriptor_ReplaceStyle()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_ReplaceStyle(ArkUI_StyledString_Descriptor* descriptor, const OH_ArkUI_SpanStyle* spanStyle)
Description
Replaces the style within a specified range of a styled string.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. You need to call OH_ArkUI_SpanStyle_SetStart and OH_ArkUI_SpanStyle_SetLength to set the target range in the object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_StyledString_Descriptor_SetStyle()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_SetStyle(ArkUI_StyledString_Descriptor* descriptor, const OH_ArkUI_SpanStyle* spanStyle)
Description
Sets a new style for a specified range of a styled string.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. You need to call OH_ArkUI_SpanStyle_SetStart and OH_ArkUI_SpanStyle_SetLength to set the target range in the object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_StyledString_Descriptor_RemoveStyle()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_RemoveStyle(ArkUI_StyledString_Descriptor* descriptor, uint32_t start, uint32_t length, OH_ArkUI_StyledStringKey styledKey)
Description
Removes the specified style for a specified range of a styled string.
NOTE
After the style is removed, the default value of the corresponding attribute of the TextEditor component is used.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
| uint32_t start | Start position of the specified range. The value range is [0, length of the styled string]. |
| uint32_t length | Length of the specified range. The value range is [0, difference between the length of the styled string and the value of start]. |
| OH_ArkUI_StyledStringKey styledKey | Style type. The value is an enumerated value of OH_ArkUI_StyledStringKey. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_StyledString_Descriptor_ClearStyles()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_ClearStyles(ArkUI_StyledString_Descriptor* descriptor)
Description
Clears all styles of a styled string.
NOTE
After the styles are cleared, the default value of the corresponding attribute of the TextEditor component is used.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_StyledString_Descriptor_ReplaceStyledString()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_ReplaceStyledString(ArkUI_StyledString_Descriptor* descriptor, uint32_t start, uint32_t length, const ArkUI_StyledString_Descriptor* other)
Description
Replaces the styled string within a specified range.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
| uint32_t start | Start position of the specified range. The value range is [0, length of the styled string]. |
| uint32_t length | Length of the specified range. The value range is [0, difference between the length of the styled string and the value of start]. |
| const ArkUI_StyledString_Descriptor* other | Pointer to the new ArkUI_StyledString_Descriptor object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_StyledString_Descriptor_InsertStyledString()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_InsertStyledString(ArkUI_StyledString_Descriptor* descriptor, uint32_t start, const ArkUI_StyledString_Descriptor* other)
Description
Inserts a new styled string at a specified position of a styled string.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
| uint32_t start | Insertion position. The value range is [0, length of the styled string]. |
| const ArkUI_StyledString_Descriptor* other | Pointer to the new ArkUI_StyledString_Descriptor object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_StyledString_Descriptor_AppendStyledString()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_AppendStyledString(ArkUI_StyledString_Descriptor* descriptor, const ArkUI_StyledString_Descriptor* other)
Description
Appends a new styled string to the end of a styled string.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
| const ArkUI_StyledString_Descriptor* other | Pointer to the new ArkUI_StyledString_Descriptor object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_StyledString_Descriptor_InvalidateCustomSpan()
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_InvalidateCustomSpan(const ArkUI_StyledString_Descriptor* descriptor)
Description
Actively refreshes the custom span in a styled string.
NOTE
Calling this API immediately triggers the callback function registered on the custom span using OH_ArkUI_CustomSpan_RegisterOnDrawCallback.
Since: 24
Parameters
| Name | Description |
|---|---|
| const ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. |
OH_ArkUI_TextStyle_Create()
OH_ArkUI_TextStyle* OH_ArkUI_TextStyle_Create()
Description
Creates an OH_ArkUI_TextStyle object.
NOTE
When the object is no longer used, call OH_ArkUI_TextStyle_Destroy to destroy it.
Since: 24
Return value
| Type | Description |
|---|---|
| OH_ArkUI_TextStyle* | Pointer to the OH_ArkUI_TextStyle object. |
OH_ArkUI_TextStyle_Destroy()
void OH_ArkUI_TextStyle_Destroy(OH_ArkUI_TextStyle* textStyle)
Description
Releases the memory occupied by the OH_ArkUI_TextStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
OH_ArkUI_TextStyle_SetFontColor()
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetFontColor(OH_ArkUI_TextStyle* textStyle, uint32_t fontColor)
Description
Sets text color for a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| uint32_t fontColor | Font color, in 0xARGB format. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextStyle_GetFontColor()
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetFontColor(const OH_ArkUI_TextStyle* textStyle, uint32_t* fontColor)
Description
Obtains the text color of a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| uint32_t* fontColor | Pointer to the font color, in 0xARGB format. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextStyle_SetFontFamily()
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetFontFamily(OH_ArkUI_TextStyle* textStyle, const char* fontFamily)
Description
Sets a font family for a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| const char* fontFamily | Pointer to the font family, containing the font names to be set. Different font names are separated by commas (,). |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextStyle_GetFontFamily()
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetFontFamily(const OH_ArkUI_TextStyle* textStyle, char* buffer, int32_t bufferSize, int32_t* writeLength)
Description
Obtains the font family of a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| char* buffer | Pointer to the buffer for storing the font family in the memory. You need to allocate the memory. |
| int32_t bufferSize | Maximum number of characters that can be written to the buffer. |
| int32_t* writeLength | Pointer to the length of the string actually written to the buffer if ARKUI_ERROR_CODE_NO_ERROR is returned. Pointer to the minimum length required for writing the entire string to the buffer if ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR is returned. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR if the buffer size is insufficient. |
OH_ArkUI_TextStyle_SetFontSize()
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetFontSize(OH_ArkUI_TextStyle* textStyle, float fontSize)
Description
Sets font size for a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| float fontSize | Font size, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextStyle_GetFontSize()
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetFontSize(const OH_ArkUI_TextStyle* textStyle, float* fontSize)
Description
Obtains the font size of a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| float* fontSize | Pointer to the font size, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextStyle_SetFontWeight()
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetFontWeight(OH_ArkUI_TextStyle* textStyle, uint32_t fontWeight)
Description
Sets font weight for a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| uint32_t fontWeight | Font weight. The value is an integer multiple of 100 within the [100, 900] range, for example, 100 or 900. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextStyle_GetFontWeight()
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetFontWeight(const OH_ArkUI_TextStyle* textStyle, uint32_t* fontWeight)
Description
Obtains the font weight of a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| uint32_t* fontWeight | Pointer to the font weight. The value is an integer multiple of 100 within the [100, 900] range, for example, 100 or 900. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextStyle_SetFontStyle()
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetFontStyle(OH_ArkUI_TextStyle* textStyle, ArkUI_FontStyle fontStyle)
Description
Sets font style for a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| ArkUI_FontStyle fontStyle | Font style. The value is an enumerated value of ArkUI_FontStyle. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextStyle_GetFontStyle()
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetFontStyle(const OH_ArkUI_TextStyle* textStyle, ArkUI_FontStyle* fontStyle)
Description
Obtains the font style of a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| ArkUI_FontStyle* fontStyle | Pointer to the font style. The value is an enumerated value of ArkUI_FontStyle. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextStyle_SetStrokeWidth()
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetStrokeWidth(OH_ArkUI_TextStyle* textStyle, float strokeWidth)
Description
Sets stroke width for a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| float strokeWidth | Stroke width, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextStyle_GetStrokeWidth()
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetStrokeWidth(const OH_ArkUI_TextStyle* textStyle, float* strokeWidth)
Description
Obtains the stroke width of a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| float* strokeWidth | Pointer to the stroke width, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextStyle_SetStrokeColor()
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetStrokeColor(OH_ArkUI_TextStyle* textStyle, uint32_t strokeColor)
Description
Sets a stroke color for a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| uint32_t strokeColor | Stroke color, in 0xARGB format. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextStyle_GetStrokeColor()
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetStrokeColor(const OH_ArkUI_TextStyle* textStyle, uint32_t* strokeColor)
Description
Obtains the stroke color of a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| uint32_t* strokeColor | Pointer to the stroke color, in 0xARGB format. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextStyle_SetSuperscript()
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetSuperscript(OH_ArkUI_TextStyle* textStyle, OH_ArkUI_SuperscriptStyle superscript)
Description
Sets superscript and subscript styles for a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| OH_ArkUI_SuperscriptStyle superscript | Superscript and subscript styles. The value is an enumerated value of OH_ArkUI_SuperscriptStyle. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextStyle_GetSuperscript()
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetSuperscript(const OH_ArkUI_TextStyle* textStyle, OH_ArkUI_SuperscriptStyle* superscript)
Description
Obtains the superscript and subscript styles of a text font style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
| OH_ArkUI_SuperscriptStyle* superscript | Pointer to the superscript and subscript styles. The value is an enumerated value of OH_ArkUI_SuperscriptStyle. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_Create()
OH_ArkUI_SpanStyle* OH_ArkUI_SpanStyle_Create()
Description
Creates an OH_ArkUI_SpanStyle object.
NOTE
When the object is no longer used, call OH_ArkUI_SpanStyle_Destroy to destroy it.
Since: 24
Return value
| Type | Description |
|---|---|
| OH_ArkUI_SpanStyle* | Pointer to the OH_ArkUI_SpanStyle object. |
OH_ArkUI_SpanStyle_Destroy()
void OH_ArkUI_SpanStyle_Destroy(OH_ArkUI_SpanStyle* spanStyle)
Description
Releases the memory occupied by the OH_ArkUI_SpanStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
OH_ArkUI_SpanStyle_GetStyledKey()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetStyledKey(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_StyledStringKey* styledKey)
Description
Obtains the style of the styled string object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| OH_ArkUI_StyledStringKey* styledKey | Pointer to the style type. The value is an enumerated value of OH_ArkUI_StyledStringKey. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetStart()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetStart(OH_ArkUI_SpanStyle* spanStyle, int32_t start)
Description
Sets the start position for the styled string object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| int32_t start | Start position of the styled string style object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetStart()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetStart(const OH_ArkUI_SpanStyle* spanStyle, int32_t* start)
Description
Obtains the start position of the styled string object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| int32_t* start | Pointer to the start position of the styled string style object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetLength()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetLength(OH_ArkUI_SpanStyle* spanStyle, int32_t length)
Description
Sets the length for the styled string object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| int32_t length | Length of the styled string style object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetLength()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetLength(const OH_ArkUI_SpanStyle* spanStyle, int32_t* length)
Description
Obtains the length of the styled string object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| int32_t* length | Pointer to the length of the styled string style object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetTextStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetTextStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_TextStyle* textStyle)
Description
Sets the text font style for the styled string object.
NOTE
This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| const OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetTextStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetTextStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_TextStyle* textStyle)
Description
Obtains the text font style of the styled string object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| OH_ArkUI_TextStyle* textStyle | Pointer to the OH_ArkUI_TextStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetParagraphStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetParagraphStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_ParagraphStyle* paragraphStyle)
Description
Sets the paragraph style for the styled string object.
NOTE
This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| const OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetParagraphStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetParagraphStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_ParagraphStyle* paragraphStyle)
Description
Obtains the paragraph style of the styled string object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetGestureStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetGestureStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_GestureStyle* gestureStyle)
Description
Sets the gesture style for the styled string object.
NOTE
This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| const OH_ArkUI_GestureStyle* gestureStyle | Pointer to the OH_ArkUI_GestureStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetGestureStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetGestureStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_GestureStyle* gestureStyle)
Description
Obtains the gesture style of the styled string object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| OH_ArkUI_GestureStyle* gestureStyle | Pointer to the OH_ArkUI_GestureStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetTextShadowStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetTextShadowStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_TextShadowStyle* textShadowStyle)
Description
Sets the text shadow style for the styled string object.
NOTE
This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| const OH_ArkUI_TextShadowStyle* textShadowStyle | Pointer to the OH_ArkUI_TextShadowStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetTextShadowStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetTextShadowStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_TextShadowStyle* textShadowStyle)
Description
Obtains the text shadow style of the styled string style object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| OH_ArkUI_TextShadowStyle* textShadowStyle | Pointer to the OH_ArkUI_TextShadowStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetDecorationStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetDecorationStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_DecorationStyle* decorationStyle)
Description
Sets the text decorative line style for the styled string style object.
NOTE
This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| const OH_ArkUI_DecorationStyle* decorationStyle | Pointer to the OH_ArkUI_DecorationStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetDecorationStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetDecorationStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_DecorationStyle* decorationStyle)
Description
Obtains the text decorative line style of the styled string style object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| OH_ArkUI_DecorationStyle* decorationStyle | Pointer to the OH_ArkUI_DecorationStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetBaselineOffsetStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetBaselineOffsetStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle)
Description
Sets the baseline offset style for the styled string style object.
NOTE
This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| const OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle | Pointer to the OH_ArkUI_BaselineOffsetStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetBaselineOffsetStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetBaselineOffsetStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle)
Description
Obtains the baseline offset style of the styled string style object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle | Pointer to the OH_ArkUI_BaselineOffsetStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetLetterSpacingStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetLetterSpacingStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_LetterSpacingStyle* letterSpacingStyle)
Description
Sets the letter spacing style for the styled string style object.
NOTE
This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| const OH_ArkUI_LetterSpacingStyle* letterSpacingStyle | Pointer to the OH_ArkUI_LetterSpacingStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetLetterSpacingStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetLetterSpacingStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_LetterSpacingStyle* letterSpacingStyle)
Description
Obtains the letter spacing style of the styled string style object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| OH_ArkUI_LetterSpacingStyle* letterSpacingStyle | Pointer to the OH_ArkUI_LetterSpacingStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetLineHeightStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetLineHeightStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_LineHeightStyle* lineHeightStyle)
Description
Sets the line height style for the styled string style object.
NOTE
This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| const OH_ArkUI_LineHeightStyle* lineHeightStyle | Pointer to the OH_ArkUI_LineHeightStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetLineHeightStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetLineHeightStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_LineHeightStyle* lineHeightStyle)
Description
Obtains the line height style of the styled string style object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| OH_ArkUI_LineHeightStyle* lineHeightStyle | Pointer to the OH_ArkUI_LineHeightStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetUrlStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetUrlStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_UrlStyle* urlStyle)
Description
Sets the URL style for the styled string style object.
NOTE
This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| const OH_ArkUI_UrlStyle* urlStyle | Pointer to the OH_ArkUI_UrlStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetUrlStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetUrlStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_UrlStyle* urlStyle)
Description
Obtains the URL style of the styled string style object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| OH_ArkUI_UrlStyle* urlStyle | Pointer to the OH_ArkUI_UrlStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetBackgroundColorStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetBackgroundColorStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_BackgroundColorStyle* backgroundColorStyle)
Description
Sets the background color style for the styled string style object.
NOTE
This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| const OH_ArkUI_BackgroundColorStyle* backgroundColorStyle | Pointer to the OH_ArkUI_BackgroundColorStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetBackgroundColorStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetBackgroundColorStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_BackgroundColorStyle* backgroundColorStyle)
Description
Obtains the background color style of the styled string style object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| OH_ArkUI_BackgroundColorStyle* backgroundColorStyle | Pointer to the OH_ArkUI_BackgroundColorStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetUserDataSpan()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetUserDataSpan(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_UserDataSpan* userDataSpan)
Description
Sets the user data span style for the styled string style object.
NOTE
This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| const OH_ArkUI_UserDataSpan* userDataSpan | Pointer to the OH_ArkUI_UserDataSpan object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetUserDataSpan()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetUserDataSpan(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_UserDataSpan* userDataSpan)
Description
Obtains the user data span style of the styled string style object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| OH_ArkUI_UserDataSpan* userDataSpan | Pointer to the OH_ArkUI_UserDataSpan object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetCustomSpan()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetCustomSpan(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_CustomSpan* customSpan)
Description
Sets the custom span style for the styled string style object.
NOTE
This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| const OH_ArkUI_CustomSpan* customSpan | Pointer to the OH_ArkUI_CustomSpan object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetCustomSpan()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetCustomSpan(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_CustomSpan* customSpan)
Description
Obtains the custom span style of the styled string style object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| OH_ArkUI_CustomSpan* customSpan | Pointer to the OH_ArkUI_CustomSpan object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetImageAttachment()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetImageAttachment(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_ImageAttachment* imageAttachment)
Description
Sets the image style for the styled string style object.
NOTE
This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| const OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetImageAttachment()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetImageAttachment(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_ImageAttachment* imageAttachment)
Description
Obtains the image style of the styled string style object.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_Create()
OH_ArkUI_LeadingMarginSpanDrawInfo* OH_ArkUI_LeadingMarginSpanDrawInfo_Create()
Description
Creates an OH_ArkUI_LeadingMarginSpanDrawInfo object.
NOTE
When the object is no longer used, call OH_ArkUI_LeadingMarginSpanDrawInfo_Destroy to destroy it.
Since: 24
Return value
| Type | Description |
|---|---|
| OH_ArkUI_LeadingMarginSpanDrawInfo* | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
OH_ArkUI_LeadingMarginSpanDrawInfo_Destroy()
void OH_ArkUI_LeadingMarginSpanDrawInfo_Destroy(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo)
Description
Releases the memory occupied by the OH_ArkUI_LeadingMarginSpanDrawInfo object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
OH_ArkUI_LeadingMarginSpanDrawInfo_SetX()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetX(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float x)
Description
Sets the horizontal offset of the current line relative to the component in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| float x | Horizontal offset of the current line relative to the component, in px. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_GetX()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetX(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float* x)
Description
Obtains the horizontal offset of the current line relative to the component in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| float* x | Pointer to the horizontal offset of the current line relative to the component, in px. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_SetTop()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetTop(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float top)
Description
Sets the distance between the top of a line and the top edge of the component in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| float top | Distance between the top of a line and the top edge of the component, in px. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_GetTop()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetTop(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float* top)
Description
Obtains the distance between the top of a line and the top edge of the component in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| float* top | Pointer to the distance between the top of a line and the top edge of the component, in px. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_SetBottom()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetBottom(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float bottom)
Description
Sets the distance between the bottom of a line and the top edge of the component in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| float bottom | Distance between the bottom of a line and the top edge of the component, in px. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_GetBottom()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetBottom(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float* bottom)
Description
Obtains the distance between the bottom of a line and the top edge of the component in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| float* bottom | Pointer to the distance between the bottom of a line and the top edge of the component, in px. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_SetBaseline()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetBaseline(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float baseline)
Description
Sets the distance between the baseline of the current line and the top edge of the component in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| float baseline | Distance between the baseline of the current line and the top edge of the component, in px. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_GetBaseline()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetBaseline(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float* baseline)
Description
Obtains the distance between the baseline of the current line and the top edge of the component in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| float* baseline | Pointer to the distance between the baseline of the current line and the top edge of the component, in px. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_SetTextDirection()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetTextDirection(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, ArkUI_TextDirection direction)
Description
Sets the text direction in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| ArkUI_TextDirection direction | Text direction. The value is an enumerated value of ArkUI_TextDirection. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_GetTextDirection()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetTextDirection(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, ArkUI_TextDirection* direction)
Description
Obtains the text direction in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| ArkUI_TextDirection* direction | Pointer to the text direction. The value is an enumerated value of ArkUI_TextDirection. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_SetStart()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetStart(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, uint32_t start)
Description
Sets the start index of the current line in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| uint32_t start | Start index of the current line. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_GetStart()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetStart(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, uint32_t* start)
Description
Obtains the start index of the current line in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| uint32_t* start | Pointer to the start index of the current line. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_SetEnd()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetEnd(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, uint32_t end)
Description
Sets the end index of the current line in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| uint32_t end | End index of the current line. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_GetEnd()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetEnd(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, uint32_t* end)
Description
Obtains the end index of the current line in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| uint32_t* end | Pointer to the end index of the current line. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_SetFirst()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetFirst(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, bool first)
Description
Sets whether the current line is the first line of the paragraph in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| bool first | Whether the current line is the first line of the paragraph. true indicates the first line, and false indicates the opposite. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LeadingMarginSpanDrawInfo_GetFirst()
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetFirst(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, bool* first)
Description
Obtains whether the current line is the first line of the paragraph in the custom drawing information object for paragraph indentation.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo | Pointer to the OH_ArkUI_LeadingMarginSpanDrawInfo object. |
| bool* first | Pointer to the first parameter indicating whether the current line is the first line of the paragraph. true indicates the first line, and false indicates the opposite. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_Create()
OH_ArkUI_ParagraphStyle* OH_ArkUI_ParagraphStyle_Create()
Description
Creates an OH_ArkUI_ParagraphStyle object.
NOTE
When the object is no longer used, call OH_ArkUI_ParagraphStyle_Destroy to destroy it.
Since: 24
Return value
| Type | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* | Pointer to the OH_ArkUI_ParagraphStyle object. |
OH_ArkUI_ParagraphStyle_Destroy()
void OH_ArkUI_ParagraphStyle_Destroy(OH_ArkUI_ParagraphStyle* paragraphStyle)
Description
Releases the memory occupied by the OH_ArkUI_ParagraphStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
OH_ArkUI_ParagraphStyle_SetTextAlign()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetTextAlign(OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextAlignment align)
Description
Sets the horizontal text alignment method in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| ArkUI_TextAlignment align | Horizontal text alignment method. The value is an enumerated value of ArkUI_TextAlignment. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_GetTextAlign()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetTextAlign(const OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextAlignment* align)
Description
Obtains the horizontal text alignment method in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| ArkUI_TextAlignment* align | Pointer to the horizontal text alignment method. The value is an enumerated value of ArkUI_TextAlignment. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_SetTextIndent()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetTextIndent(OH_ArkUI_ParagraphStyle* paragraphStyle, float textIndent)
Description
Sets the first-line text indentation in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| float textIndent | First-line indentation value, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_GetTextIndent()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetTextIndent(const OH_ArkUI_ParagraphStyle* paragraphStyle, float* textIndent)
Description
Obtains the first-line text indentation in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| float* textIndent | Pointer to the first-line indentation value, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_SetMaxLines()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetMaxLines(OH_ArkUI_ParagraphStyle* paragraphStyle, int32_t maxLines)
Description
Sets the maximum number of lines in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| int32_t maxLines | Maximum number of lines. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_GetMaxLines()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetMaxLines(const OH_ArkUI_ParagraphStyle* paragraphStyle, int32_t* maxLines)
Description
Obtains the maximum number of lines in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| int32_t* maxLines | Pointer to the maximum number of lines. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_SetOverflow()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetOverflow(OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextOverflow overflow)
Description
Sets the display mode when the paragraph is too long in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| ArkUI_TextOverflow overflow | Display mode when the paragraph is too long. The value is an enumerated value of ArkUI_TextOverflow. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_GetOverflow()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetOverflow(const OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextOverflow* overflow)
Description
Obtains the display mode when the paragraph is too long in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| ArkUI_TextOverflow* overflow | Pointer to the display mode when the paragraph is too long. The value is an enumerated value of ArkUI_TextOverflow. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_SetWordBreak()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetWordBreak(OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_WordBreak wordBreak)
Description
Sets the word breaking rule in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| ArkUI_WordBreak wordBreak | Word breaking rule. The value is an enumerated value of ArkUI_WordBreak. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_GetWordBreak()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetWordBreak(const OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_WordBreak* wordBreak)
Description
Obtains the word breaking rule in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| ArkUI_WordBreak* wordBreak | Pointer to the word breaking rule. The value is an enumerated value of ArkUI_WordBreak. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_SetLeadingMarginPixelMap()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetLeadingMarginPixelMap(OH_ArkUI_ParagraphStyle* paragraphStyle, struct OH_PixelmapNative* pixelmap)
Description
Sets the PixelMap for paragraph indentation in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| struct OH_PixelmapNative* pixelmap | Pointer to the PixelMap for paragraph indentation. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_GetLeadingMarginPixelMap()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetLeadingMarginPixelMap(const OH_ArkUI_ParagraphStyle* paragraphStyle, struct OH_PixelmapNative** pixelmap)
Description
Obtains the PixelMap for paragraph indentation in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| struct OH_PixelmapNative** pixelmap | Double pointer to the PixelMap for paragraph indentation. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_SetLeadingMarginWidth()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetLeadingMarginWidth(OH_ArkUI_ParagraphStyle* paragraphStyle, uint32_t width)
Description
Sets the width for paragraph indentation in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| uint32_t width | Width for paragraph indentation, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_GetLeadingMarginWidth()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetLeadingMarginWidth(const OH_ArkUI_ParagraphStyle* paragraphStyle, uint32_t* width)
Description
Obtains the width for paragraph indentation in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| uint32_t* width | Pointer to the width for paragraph indentation, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_SetLeadingMarginHeight()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetLeadingMarginHeight(OH_ArkUI_ParagraphStyle* paragraphStyle, uint32_t height)
Description
Sets the height for paragraph indentation in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| uint32_t height | Height for paragraph indentation, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_GetLeadingMarginHeight()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetLeadingMarginHeight(const OH_ArkUI_ParagraphStyle* paragraphStyle, uint32_t* height)
Description
Obtains the height for paragraph indentation in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| uint32_t* height | Pointer to the height for paragraph indentation, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_SetParagraphSpacing()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetParagraphSpacing(OH_ArkUI_ParagraphStyle* paragraphStyle, uint32_t paragraphSpacing)
Description
Sets the paragraph spacing in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| uint32_t paragraphSpacing | Paragraph spacing, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_GetParagraphSpacing()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetParagraphSpacing(const OH_ArkUI_ParagraphStyle* paragraphStyle, uint32_t* paragraphSpacing)
Description
Obtains the paragraph spacing in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| uint32_t* paragraphSpacing | Pointer to the paragraph spacing, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_SetTextVerticalAlign()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetTextVerticalAlign(OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextVerticalAlignment verticalAlignment)
Description
Sets the vertical text alignment method in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| ArkUI_TextVerticalAlignment verticalAlignment | Vertical text alignment method. The value is an enumerated value of ArkUI_TextVerticalAlignment. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_GetTextVerticalAlign()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetTextVerticalAlign(const OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextVerticalAlignment* verticalAlignment)
Description
Obtains the vertical text alignment method in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| ArkUI_TextVerticalAlignment* verticalAlignment | Pointer to the vertical text alignment method. The value is an enumerated value of ArkUI_TextVerticalAlignment. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_RegisterOnDrawLeadingMarginCallback()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_RegisterOnDrawLeadingMarginCallback(OH_ArkUI_ParagraphStyle* paragraphStyle, void(*onDraw)(ArkUI_DrawContext* context, OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo))
Description
Sets the callback function triggered when the paragraph indentation is drawn in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| void(*onDraw)(ArkUI_DrawContext* context | Callback function triggered when the paragraph indentation is drawn. context indicates the graphics drawing context. drawInfo indicates the custom drawing information. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_RegisterOnGetLeadingMarginCallback()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_RegisterOnGetLeadingMarginCallback(OH_ArkUI_ParagraphStyle* paragraphStyle, float(*leadingMargin)())
Description
Sets the callback function triggered when the paragraph indentation distance is obtained in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| float(*leadingMargin)() | Callback function triggered when the paragraph indentation distance is obtained. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_SetTextDirection()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetTextDirection(OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextDirection textDirection)
Description
Sets the text direction in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| ArkUI_TextDirection textDirection | Text direction. The value is an enumerated value of ArkUI_TextDirection. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_GetTextDirection()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetTextDirection(const OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextDirection* textDirection)
Description
Obtains the text direction in the paragraph style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| ArkUI_TextDirection* textDirection | Pointer to the text direction. The value is an enumerated value of ArkUI_TextDirection. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_GestureStyle_Create()
OH_ArkUI_GestureStyle* OH_ArkUI_GestureStyle_Create()
Description
Creates an OH_ArkUI_GestureStyle object.
NOTE
When the object is no longer used, call OH_ArkUI_GestureStyle_Destroy to destroy it.
Since: 24
Return value
| Type | Description |
|---|---|
| OH_ArkUI_GestureStyle* | Pointer to the OH_ArkUI_GestureStyle object. |
OH_ArkUI_GestureStyle_Destroy()
void OH_ArkUI_GestureStyle_Destroy(OH_ArkUI_GestureStyle* gestureStyle)
Description
Releases the memory occupied by the OH_ArkUI_GestureStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_GestureStyle* gestureStyle | Pointer to the OH_ArkUI_GestureStyle object. |
OH_ArkUI_GestureStyle_RegisterOnClickCallback()
ArkUI_ErrorCode OH_ArkUI_GestureStyle_RegisterOnClickCallback(OH_ArkUI_GestureStyle* gestureStyle, void(*onClick)(ArkUI_NodeEvent*))
Description
Sets the click event callback in the event gesture style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_GestureStyle* gestureStyle | Pointer to the OH_ArkUI_GestureStyle object. |
| void(*onClick)(ArkUI_NodeEvent*) | Callback of the click event. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_GestureStyle_RegisterOnLongPressCallback()
ArkUI_ErrorCode OH_ArkUI_GestureStyle_RegisterOnLongPressCallback(OH_ArkUI_GestureStyle* gestureStyle, void(*onLongPress)(ArkUI_GestureEvent*))
Description
Sets the long-pressing event callback in the event gesture style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_GestureStyle* gestureStyle | Pointer to the OH_ArkUI_GestureStyle object. |
| void(*onLongPress)(ArkUI_GestureEvent*) | Callback of the long-pressing event. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_GestureStyle_RegisterOnTouchCallback()
ArkUI_ErrorCode OH_ArkUI_GestureStyle_RegisterOnTouchCallback(OH_ArkUI_GestureStyle* gestureStyle, void(*onTouch)(ArkUI_NodeEvent*))
Description
Sets the touch event callback in the event gesture style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_GestureStyle* gestureStyle | Pointer to the OH_ArkUI_GestureStyle object. |
| void(*onTouch)(ArkUI_NodeEvent*) | Callback of the touch event. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextShadowStyle_Create()
OH_ArkUI_TextShadowStyle* OH_ArkUI_TextShadowStyle_Create()
Description
Creates an OH_ArkUI_TextShadowStyle object.
NOTE
When the object is no longer used, call OH_ArkUI_TextShadowStyle_Destroy to destroy it.
Since: 24
Return value
| Type | Description |
|---|---|
| OH_ArkUI_TextShadowStyle* | Pointer to the OH_ArkUI_TextShadowStyle object. |
OH_ArkUI_TextShadowStyle_Destroy()
void OH_ArkUI_TextShadowStyle_Destroy(OH_ArkUI_TextShadowStyle* textShadowStyle)
Description
Releases the memory occupied by the OH_ArkUI_TextShadowStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_TextShadowStyle* textShadowStyle | Pointer to the OH_ArkUI_TextShadowStyle object. |
OH_ArkUI_TextShadowStyle_SetTextShadow()
ArkUI_ErrorCode OH_ArkUI_TextShadowStyle_SetTextShadow(OH_ArkUI_TextShadowStyle* textShadowStyle, const OH_ArkUI_ShadowOptions** options, uint32_t length)
Description
Sets the text shadow options for the text shadow style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_TextShadowStyle* textShadowStyle | Pointer to the OH_ArkUI_TextShadowStyle object. |
| const OH_ArkUI_ShadowOptions** options | Double pointer to the text shadow options, which points to an array of the OH_ArkUI_ShadowOptions object. |
| uint32_t length | Length of the text shadow options. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextShadowStyle_GetTextShadow()
ArkUI_ErrorCode OH_ArkUI_TextShadowStyle_GetTextShadow(const OH_ArkUI_TextShadowStyle* textShadowStyle, OH_ArkUI_ShadowOptions** shadowOptions, uint32_t shadowOptionsSize, uint32_t* writeLength)
Description
Obtains the text shadow options of the text shadow style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_TextShadowStyle* textShadowStyle | Pointer to the OH_ArkUI_TextShadowStyle object. |
| OH_ArkUI_ShadowOptions** shadowOptions | Double pointer to the text shadow options, which points to an array of the OH_ArkUI_ShadowOptions object. |
| uint32_t shadowOptionsSize | Size of the shadow option buffer. |
| uint32_t* writeLength | Pointer to the number of actual text shadow options in the text shadow style. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR if the buffer size is insufficient. |
OH_ArkUI_DecorationStyle_Create()
OH_ArkUI_DecorationStyle* OH_ArkUI_DecorationStyle_Create()
Description
Creates an OH_ArkUI_DecorationStyle object.
NOTE
When the object is no longer used, call OH_ArkUI_DecorationStyle_Destroy to destroy it.
Since: 24
Return value
| Type | Description |
|---|---|
| OH_ArkUI_DecorationStyle* | Pointer to the OH_ArkUI_DecorationStyle object. |
OH_ArkUI_DecorationStyle_Destroy()
void OH_ArkUI_DecorationStyle_Destroy(OH_ArkUI_DecorationStyle* decorationStyle)
Description
Releases the memory occupied by the OH_ArkUI_DecorationStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_DecorationStyle* decorationStyle | Pointer to the OH_ArkUI_DecorationStyle object. |
OH_ArkUI_DecorationStyle_SetTextDecorationType()
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_SetTextDecorationType(OH_ArkUI_DecorationStyle* decorationStyle, ArkUI_TextDecorationType type)
Description
Sets the decoration type for the text decorative line style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_DecorationStyle* decorationStyle | Pointer to the OH_ArkUI_DecorationStyle object. |
| ArkUI_TextDecorationType type | Type of the text decorative line. The value is an enumerated value of ArkUI_TextDecorationType. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DecorationStyle_GetTextDecorationType()
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_GetTextDecorationType(const OH_ArkUI_DecorationStyle* decorationStyle, ArkUI_TextDecorationType* type)
Description
Obtains the decoration type of the text decorative line style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_DecorationStyle* decorationStyle | Pointer to the OH_ArkUI_DecorationStyle object. |
| ArkUI_TextDecorationType* type | Pointer to the type of the text decorative line. The value is an enumerated value of ArkUI_TextDecorationType. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DecorationStyle_SetColor()
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_SetColor(OH_ArkUI_DecorationStyle* decorationStyle, uint32_t color)
Description
Sets the decoration color for the text decorative line style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_DecorationStyle* decorationStyle | Pointer to the OH_ArkUI_DecorationStyle object. |
| uint32_t color | Decoration color, in 0xARGB format. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DecorationStyle_GetColor()
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_GetColor(const OH_ArkUI_DecorationStyle* decorationStyle, uint32_t* color)
Description
Obtains the decoration color of the text decorative line style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_DecorationStyle* decorationStyle | Pointer to the OH_ArkUI_DecorationStyle object. |
| uint32_t* color | Pointer to the decoration color, in 0xARGB format. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DecorationStyle_SetTextDecorationStyle()
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_SetTextDecorationStyle(OH_ArkUI_DecorationStyle* decorationStyle, ArkUI_TextDecorationStyle style)
Description
Sets the decoration style for the text decorative line style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_DecorationStyle* decorationStyle | Pointer to the OH_ArkUI_DecorationStyle object. |
| ArkUI_TextDecorationStyle style | Style of the text decorative line. The value is an enumerated value of ArkUI_TextDecorationStyle. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DecorationStyle_GetTextDecorationStyle()
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_GetTextDecorationStyle(const OH_ArkUI_DecorationStyle* decorationStyle, ArkUI_TextDecorationStyle* style)
Description
Obtains the decoration style of the text decorative line style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_DecorationStyle* decorationStyle | Pointer to the OH_ArkUI_DecorationStyle object. |
| ArkUI_TextDecorationStyle* style | Pointer to the style of the text decorative line. The value is an enumerated value of ArkUI_TextDecorationStyle. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DecorationStyle_SetThicknessScale()
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_SetThicknessScale(OH_ArkUI_DecorationStyle* decorationStyle, float thicknessScale)
Description
Sets the thickness scaling factor of the text decorative line style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_DecorationStyle* decorationStyle | Pointer to the OH_ArkUI_DecorationStyle object. |
| float thicknessScale | Scaling factor of the decorative line thickness. The value range is [0, +∞). |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DecorationStyle_GetThicknessScale()
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_GetThicknessScale(const OH_ArkUI_DecorationStyle* decorationStyle, float* thicknessScale)
Description
Obtains the thickness scaling factor of the text decorative line style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_DecorationStyle* decorationStyle | Pointer to the OH_ArkUI_DecorationStyle object. |
| float* thicknessScale | Pointer to the scaling factor of the decorative line thickness. The value range is [0, +∞). |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DecorationStyle_SetEnableMultiType()
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_SetEnableMultiType(OH_ArkUI_DecorationStyle* decorationStyle, bool enableMultiType)
Description
Sets whether to enable the display of multiple decorative lines in the text decorative line style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_DecorationStyle* decorationStyle | Pointer to the OH_ArkUI_DecorationStyle object. |
| bool enableMultiType | Whether to enable the display of multiple decorative lines. true to enable; false otherwise. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_DecorationStyle_GetEnableMultiType()
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_GetEnableMultiType(const OH_ArkUI_DecorationStyle* decorationStyle, bool* enableMultiType)
Description
Obtains whether the display of multiple decorative lines is enabled in the text decorative line style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_DecorationStyle* decorationStyle | Pointer to the OH_ArkUI_DecorationStyle object. |
| bool* enableMultiType | Pointer to the enableMultiType parameter indicating whether the display of multiple decorative lines is enabled. true if enabled; false otherwise. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_BaselineOffsetStyle_Create()
OH_ArkUI_BaselineOffsetStyle* OH_ArkUI_BaselineOffsetStyle_Create()
Description
Creates an OH_ArkUI_BaselineOffsetStyle object.
NOTE
When the object is no longer used, call OH_ArkUI_BaselineOffsetStyle_Destroy to destroy it.
Since: 24
Return value
| Type | Description |
|---|---|
| OH_ArkUI_BaselineOffsetStyle* | Pointer to the OH_ArkUI_BaselineOffsetStyle object. |
OH_ArkUI_BaselineOffsetStyle_Destroy()
void OH_ArkUI_BaselineOffsetStyle_Destroy(OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle)
Description
Releases the memory occupied by the OH_ArkUI_BaselineOffsetStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle | Pointer to the OH_ArkUI_BaselineOffsetStyle object. |
OH_ArkUI_BaselineOffsetStyle_SetBaselineOffset()
ArkUI_ErrorCode OH_ArkUI_BaselineOffsetStyle_SetBaselineOffset(OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle, float baselineOffset)
Description
Sets the baseline offset.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle | Pointer to the OH_ArkUI_BaselineOffsetStyle object. |
| float baselineOffset | Baseline offset, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_BaselineOffsetStyle_GetBaselineOffset()
ArkUI_ErrorCode OH_ArkUI_BaselineOffsetStyle_GetBaselineOffset(const OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle, float* baselineOffset)
Description
Obtains the baseline offset.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle | Pointer to the OH_ArkUI_BaselineOffsetStyle object. |
| float* baselineOffset | Pointer to the baseline offset, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LetterSpacingStyle_Create()
OH_ArkUI_LetterSpacingStyle* OH_ArkUI_LetterSpacingStyle_Create()
Description
Creates an OH_ArkUI_LetterSpacingStyle object.
NOTE
When the object is no longer used, call OH_ArkUI_LetterSpacingStyle_Destroy to destroy it.
Since: 24
Return value
| Type | Description |
|---|---|
| OH_ArkUI_LetterSpacingStyle* | Pointer to the OH_ArkUI_LetterSpacingStyle object. |
OH_ArkUI_LetterSpacingStyle_Destroy()
void OH_ArkUI_LetterSpacingStyle_Destroy(OH_ArkUI_LetterSpacingStyle* letterSpacingStyle)
Description
Releases the memory occupied by the OH_ArkUI_LetterSpacingStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LetterSpacingStyle* letterSpacingStyle | Pointer to the OH_ArkUI_LetterSpacingStyle object. |
OH_ArkUI_LetterSpacingStyle_SetLetterSpacing()
ArkUI_ErrorCode OH_ArkUI_LetterSpacingStyle_SetLetterSpacing(OH_ArkUI_LetterSpacingStyle* letterSpacingStyle, float letterSpacing)
Description
Sets the letter spacing.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LetterSpacingStyle* letterSpacingStyle | Pointer to the OH_ArkUI_LetterSpacingStyle object. |
| float letterSpacing | Letter spacing value, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LetterSpacingStyle_GetLetterSpacing()
ArkUI_ErrorCode OH_ArkUI_LetterSpacingStyle_GetLetterSpacing(const OH_ArkUI_LetterSpacingStyle* letterSpacingStyle, float* letterSpacing)
Description
Obtains the letter spacing.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_LetterSpacingStyle* letterSpacingStyle | Pointer to the OH_ArkUI_LetterSpacingStyle object. |
| float* letterSpacing | Pointer to the letter spacing value, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LineHeightStyle_Create()
OH_ArkUI_LineHeightStyle* OH_ArkUI_LineHeightStyle_Create()
Description
Creates an OH_ArkUI_LineHeightStyle object.
NOTE
When the object is no longer used, call OH_ArkUI_LineHeightStyle_Destroy to destroy it.
Since: 24
Return value
| Type | Description |
|---|---|
| OH_ArkUI_LineHeightStyle* | Pointer to the OH_ArkUI_LineHeightStyle object. |
OH_ArkUI_LineHeightStyle_Destroy()
void OH_ArkUI_LineHeightStyle_Destroy(OH_ArkUI_LineHeightStyle* lineHeightStyle)
Description
Releases the memory occupied by the OH_ArkUI_LineHeightStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LineHeightStyle* lineHeightStyle | Pointer to the OH_ArkUI_LineHeightStyle object. |
OH_ArkUI_LineHeightStyle_SetLineHeight()
ArkUI_ErrorCode OH_ArkUI_LineHeightStyle_SetLineHeight(OH_ArkUI_LineHeightStyle* lineHeightStyle, float lineHeight)
Description
Sets the line height.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LineHeightStyle* lineHeightStyle | Pointer to the OH_ArkUI_LineHeightStyle object. |
| float lineHeight | Fixed line height, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LineHeightStyle_GetLineHeight()
ArkUI_ErrorCode OH_ArkUI_LineHeightStyle_GetLineHeight(const OH_ArkUI_LineHeightStyle* lineHeightStyle, float* lineHeight)
Description
Obtains the line height.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_LineHeightStyle* lineHeightStyle | Pointer to the OH_ArkUI_LineHeightStyle object. |
| float* lineHeight | Pointer to the fixed line height, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LineHeightStyle_SetLineHeightMultiple()
ArkUI_ErrorCode OH_ArkUI_LineHeightStyle_SetLineHeightMultiple(OH_ArkUI_LineHeightStyle* lineHeightStyle, float lineHeightMultiple)
Description
Sets a line height multiplier.
NOTE
If both lineHeightMultiple and lineHeight or OH_ArkUI_LineSpacingStyle are set, only lineHeightMultiple takes effect. The line height is the product of the height of the font with the maximum size in the line and the multiplier.
If the value of lineHeightMultiple is less than 0, it does not take effect. In this case, use lineHeight and OH_ArkUI_LineSpacingStyle to set the line height and line spacing.
You can set lineHeight using the OH_ArkUI_LineHeightStyle_SetLineHeight() API.
When lineHeightMultiple is set to 0, it is equivalent to 1.
Since: 26.0.0
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LineHeightStyle* lineHeightStyle | Pointer to the OH_ArkUI_LineHeightStyle object. |
| float lineHeightMultiple | Line height multiplier. The value range is [0, +∞). |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LineHeightStyle_GetLineHeightMultiple()
ArkUI_ErrorCode OH_ArkUI_LineHeightStyle_GetLineHeightMultiple(const OH_ArkUI_LineHeightStyle* lineHeightStyle, float* lineHeightMultiple)
Description
Obtains the line height multiplier.
Since: 26.0.0
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_LineHeightStyle* lineHeightStyle | Pointer to the OH_ArkUI_LineHeightStyle object. |
| float* lineHeightMultiple | Pointer to the line height multiplier. The value range is [0, +∞). |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_SetLineSpacingStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetLineSpacingStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_LineSpacingStyle* lineSpacingStyle)
Description
Sets a line spacing style for the styled string style object.
NOTE
This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object.
Since: 26.0.0
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| const OH_ArkUI_LineSpacingStyle* lineSpacingStyle | Pointer to the OH_ArkUI_LineSpacingStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_SpanStyle_GetLineSpacingStyle()
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetLineSpacingStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_LineSpacingStyle* lineSpacingStyle)
Description
Obtains the line spacing style of the styled string style object.
Since: 26.0.0
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_SpanStyle* spanStyle | Pointer to the OH_ArkUI_SpanStyle object. |
| OH_ArkUI_LineSpacingStyle* lineSpacingStyle | Pointer to the OH_ArkUI_LineSpacingStyle object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LineSpacingStyle_Create()
OH_ArkUI_LineSpacingStyle* OH_ArkUI_LineSpacingStyle_Create()
Description
Creates an OH_ArkUI_LineSpacingStyle object.
NOTE
When the object is no longer used, call OH_ArkUI_LineSpacingStyle_Destroy to destroy it in a timely manner.
Since: 26.0.0
Return value
| Type | Description |
|---|---|
| OH_ArkUI_LineSpacingStyle* | Pointer to the OH_ArkUI_LineSpacingStyle object. |
OH_ArkUI_LineSpacingStyle_Destroy()
void OH_ArkUI_LineSpacingStyle_Destroy(OH_ArkUI_LineSpacingStyle* lineSpacingStyle)
Description
Releases the memory occupied by the OH_ArkUI_LineSpacingStyle object.
Since: 26.0.0
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LineSpacingStyle* lineSpacingStyle | Pointer to the OH_ArkUI_LineSpacingStyle object. |
OH_ArkUI_LineSpacingStyle_SetLineSpacing()
ArkUI_ErrorCode OH_ArkUI_LineSpacingStyle_SetLineSpacing(OH_ArkUI_LineSpacingStyle* lineSpacingStyle, float lineSpacing)
Description
Sets line spacing.
Since: 26.0.0
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LineSpacingStyle* lineSpacingStyle | Pointer to the OH_ArkUI_LineSpacingStyle object. |
| float lineSpacing | Line spacing value, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LineSpacingStyle_GetLineSpacing()
ArkUI_ErrorCode OH_ArkUI_LineSpacingStyle_GetLineSpacing(const OH_ArkUI_LineSpacingStyle* lineSpacingStyle, float* lineSpacing)
Description
Queries the line spacing.
Since: 26.0.0
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_LineSpacingStyle* lineSpacingStyle | Pointer to the OH_ArkUI_LineSpacingStyle object. |
| float* lineSpacing | Pointer to the line spacing value, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LineSpacingStyle_SetOnlyBetweenLines()
ArkUI_ErrorCode OH_ArkUI_LineSpacingStyle_SetOnlyBetweenLines(OH_ArkUI_LineSpacingStyle* lineSpacingStyle, bool onlyBetweenLines)
Description
Sets whether the line spacing takes effect only between lines.
Since: 26.0.0
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_LineSpacingStyle* lineSpacingStyle | Pointer to the OH_ArkUI_LineSpacingStyle object. |
| bool onlyBetweenLines | Whether the line spacing takes effect only between lines. true indicates that the spacing is added only between lines, and no extra spacing is added above the first line or below the last line. false indicates that the complete line spacing is added between all lines, above the first line, and below the last line. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_LineSpacingStyle_GetOnlyBetweenLines()
ArkUI_ErrorCode OH_ArkUI_LineSpacingStyle_GetOnlyBetweenLines(const OH_ArkUI_LineSpacingStyle* lineSpacingStyle, bool* onlyBetweenLines)
Description
Checks whether the line spacing takes effect only between lines.
Since: 26.0.0
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_LineSpacingStyle* lineSpacingStyle | Pointer to the OH_ArkUI_LineSpacingStyle object. |
| bool* onlyBetweenLines | Pointer to the onlyBetweenLines parameter indicating whether the line spacing takes effect only between lines. true indicates that the spacing is added only between lines, and no extra spacing is added above the first line or below the last line. false indicates that the complete line spacing is added between all lines, above the first line, and below the last line. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_BackgroundColorStyle_Create()
OH_ArkUI_BackgroundColorStyle* OH_ArkUI_BackgroundColorStyle_Create()
Description
Creates an OH_ArkUI_BackgroundColorStyle object.
NOTE
When the object is no longer used, call OH_ArkUI_BackgroundColorStyle_Destroy to destroy it.
Since: 24
Return value
| Type | Description |
|---|---|
| OH_ArkUI_BackgroundColorStyle* | Pointer to the OH_ArkUI_BackgroundColorStyle object. |
OH_ArkUI_BackgroundColorStyle_Destroy()
void OH_ArkUI_BackgroundColorStyle_Destroy(OH_ArkUI_BackgroundColorStyle* style)
Description
Releases the memory occupied by the OH_ArkUI_BackgroundColorStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_BackgroundColorStyle* style | Pointer to the OH_ArkUI_BackgroundColorStyle object. |
OH_ArkUI_BackgroundColorStyle_SetColor()
ArkUI_ErrorCode OH_ArkUI_BackgroundColorStyle_SetColor(OH_ArkUI_BackgroundColorStyle* style, uint32_t color)
Description
Sets the background color for the background color style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_BackgroundColorStyle* style | Pointer to the OH_ArkUI_BackgroundColorStyle object. |
| uint32_t color | Background color, in 0xARGB format. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_BackgroundColorStyle_GetColor()
ArkUI_ErrorCode OH_ArkUI_BackgroundColorStyle_GetColor(const OH_ArkUI_BackgroundColorStyle* style, uint32_t* color)
Description
Obtains the background color of the background color style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_BackgroundColorStyle* style | Pointer to the OH_ArkUI_BackgroundColorStyle object. |
| uint32_t* color | Pointer to the background color, in 0xARGB format. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_BackgroundColorStyle_SetRadius()
ArkUI_ErrorCode OH_ArkUI_BackgroundColorStyle_SetRadius(OH_ArkUI_BackgroundColorStyle* style, float topLeft, float topRight, float bottomLeft, float bottomRight)
Description
Sets the background radii for the background color style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_BackgroundColorStyle* style | Pointer to the OH_ArkUI_BackgroundColorStyle object. |
| float topLeft | Radius of the upper left corner, in vp. |
| float topRight | Radius of the upper right corner, in vp. |
| float bottomLeft | Radius of the lower left corner, in vp. |
| float bottomRight | Radius of the lower right corner, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_BackgroundColorStyle_GetRadius()
ArkUI_ErrorCode OH_ArkUI_BackgroundColorStyle_GetRadius(const OH_ArkUI_BackgroundColorStyle* style, float* topLeft, float* topRight, float* bottomLeft, float* bottomRight)
Description
Obtains the background radii of the background color style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_BackgroundColorStyle* style | Pointer to the OH_ArkUI_BackgroundColorStyle object. |
| float* topLeft | Pointer to the radius of the upper left corner, in vp. |
| float* topRight | Pointer to the radius of the upper right corner, in vp. |
| float* bottomLeft | Pointer to the radius of the lower left corner, in vp. |
| float* bottomRight | Pointer to the radius of the lower right corner, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_UrlStyle_Create()
OH_ArkUI_UrlStyle* OH_ArkUI_UrlStyle_Create()
Description
Creates an OH_ArkUI_UrlStyle object.
NOTE
When the object is no longer used, call OH_ArkUI_UrlStyle_Destroy to destroy it.
Since: 24
Return value
| Type | Description |
|---|---|
| OH_ArkUI_UrlStyle* | Pointer to the OH_ArkUI_UrlStyle object. |
OH_ArkUI_UrlStyle_Destroy()
void OH_ArkUI_UrlStyle_Destroy(OH_ArkUI_UrlStyle* style)
Description
Releases the memory occupied by the OH_ArkUI_UrlStyle object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_UrlStyle* style | Pointer to the OH_ArkUI_UrlStyle object. |
OH_ArkUI_UrlStyle_SetUrl()
ArkUI_ErrorCode OH_ArkUI_UrlStyle_SetUrl(OH_ArkUI_UrlStyle* style, const char* url)
Description
Sets the URL content for the URL style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_UrlStyle* style | Pointer to the OH_ArkUI_UrlStyle object. |
| const char* url | Pointer to the URL content. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_UrlStyle_GetUrl()
ArkUI_ErrorCode OH_ArkUI_UrlStyle_GetUrl(const OH_ArkUI_UrlStyle* style, char* buffer, int32_t bufferSize, int32_t* writeLength)
Description
Obtains the URL content of the URL style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_UrlStyle* style | Pointer to the OH_ArkUI_UrlStyle object. |
| char* buffer | Pointer to the buffer for storing the URL content in the memory. You need to allocate the memory. |
| int32_t bufferSize | Maximum number of characters that can be written to the buffer. |
| int32_t* writeLength | Pointer to the number of characters that are actually written to the buffer if ARKUI_ERROR_CODE_NO_ERROR is returned. Pointer to the minimum length required for writing the entire string to the buffer if ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR is returned. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR if the buffer size is insufficient. |
OH_ArkUI_UserDataSpan_Create()
OH_ArkUI_UserDataSpan* OH_ArkUI_UserDataSpan_Create()
Description
Creates an OH_ArkUI_UserDataSpan object.
NOTE
When the object is no longer used, call OH_ArkUI_UserDataSpan_Destroy to destroy it.
Since: 24
Return value
| Type | Description |
|---|---|
| OH_ArkUI_UserDataSpan* | Pointer to the OH_ArkUI_UserDataSpan object. |
OH_ArkUI_UserDataSpan_Destroy()
void OH_ArkUI_UserDataSpan_Destroy(OH_ArkUI_UserDataSpan* userDataSpan)
Description
Releases the memory occupied by the OH_ArkUI_UserDataSpan object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_UserDataSpan* userDataSpan | Pointer to the OH_ArkUI_UserDataSpan object. |
OH_ArkUI_UserDataSpan_SetUserData()
ArkUI_ErrorCode OH_ArkUI_UserDataSpan_SetUserData(OH_ArkUI_UserDataSpan* userDataSpan, void* userData)
Description
Sets the user data in the user data span style.
NOTE
This API allows you to associate custom data of any type with the current style object, in order to store user data in the styled string.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_UserDataSpan* userDataSpan | Pointer to the OH_ArkUI_UserDataSpan object. |
| void* userData | Pointer to the user data. You need to manage the data lifecycle. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_UserDataSpan_GetUserData()
ArkUI_ErrorCode OH_ArkUI_UserDataSpan_GetUserData(const OH_ArkUI_UserDataSpan* userDataSpan, void** userData)
Description
Obtains the user data in the user data span style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_UserDataSpan* userDataSpan | Pointer to the OH_ArkUI_UserDataSpan object. |
| void** userData | Double pointer to the user data. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomSpan_Create()
OH_ArkUI_CustomSpan* OH_ArkUI_CustomSpan_Create()
Description
Creates an OH_ArkUI_CustomSpan object.
NOTE
When the object is no longer used, call OH_ArkUI_CustomSpan_Destroy to destroy it.
Since: 24
Return value
| Type | Description |
|---|---|
| OH_ArkUI_CustomSpan* | Pointer to the OH_ArkUI_CustomSpan object. |
OH_ArkUI_CustomSpan_Destroy()
void OH_ArkUI_CustomSpan_Destroy(OH_ArkUI_CustomSpan* customSpan)
Description
Releases the memory occupied by the OH_ArkUI_CustomSpan object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_CustomSpan* customSpan | Pointer to the OH_ArkUI_CustomSpan object. |
OH_ArkUI_CustomSpan_RegisterOnMeasureCallback()
ArkUI_ErrorCode OH_ArkUI_CustomSpan_RegisterOnMeasureCallback(OH_ArkUI_CustomSpan* customSpan, ArkUI_CustomSpanMetrics*(*onMeasure)(float))
Description
Sets the callback function triggered when metrics are obtained for the custom span.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_CustomSpan* customSpan | Pointer to the OH_ArkUI_CustomSpan object. |
| ArkUI_CustomSpanMetrics*(*onMeasure)(float) | Pointer to the callback function used to obtain the metrics. fontSize indicates the font size of the text in the component, in fp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_CustomSpan_RegisterOnDrawCallback()
ArkUI_ErrorCode OH_ArkUI_CustomSpan_RegisterOnDrawCallback(OH_ArkUI_CustomSpan* customSpan, void(*onDraw)(ArkUI_DrawContext*, ArkUI_CustomSpanDrawInfo*))
Description
Registers the callback function triggered when the custom span is drawn.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_CustomSpan* customSpan | Pointer to the OH_ArkUI_CustomSpan object. |
| void(*onDraw)(ArkUI_DrawContext* | Callback function triggered during drawing. context indicates the graphics drawing context. drawInfo indicates the drawing information of the custom span. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_Create()
OH_ArkUI_ImageAttachment* OH_ArkUI_ImageAttachment_Create()
Description
Creates an OH_ArkUI_ImageAttachment object.
NOTE
When the object is no longer used, call OH_ArkUI_ImageAttachment_Destroy to destroy it.
Since: 24
Return value
| Type | Description |
|---|---|
| OH_ArkUI_ImageAttachment* | Pointer to the OH_ArkUI_ImageAttachment object. |
OH_ArkUI_ImageAttachment_Destroy()
void OH_ArkUI_ImageAttachment_Destroy(OH_ArkUI_ImageAttachment* imageAttachment)
Description
Releases the memory occupied by the OH_ArkUI_ImageAttachment object.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
OH_ArkUI_ImageAttachment_SetPixelMap()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetPixelMap(OH_ArkUI_ImageAttachment* imageAttachment, struct OH_PixelmapNative* pixelmap)
Description
Sets the image data source in the image style.
NOTE
If both this API and OH_ArkUI_ImageAttachment_SetResource are set, the API set later takes effect.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| struct OH_PixelmapNative* pixelmap | Pointer to the image data source. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_GetPixelMap()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetPixelMap(const OH_ArkUI_ImageAttachment* imageAttachment, struct OH_PixelmapNative** pixelmap)
Description
Obtains the image data source in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| struct OH_PixelmapNative** pixelmap | Double pointer to the image data source. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_SetResource()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetResource(OH_ArkUI_ImageAttachment* imageAttachment, const char* resource)
Description
Sets the image resource address in the image style.
NOTE
If both this API and OH_ArkUI_ImageAttachment_SetPixelMap are set, the API set later takes effect.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| const char* resource | Pointer to the image resource address. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_GetResource()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetResource(const OH_ArkUI_ImageAttachment* imageAttachment, char* buffer, int32_t bufferSize, int32_t* writeLength)
Description
Obtains the image resource address in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| char* buffer | Pointer to the buffer for storing the image resource address string in the memory. You need to allocate the memory. |
| int32_t bufferSize | Buffer size. |
| int32_t* writeLength | Pointer to the length of the string actually written to the buffer if ARKUI_ERROR_CODE_NO_ERROR is returned. Pointer to the minimum length required for writing the entire string to the buffer if ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR is returned. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR if the buffer size is insufficient. |
OH_ArkUI_ImageAttachment_SetSizeWidth()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetSizeWidth(OH_ArkUI_ImageAttachment* imageAttachment, float width)
Description
Sets the image width in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| float width | Image width, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_GetSizeWidth()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetSizeWidth(const OH_ArkUI_ImageAttachment* imageAttachment, float* width)
Description
Obtains the image width in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| float* width | Pointer to the image width, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_SetSizeHeight()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetSizeHeight(OH_ArkUI_ImageAttachment* imageAttachment, float height)
Description
Sets the image height in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| float height | Image height, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_GetSizeHeight()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetSizeHeight(const OH_ArkUI_ImageAttachment* imageAttachment, float* height)
Description
Obtains the image height in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| float* height | Pointer to the image height, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_SetVerticalAlign()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetVerticalAlign(OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_ImageSpanAlignment verticalAlign)
Description
Sets the image alignment method in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| ArkUI_ImageSpanAlignment verticalAlign | Image alignment method. The value is an enumerated value of ArkUI_ImageSpanAlignment. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_GetVerticalAlign()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetVerticalAlign(const OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_ImageSpanAlignment* verticalAlign)
Description
Obtains the image alignment method in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| ArkUI_ImageSpanAlignment* verticalAlign | Pointer to the image alignment method. The value is an enumerated value of ArkUI_ImageSpanAlignment. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_SetObjectFit()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetObjectFit(OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_ObjectFit objectFit)
Description
Sets the image scaling type in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| ArkUI_ObjectFit objectFit | Image scaling type. The value is an enumerated value of ArkUI_ObjectFit. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_GetObjectFit()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetObjectFit(const OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_ObjectFit* objectFit)
Description
Obtains the image scaling type in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| ArkUI_ObjectFit* objectFit | Pointer to the image scaling type. The value is an enumerated value of ArkUI_ObjectFit. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_SetMargin()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetMargin(OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_Margin margin)
Description
Sets the image margin in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| ArkUI_Margin margin | Image margin, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_GetMargin()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetMargin(const OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_Margin* margin)
Description
Obtains the image margin in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| ArkUI_Margin* margin | Pointer to the image margin, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_SetPadding()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetPadding(OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_Margin padding)
Description
Sets the image padding in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| ArkUI_Margin padding | Image padding, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_GetPadding()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetPadding(const OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_Margin* padding)
Description
Obtains the image padding in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| ArkUI_Margin* padding | Pointer to the image padding, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_SetBorderRadiuses()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetBorderRadiuses(OH_ArkUI_ImageAttachment* imageAttachment, float topLeft, float topRight, float bottomLeft, float bottomRight)
Description
Sets the image border radii in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| float topLeft | Radius of the upper left corner, in vp. |
| float topRight | Radius of the upper right corner, in vp. |
| float bottomLeft | Radius of the lower left corner, in vp. |
| float bottomRight | Radius of the lower right corner, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_GetBorderRadiuses()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetBorderRadiuses(const OH_ArkUI_ImageAttachment* imageAttachment, float* topLeft, float* topRight, float* bottomLeft, float* bottomRight)
Description
Obtains the image border radii in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| float* topLeft | Pointer to the radius of the upper left corner, in vp. |
| float* topRight | Pointer to the radius of the upper right corner, in vp. |
| float* bottomLeft | Pointer to the radius of the lower left corner, in vp. |
| float* bottomRight | Pointer to the radius of the lower right corner, in vp. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_SetColorFilter()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetColorFilter(OH_ArkUI_ImageAttachment* imageAttachment, const float* colorFilter, uint32_t size)
Description
Sets the image color filter in the image style.
NOTE
If both this API and OH_ArkUI_ImageAttachment_SetDrawingColorFilter are set, the API set later takes effect.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| const float* colorFilter | Pointer to the image color filter. |
| uint32_t size | Size of the filter array. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_GetColorFilter()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetColorFilter(const OH_ArkUI_ImageAttachment* imageAttachment, float** colorFilter, uint32_t colorFilterSize, uint32_t* writeLength)
Description
Obtains the image color filter in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| float** colorFilter | Double pointer to the buffer for storing the image color filter in the memory. You need to allocate the memory. |
| uint32_t colorFilterSize | Buffer size. |
| uint32_t* writeLength | Pointer to the actual size of the image color filter array. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. Returns ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR if the buffer size is insufficient. |
OH_ArkUI_ImageAttachment_SetDrawingColorFilter()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetDrawingColorFilter(OH_ArkUI_ImageAttachment* imageAttachment, const OH_Drawing_ColorFilter* drawingColorFilter)
Description
Sets the image drawing color filter in the image style.
NOTE
If both this API and OH_ArkUI_ImageAttachment_SetColorFilter are set, the API set later takes effect.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| const OH_Drawing_ColorFilter* drawingColorFilter | Pointer to the image drawing color filter. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_GetDrawingColorFilter()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetDrawingColorFilter(const OH_ArkUI_ImageAttachment* imageAttachment, OH_Drawing_ColorFilter* drawingColorFilter)
Description
Obtains the image drawing color filter in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| OH_Drawing_ColorFilter* drawingColorFilter | Pointer to the image drawing color filter. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_SetSyncLoad()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetSyncLoad(OH_ArkUI_ImageAttachment* imageAttachment, bool syncLoad)
Description
Sets whether to load the image synchronously in the image style.
NOTE
This attribute is valid only when the image source is set to a resource address using OH_ArkUI_ImageAttachment_SetResource.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| bool syncLoad | Whether to load images synchronously. true to load synchronously; false to load asynchronously. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_GetSyncLoad()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetSyncLoad(const OH_ArkUI_ImageAttachment* imageAttachment, bool* syncLoad)
Description
Obtains whether the image is loaded synchronously in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| bool* syncLoad | Pointer to the syncLoad parameter indicating whether the image is loaded synchronously. true indicates the image is loaded synchronously; false indicates the image is loaded asynchronously. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_SetSupportSvg()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetSupportSvg(OH_ArkUI_ImageAttachment* imageAttachment, bool supportSvg)
Description
Sets whether to enable the enhanced SVG tag parsing feature in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| bool supportSvg | Whether to enable the enhanced SVG tag parsing feature. true to enable, false otherwise. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ImageAttachment_GetSupportSvg()
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetSupportSvg(const OH_ArkUI_ImageAttachment* imageAttachment, bool* supportSvg)
Description
Obtains whether the enhanced SVG tag parsing feature is enabled in the image style.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ImageAttachment* imageAttachment | Pointer to the OH_ArkUI_ImageAttachment object. |
| bool* supportSvg | Pointer to the supportSvg parameter indicating whether the enhanced SVG tag parsing feature is enabled. true means the enhanced SVG tag parsing feature is enabled, and false means the opposite. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextEditorChangeEvent_GetRangeBefore()
ArkUI_ErrorCode OH_ArkUI_TextEditorChangeEvent_GetRangeBefore(const OH_ArkUI_TextEditorChangeEvent* event, uint32_t* start, uint32_t* end)
Description
Obtains the range of the content to be replaced in the text change information.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_TextEditorChangeEvent* event | Pointer to the OH_ArkUI_TextEditorChangeEvent object. |
| uint32_t* start | Pointer to the start index of the range of the content to be replaced. |
| uint32_t* end | Pointer to the end index of the range of the content to be replaced. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextEditorChangeEvent_GetReplacementStyledString()
ArkUI_ErrorCode OH_ArkUI_TextEditorChangeEvent_GetReplacementStyledString(const OH_ArkUI_TextEditorChangeEvent* event, ArkUI_StyledString_Descriptor* descriptor)
Description
Obtains the styled string used for replacement in the text change information.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_TextEditorChangeEvent* event | Pointer to the OH_ArkUI_TextEditorChangeEvent object. |
| ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextEditorChangeEvent_GetPreviewStyledString()
ArkUI_ErrorCode OH_ArkUI_TextEditorChangeEvent_GetPreviewStyledString(const OH_ArkUI_TextEditorChangeEvent* event, ArkUI_StyledString_Descriptor* descriptor)
Description
Obtains the styled string of the previewed content in the text change information.
Since: 24
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_TextEditorChangeEvent* event | Pointer to the OH_ArkUI_TextEditorChangeEvent object. |
| ArkUI_StyledString_Descriptor* descriptor | Pointer to the ArkUI_StyledString_Descriptor object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Result code. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextLayoutManager_Dispose()
void OH_ArkUI_TextLayoutManager_Dispose(ArkUI_TextLayoutManager* layoutManager)
Description
Releases the memory occupied by the text layout manager.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_TextLayoutManager* layoutManager | Pointer to the ArkUI_TextLayoutManager object. |
OH_ArkUI_TextLayoutManager_GetLineCount()
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetLineCount(ArkUI_TextLayoutManager* layoutManager, int32_t* outLineCount)
Description
Obtains the number of lines.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_TextLayoutManager* layoutManager | Pointer to the ArkUI_TextLayoutManager object. |
| int32_t* outLineCount | Pointer to the number of text lines. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Return result. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextLayoutManager_GetRectsForRange()
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetRectsForRange(ArkUI_TextLayoutManager* layoutManager, int32_t start, int32_t end, OH_Drawing_RectWidthStyle widthStyle, OH_Drawing_RectHeightStyle heightStyle, OH_Drawing_TextBox** outTextBoxes)
Description
Obtains the drawing area information of characters or placeholders within a specified text range under the given rectangle width and height.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_TextLayoutManager* layoutManager | Pointer to the ArkUI_TextLayoutManager object. |
| int32_t start | Start index. The value of start must be greater than or equal to 0. Otherwise, a parameter error is returned. |
| int32_t end | End index. The value of end must be greater than or equal to that of start. Otherwise, a parameter error is returned. |
| OH_Drawing_RectWidthStyle widthStyle | Width style of the rectangle. |
| OH_Drawing_RectHeightStyle heightStyle | Height style of the rectangle. |
| OH_Drawing_TextBox** outTextBoxes | Level-2 pointer to the OH_Drawing_TextBox object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Return result. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextLayoutManager_GetGlyphPositionAtCoordinate()
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetGlyphPositionAtCoordinate(ArkUI_TextLayoutManager* layoutManager, double dx, double dy, OH_Drawing_PositionAndAffinity** outPos)
Description
Obtains the position of the glyph closest to the given coordinates.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_TextLayoutManager* layoutManager | Pointer to the ArkUI_TextLayoutManager object. |
| double dx | X coordinate relative to the control, in px. |
| double dy | Y coordinate relative to the control, in px. |
| OH_Drawing_PositionAndAffinity** outPos | Level-2 pointer to the OH_Drawing_PositionAndAffinity object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Return result. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextLayoutManager_GetLineMetrics()
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetLineMetrics(ArkUI_TextLayoutManager* layoutManager, int32_t lineNumber, OH_Drawing_LineMetrics* outMetrics)
Description
Obtains the information about the specified line, including line metrics, text style information, and font properties.
Since: 22
Parameters
| Name | Description |
|---|---|
| ArkUI_TextLayoutManager* layoutManager | Pointer to the ArkUI_TextLayoutManager object. |
| int32_t lineNumber | Index of the line number. It starts from 0. If the value of lineNumber is less than 0 or greater than or equal to the number of text lines, a parameter error is returned. |
| OH_Drawing_LineMetrics* outMetrics | Pointer to the OH_Drawing_LineMetrics object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Return result. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextLayoutManager_GetCharacterPositionAtCoordinate()
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetCharacterPositionAtCoordinate(ArkUI_TextLayoutManager* layoutManager, double dx, double dy, OH_Drawing_PositionAndAffinity** outPos)
Description
Obtains the position information of the character closest to the specified coordinates.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_TextLayoutManager* layoutManager | Pointer to the ArkUI_TextLayoutManager object. |
| double dx | X coordinate relative to the control, in px. |
| double dy | Y coordinate relative to the control, in px. |
| OH_Drawing_PositionAndAffinity** outPos | Level-2 pointer to the OH_Drawing_PositionAndAffinity object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Return result. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextLayoutManager_GetGlyphRangeForCharacterRange()
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetGlyphRangeForCharacterRange(ArkUI_TextLayoutManager* layoutManager, OH_Drawing_Range* charRange, OH_Drawing_Range** outGlyphRange,
OH_Drawing_Range** outActualCharRange);
Description
Obtains the glyph index range generated by the specified character index range and the actual character index range. If the first glyph is a Chinese character, the glyph index range of the character is [0, 1]. A Chinese character occupies three characters, so the corresponding character index range is [0, 3]. If the specified character index range is [0, 1], one third of a Chinese character cannot be parsed, so the actual character index range is [0, 3]. After the OH_Drawing_Range objects returned by outGlyphRange and outActualCharRange are used, you need to release them by calling OH_Drawing_ReleaseRangeBuffer.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_TextLayoutManager* layoutManager | Pointer to the ArkUI_TextLayoutManager object. |
| OH_Drawing_Range* charRange | Pointer to the OH_Drawing_Range object, indicating the character index range. |
| OH_Drawing_Range** outGlyphRange | Level-2 pointer to the OH_Drawing_Range object, indicating the glyph index range. |
| OH_Drawing_Range** outActualCharRange | Level-2 pointer to the OH_Drawing_Range object, indicating the actual character index range. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Return result. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_TextLayoutManager_GetCharacterRangeForGlyphRange()
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetCharacterRangeForGlyphRange(ArkUI_TextLayoutManager* layoutManager, OH_Drawing_Range* glyphRange, OH_Drawing_Range** outCharRange,
OH_Drawing_Range** outActualGlyphRange)
Description
Obtains the character index range generated by the specified glyph index range and the actual glyph index range. If a text contains two Chinese characters and five letters, the glyph index range of the text is [0, 7]. A Chinese character occupies three characters, so the corresponding character index range is [0, 11]. If the specified index range is [0, 11], but there are only seven glyphs, the actual glyph index range is [0, 7]. After the OH_Drawing_Range objects returned by outCharRange and outActualGlyphRange are used, you need to release them by calling OH_Drawing_ReleaseRangeBuffer.
Since: 24
Parameters
| Name | Description |
|---|---|
| ArkUI_TextLayoutManager* layoutManager | Pointer to the ArkUI_TextLayoutManager object. |
| OH_Drawing_Range* glyphRange | Pointer to the OH_Drawing_Range object, indicating the glyph index range. |
| OH_Drawing_Range** outCharRange | Level-2 pointer to the OH_Drawing_Range object, indicating the character index range. |
| OH_Drawing_Range** outActualGlyphRange | Level-2 pointer to the OH_Drawing_Range object, indicating the actual glyph index range. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Return result. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_SetLinearGradient()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetLinearGradient(OH_ArkUI_ParagraphStyle* paragraphStyle, const OH_ArkUI_LinearGradientOptions* linearGradient)
Description
Sets linear gradient for a paragraph style.
Since: 26.0.0
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| const OH_ArkUI_LinearGradientOptions* linearGradient | Pointer to the OH_ArkUI_LinearGradientOptions object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Return result. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_GetLinearGradient()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetLinearGradient(const OH_ArkUI_ParagraphStyle* paragraphStyle, OH_ArkUI_LinearGradientOptions* linearGradient)
Description
Obtains the linear gradient of the paragraph style.
Since: 26.0.0
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| OH_ArkUI_LinearGradientOptions* linearGradient | Pointer to the OH_ArkUI_LinearGradientOptions object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Return result. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_SetRadialGradient()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetRadialGradient(OH_ArkUI_ParagraphStyle* paragraphStyle, const OH_ArkUI_RadialGradientOptions* radialGradient)
Description
Sets radial gradient for a paragraph style.
Since: 26.0.0
Parameters
| Name | Description |
|---|---|
| OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| const OH_ArkUI_RadialGradientOptions* radialGradient | Pointer to the OH_ArkUI_RadialGradientOptions object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Return result. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |
OH_ArkUI_ParagraphStyle_GetRadialGradient()
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetRadialGradient(const OH_ArkUI_ParagraphStyle* paragraphStyle, OH_ArkUI_RadialGradientOptions* radialGradient)
Description
Obtains the radial gradient of the paragraph style.
Since: 26.0.0
Parameters
| Name | Description |
|---|---|
| const OH_ArkUI_ParagraphStyle* paragraphStyle | Pointer to the OH_ArkUI_ParagraphStyle object. |
| OH_ArkUI_RadialGradientOptions* radialGradient | Pointer to the OH_ArkUI_RadialGradientOptions object. |
Return value
| Type | Description |
|---|---|
| ArkUI_ErrorCode | Return result. Returns ARKUI_ERROR_CODE_NO_ERROR if the operation is successful. Returns ARKUI_ERROR_CODE_PARAM_INVALID if a parameter error occurs. |