目录

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. It provides rich text style settings, including font styles (text color, size, thickness, and style), text decoration lines, text shadows, baseline offsets, character spacing, line height, and line spacing, supports embedding of special content such as images, hyperlinks, and custom drawings, enables paragraph-level layout management, including alignment, indentation, and paragraph spacing, as well as allows text gesture interaction capabilities, such as tap, long-pressing, and touch events. It is applicable to scenarios that require rich text format display, complex text layout, mixed arrangement of text and images, and text interaction.

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

[h2]Structs

Name typedef Keyword Description
ArkUI_StyledString ArkUI_StyledString Defines a styled string data object supported by the text component. Multiple style attributes can be set for the text content. This struct is applicable to scenarios where rich text format display needs to be constructed and managed on the native side.
OH_ArkUI_SpanStyle OH_ArkUI_SpanStyle

Defines a styled string style object.

You can call OH_ArkUI_SpanStyle_Create to create a styled string style object.

You can call OH_ArkUI_SpanStyle_Destroy to destroy a styled string style object.

After the object is created, you can call OH_ArkUI_SpanStyle_SetStart and OH_ArkUI_SpanStyle_SetLength to set the usage scope of the style.

After the object is created, you can call the OH_ArkUI_SpanStyle_SetXXXStyle series APIs to set specific styles to take effect. For example, you can call OH_ArkUI_SpanStyle_SetTextStyle to set the font style.

OH_ArkUI_ImageAttachment OH_ArkUI_ImageAttachment

Defines an image style object.

You can call OH_ArkUI_ImageAttachment_Create to create an image style object.

You can call OH_ArkUI_ImageAttachment_Destroy to destroy an image style object.

After the object is created, you can call the OH_ArkUI_ImageAttachment_SetXXX series APIs to set specific styles to take effect. For example, you can call OH_ArkUI_ImageAttachment_SetPixelMap to set the image source.

OH_ArkUI_CustomSpan OH_ArkUI_CustomSpan

Defines a custom span.

You can call OH_ArkUI_CustomSpan_Create to create a custom span object.

You can call OH_ArkUI_CustomSpan_Destroy to destroy a custom span object.

After the object is created, you can call OH_ArkUI_CustomSpan_RegisterOnMeasureCallback and OH_ArkUI_CustomSpan_RegisterOnDrawCallback to register drawing callback functions.

OH_ArkUI_TextStyle OH_ArkUI_TextStyle

Defines a text font style.

You can call OH_ArkUI_TextStyle_Create to create a text font style object.

You can call OH_ArkUI_TextStyle_Destroy to destroy a text font style object.

After the object is created, you can call the OH_ArkUI_TextStyle_SetXXX series APIs to set specific styles to take effect. For example, you can call OH_ArkUI_TextStyle_SetFontColor to set the text color.

OH_ArkUI_ParagraphStyle OH_ArkUI_ParagraphStyle

Defines a paragraph style.

You can call OH_ArkUI_ParagraphStyle_Create to create a paragraph style object.

You can call OH_ArkUI_ParagraphStyle_Destroy to destroy a paragraph style object.

After the object is created, you can call the OH_ArkUI_ParagraphStyle_SetXXX series APIs to set specific styles to take effect. For example, you can call OH_ArkUI_ParagraphStyle_SetTextAlign to set the text alignment mode.

OH_ArkUI_GestureStyle OH_ArkUI_GestureStyle

Defines a gesture style.

You can call OH_ArkUI_GestureStyle_Create to create a gesture style object.

You can call OH_ArkUI_GestureStyle_Destroy to destroy a gesture style object.

After the object is created, you can call the OH_ArkUI_GestureStyle_RegisterOnXXXCallback series APIs to register specific event callbacks. For example, you can call OH_ArkUI_GestureStyle_RegisterOnClickCallback to register a click event callback.

OH_ArkUI_TextShadowStyle OH_ArkUI_TextShadowStyle

Defines a text shadow style.

You can call OH_ArkUI_TextShadowStyle_Create to create a text shadow style object.

You can call OH_ArkUI_TextShadowStyle_Destroy to destroy a text shadow style object.

After the object is created, you can call OH_ArkUI_TextShadowStyle_SetTextShadow to set a specific style to take effect.

OH_ArkUI_DecorationStyle OH_ArkUI_DecorationStyle

Defines a text decoration style.

You can call OH_ArkUI_DecorationStyle_Create to create a text decoration style object.

You can call OH_ArkUI_DecorationStyle_Destroy to destroy a text decoration style object.

After the object is created, you can call the OH_ArkUI_DecorationStyle_SetXXX series APIs to set specific styles to take effect. For example, you can call OH_ArkUI_DecorationStyle_SetTextDecorationType to set the decorative line type.

OH_ArkUI_BaselineOffsetStyle OH_ArkUI_BaselineOffsetStyle

Defines a baseline offset style.

You can call OH_ArkUI_BaselineOffsetStyle_Create to create a baseline offset style object.

You can call OH_ArkUI_BaselineOffsetStyle_Destroy to destroy a baseline offset style object.

After the object is created, you can call OH_ArkUI_BaselineOffsetStyle_SetBaselineOffset to set the baseline offset.

OH_ArkUI_LetterSpacingStyle OH_ArkUI_LetterSpacingStyle

Defines a letter spacing style.

You can call OH_ArkUI_LetterSpacingStyle_Create to create a letter spacing style object.

You can call OH_ArkUI_LetterSpacingStyle_Destroy to destroy a letter spacing style object.

After the object is created, you can call OH_ArkUI_LetterSpacingStyle_SetLetterSpacing to set the specific letter spacing.

OH_ArkUI_LineHeightStyle OH_ArkUI_LineHeightStyle

Defines a line height style.

You can call OH_ArkUI_LineHeightStyle_Create to create a line height style object.

You can call OH_ArkUI_LineHeightStyle_Destroy to destroy a line height style object.

After the object is created, you can call OH_ArkUI_LineHeightStyle_SetLineHeight to set the fixed line height.

Since API version 26.0.0, you can call OH_ArkUI_LineHeightStyle_SetLineHeightMultiple to set the line height multiplier.

OH_ArkUI_LineSpacingStyle OH_ArkUI_LineSpacingStyle

Defines a line spacing style.

You can call OH_ArkUI_LineSpacingStyle_Create to create a line spacing style object.

You can call OH_ArkUI_LineSpacingStyle_Destroy to destroy a line spacing style object.

After the object is created, you can call OH_ArkUI_LineSpacingStyle_SetLineSpacing to set the line spacing.

You can call OH_ArkUI_LineSpacingStyle_SetOnlyBetweenLines to set whether the line spacing takes effect only between lines.

OH_ArkUI_UrlStyle OH_ArkUI_UrlStyle

Defines a URL style.

You can call OH_ArkUI_UrlStyle_Create to create a URL style object.

You can call OH_ArkUI_UrlStyle_Destroy to destroy a URL style object.

After the object is created, you can call OH_ArkUI_UrlStyle_SetUrl to set the URL.

OH_ArkUI_BackgroundColorStyle OH_ArkUI_BackgroundColorStyle

Defines a background color style.

You can call OH_ArkUI_BackgroundColorStyle_Create to create a background color style object.

You can call OH_ArkUI_BackgroundColorStyle_Destroy to destroy a background color style object.

After the object is created, you can call OH_ArkUI_BackgroundColorStyle_SetColor and OH_ArkUI_BackgroundColorStyle_SetRadius to set the background color and corner radius.

OH_ArkUI_UserDataSpan OH_ArkUI_UserDataSpan

Defines a user data span style.

You can call OH_ArkUI_UserDataSpan_Create to create a user data span style object.

You can call OH_ArkUI_UserDataSpan_Destroy to destroy a user data span style object.

After the object is created, you can call OH_ArkUI_UserDataSpan_SetUserData to bind the user data.

OH_ArkUI_LeadingMarginSpanDrawInfo OH_ArkUI_LeadingMarginSpanDrawInfo

Defines the custom drawing information for paragraph indentation.

You can call OH_ArkUI_LeadingMarginSpanDrawInfo_Create to create a custom drawing information object for paragraph indentation.

You can call OH_ArkUI_LeadingMarginSpanDrawInfo_Destroy to destroy a custom drawing information object for paragraph indentation.

This object provides 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 object, which is used to perform layout processing on text. It is applicable to scenarios where fine control over text display and typesetting is required, helping you implement custom text layout requirements.

[h2]Enumeration

Name typedef Keyword Description
OH_ArkUI_StyledStringKey OH_ArkUI_StyledStringKey Enumerates the styles of a styled string.
OH_ArkUI_SuperscriptStyle OH_ArkUI_SuperscriptStyle Enumerates the text superscript and subscript styles.
OH_ArkUI_TextEncoding OH_ArkUI_TextEncoding Enumerates the text encoding types supported by the text layout query API.

[h2]Functions

Name Description
ArkUI_StyledString* OH_ArkUI_StyledString_Create(OH_Drawing_TypographyStyle* style, OH_Drawing_FontCollection* collection) Creates a pointer to the ArkUI_StyledString object.
void OH_ArkUI_StyledString_Destroy(ArkUI_StyledString* handle) Releases the memory occupied by the ArkUI_StyledString object.
void OH_ArkUI_StyledString_PushTextStyle(ArkUI_StyledString* handle, OH_Drawing_TextStyle* style) Pushes a text style to the top of the style stack of a styled string.
void OH_ArkUI_StyledString_AddText(ArkUI_StyledString* handle, const char* content) Adds text for a styled string.
void OH_ArkUI_StyledString_PopTextStyle(ArkUI_StyledString* handle) Pops the style at the top of the style stack of a styled string.
OH_Drawing_Typography* OH_ArkUI_StyledString_CreateTypography(ArkUI_StyledString* handle) 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.
void OH_ArkUI_StyledString_AddPlaceholder(ArkUI_StyledString* handle, OH_Drawing_PlaceholderSpan* placeholder) Adds a placeholder for a styled string.
ArkUI_StyledString_Descriptor* OH_ArkUI_StyledString_Descriptor_Create(void) Creates an ArkUI_StyledString_Descriptor object.
void OH_ArkUI_StyledString_Descriptor_Destroy(ArkUI_StyledString_Descriptor* descriptor) Releases the memory occupied by the ArkUI_StyledString_Descriptor object.
int32_t OH_ArkUI_UnmarshallStyledStringDescriptor(uint8_t* buffer, size_t bufferSize, ArkUI_StyledString_Descriptor* descriptor) Unmarshals a byte array containing styled string information into a styled string.
int32_t OH_ArkUI_MarshallStyledStringDescriptor(uint8_t* buffer, size_t bufferSize, ArkUI_StyledString_Descriptor* descriptor, size_t* resultSize) Marshals the styled string information into a byte array.
const char* OH_ArkUI_ConvertToHtml(ArkUI_StyledString_Descriptor* descriptor) Converts styled string information into HTML.
ArkUI_StyledString_Descriptor* OH_ArkUI_StyledString_Descriptor_CreateWithString(const char* value, const OH_ArkUI_SpanStyle** styles, int32_t length) Creates an ArkUI_StyledString_Descriptor object of the plain text content type.
ArkUI_StyledString_Descriptor* OH_ArkUI_StyledString_Descriptor_CreateWithImageAttachment(const OH_ArkUI_ImageAttachment* value) Creates an ArkUI_StyledString_Descriptor object of the image content type.
ArkUI_StyledString_Descriptor* OH_ArkUI_StyledString_Descriptor_CreateWithCustomSpan(const OH_ArkUI_CustomSpan* value) Creates an ArkUI_StyledString_Descriptor object of the custom span content type.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_GetLength(const ArkUI_StyledString_Descriptor* descriptor, int32_t* length) Obtains the length of a styled string.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_GetString(const ArkUI_StyledString_Descriptor* descriptor, char* buffer, int32_t bufferSize, int32_t* writeLength) Obtains the text content of a styled string.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_IsEqual(const ArkUI_StyledString_Descriptor* firstDescriptor, const ArkUI_StyledString_Descriptor* secondDescriptor, bool* isEqual) 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.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_SubStyledString(const ArkUI_StyledString_Descriptor* descriptor, ArkUI_StyledString_Descriptor* subDescriptor, uint32_t start, uint32_t length) Obtains a sub-styled string of a styled string.
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) Obtains the style set within a specified range of a styled string.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_FromHtml(ArkUI_StyledString_Descriptor* descriptor, const char* html) Converts an HTML string to a styled string.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_ReplaceString(ArkUI_StyledString_Descriptor* descriptor, uint32_t start, uint32_t length, const char* string) Replaces the text within a specified range of a styled string.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_InsertString(ArkUI_StyledString_Descriptor* descriptor, uint32_t start, const char* string) Inserts text at a specified position of a styled string.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_RemoveString(ArkUI_StyledString_Descriptor* descriptor, uint32_t start, uint32_t length) Removes the text within a specified range of a styled string.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_ReplaceStyle(ArkUI_StyledString_Descriptor* descriptor, const OH_ArkUI_SpanStyle* spanStyle) Replaces the style within a specified range of a styled string.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_SetStyle(ArkUI_StyledString_Descriptor* descriptor, const OH_ArkUI_SpanStyle* spanStyle) Sets a new style for a specified range of a styled string.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_RemoveStyle(ArkUI_StyledString_Descriptor* descriptor, uint32_t start, uint32_t length, OH_ArkUI_StyledStringKey styledKey) Removes the specified style for a specified range of a styled string.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_ClearStyles(ArkUI_StyledString_Descriptor* descriptor) Clears all styles of a styled string.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_ReplaceStyledString(ArkUI_StyledString_Descriptor* descriptor, uint32_t start, uint32_t length, const ArkUI_StyledString_Descriptor* other) Replaces the styled string within a specified range.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_InsertStyledString(ArkUI_StyledString_Descriptor* descriptor, uint32_t start, const ArkUI_StyledString_Descriptor* other) Inserts a new styled string at a specified position of a styled string.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_AppendStyledString(ArkUI_StyledString_Descriptor* descriptor, const ArkUI_StyledString_Descriptor* other) Appends a new styled string to the end of a styled string.
ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_InvalidateCustomSpan(const ArkUI_StyledString_Descriptor* descriptor) Actively refreshes the custom span in a styled string.
OH_ArkUI_TextStyle* OH_ArkUI_TextStyle_Create() Creates an OH_ArkUI_TextStyle object.
void OH_ArkUI_TextStyle_Destroy(OH_ArkUI_TextStyle* textStyle) Releases the memory occupied by the OH_ArkUI_TextStyle object.
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetFontColor(OH_ArkUI_TextStyle* textStyle, uint32_t fontColor) Sets text color for a text font style.
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetFontColor(const OH_ArkUI_TextStyle* textStyle, uint32_t* fontColor) Obtains the text color of a text font style.
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetFontFamily(OH_ArkUI_TextStyle* textStyle, const char* fontFamily) Sets a font family for a text font style.
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetFontFamily(const OH_ArkUI_TextStyle* textStyle, char* buffer, int32_t bufferSize, int32_t* writeLength) Obtains the font family of a text font style.
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetFontSize(OH_ArkUI_TextStyle* textStyle, float fontSize) Sets font size for a text font style.
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetFontSize(const OH_ArkUI_TextStyle* textStyle, float* fontSize) Obtains the font size of a text font style.
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetFontWeight(OH_ArkUI_TextStyle* textStyle, uint32_t fontWeight) Sets font weight for a text font style.
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetFontWeight(const OH_ArkUI_TextStyle* textStyle, uint32_t* fontWeight) Obtains the font weight of a text font style.
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetFontStyle(OH_ArkUI_TextStyle* textStyle, ArkUI_FontStyle fontStyle) Sets font style for a text font style.
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetFontStyle(const OH_ArkUI_TextStyle* textStyle, ArkUI_FontStyle* fontStyle) Obtains the font style of a text font style.
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetStrokeWidth(OH_ArkUI_TextStyle* textStyle, float strokeWidth) Sets stroke width for a text font style.
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetStrokeWidth(const OH_ArkUI_TextStyle* textStyle, float* strokeWidth) Obtains the stroke width of a text font style.
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetStrokeColor(OH_ArkUI_TextStyle* textStyle, uint32_t strokeColor) Sets a stroke color for a text font style.
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetStrokeColor(const OH_ArkUI_TextStyle* textStyle, uint32_t* strokeColor) Obtains the stroke color of a text font style.
ArkUI_ErrorCode OH_ArkUI_TextStyle_SetSuperscript(OH_ArkUI_TextStyle* textStyle, OH_ArkUI_SuperscriptStyle superscript) Sets superscript and subscript styles for a text font style.
ArkUI_ErrorCode OH_ArkUI_TextStyle_GetSuperscript(const OH_ArkUI_TextStyle* textStyle, OH_ArkUI_SuperscriptStyle* superscript) Obtains the superscript and subscript styles of a text font style.
OH_ArkUI_SpanStyle* OH_ArkUI_SpanStyle_Create() Creates an OH_ArkUI_SpanStyle object.
void OH_ArkUI_SpanStyle_Destroy(OH_ArkUI_SpanStyle* spanStyle) Releases the memory occupied by the OH_ArkUI_SpanStyle object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetStyledKey(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_StyledStringKey* styledKey) Obtains the style of the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetStart(OH_ArkUI_SpanStyle* spanStyle, int32_t start) Sets the start position for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetStart(const OH_ArkUI_SpanStyle* spanStyle, int32_t* start) Obtains the start position of the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetLength(OH_ArkUI_SpanStyle* spanStyle, int32_t length) Sets the length for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetLength(const OH_ArkUI_SpanStyle* spanStyle, int32_t* length) Obtains the length of the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetTextStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_TextStyle* textStyle) Sets the text font style for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetTextStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_TextStyle* textStyle) Obtains the text font style of the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetParagraphStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_ParagraphStyle* paragraphStyle) Sets the paragraph style for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetParagraphStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_ParagraphStyle* paragraphStyle) Obtains the paragraph style of the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetGestureStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_GestureStyle* gestureStyle) Sets the gesture style for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetGestureStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_GestureStyle* gestureStyle) Obtains the gesture style of the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetTextShadowStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_TextShadowStyle* textShadowStyle) Sets the text shadow style for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetTextShadowStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_TextShadowStyle* textShadowStyle) Obtains the text shadow style of the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetDecorationStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_DecorationStyle* decorationStyle) Sets the text decorative line style for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetDecorationStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_DecorationStyle* decorationStyle) Obtains the text decorative line style of the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetBaselineOffsetStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle) Sets the baseline offset style for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetBaselineOffsetStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle) Obtains the baseline offset style of the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetLetterSpacingStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_LetterSpacingStyle* letterSpacingStyle) Sets the letter spacing style for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetLetterSpacingStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_LetterSpacingStyle* letterSpacingStyle) Obtains the letter spacing style of the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetLineHeightStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_LineHeightStyle* lineHeightStyle) Sets the line height style for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetLineHeightStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_LineHeightStyle* lineHeightStyle) Obtains the line height style of the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetUrlStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_UrlStyle* urlStyle) Sets the URL style for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetUrlStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_UrlStyle* urlStyle) Obtains the URL style of the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetBackgroundColorStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_BackgroundColorStyle* backgroundColorStyle) Sets the background color style for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetBackgroundColorStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_BackgroundColorStyle* backgroundColorStyle) Obtains the background color style of the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetUserDataSpan(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_UserDataSpan* userDataSpan) Sets the user data span style for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetUserDataSpan(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_UserDataSpan* userDataSpan) Obtains the user data span style of the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetCustomSpan(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_CustomSpan* customSpan) Sets the custom span style for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetCustomSpan(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_CustomSpan* customSpan) Obtains the custom span style of the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetImageAttachment(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_ImageAttachment* imageAttachment) Sets the image style for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetImageAttachment(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_ImageAttachment* imageAttachment) Obtains the image style of the styled string style object.
OH_ArkUI_LeadingMarginSpanDrawInfo* OH_ArkUI_LeadingMarginSpanDrawInfo_Create() Creates an OH_ArkUI_LeadingMarginSpanDrawInfo object.
void OH_ArkUI_LeadingMarginSpanDrawInfo_Destroy(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo) Releases the memory occupied by the OH_ArkUI_LeadingMarginSpanDrawInfo object.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetX(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float x) Sets the horizontal offset of the current line relative to the component in the custom drawing information object for paragraph indentation.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetX(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float* x) Obtains the horizontal offset of the current line relative to the component in the custom drawing information object for paragraph indentation.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetTop(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float top) 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.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetTop(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float* top) 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.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetBottom(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float bottom) 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.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetBottom(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float* bottom) 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.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetBaseline(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float baseline) 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.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetBaseline(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, float* baseline) 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.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetTextDirection(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, ArkUI_TextDirection direction) Sets the text direction in the custom drawing information object for paragraph indentation.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetTextDirection(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, ArkUI_TextDirection* direction) Obtains the text direction in the custom drawing information object for paragraph indentation.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetStart(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, uint32_t start) Sets the start index of the current line in the custom drawing information object for paragraph indentation.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetStart(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, uint32_t* start) Obtains the start index of the current line in the custom drawing information object for paragraph indentation.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetEnd(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, uint32_t end) Sets the end index of the current line in the custom drawing information object for paragraph indentation.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetEnd(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, uint32_t* end) Obtains the end index of the current line in the custom drawing information object for paragraph indentation.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_SetFirst(OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, bool first) Sets whether the current line is the first line of the paragraph in the custom drawing information object for paragraph indentation.
ArkUI_ErrorCode OH_ArkUI_LeadingMarginSpanDrawInfo_GetFirst(const OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo, bool* first) Obtains whether the current line is the first line of the paragraph in the custom drawing information object for paragraph indentation.
OH_ArkUI_ParagraphStyle* OH_ArkUI_ParagraphStyle_Create() Creates an OH_ArkUI_ParagraphStyle object.
void OH_ArkUI_ParagraphStyle_Destroy(OH_ArkUI_ParagraphStyle* paragraphStyle) Releases the memory occupied by the OH_ArkUI_ParagraphStyle object.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetTextAlign(OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextAlignment align) Sets the horizontal text alignment method in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetTextAlign(const OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextAlignment* align) Obtains the horizontal text alignment method in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetTextIndent(OH_ArkUI_ParagraphStyle* paragraphStyle, float textIndent) Sets the first-line text indentation in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetTextIndent(const OH_ArkUI_ParagraphStyle* paragraphStyle, float* textIndent) Obtains the first-line text indentation in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetMaxLines(OH_ArkUI_ParagraphStyle* paragraphStyle, int32_t maxLines) Sets the maximum number of lines in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetMaxLines(const OH_ArkUI_ParagraphStyle* paragraphStyle, int32_t* maxLines) Obtains the maximum number of lines in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetOverflow(OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextOverflow overflow) Sets the display mode when the paragraph is too long in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetOverflow(const OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextOverflow* overflow) Obtains the display mode when the paragraph is too long in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetWordBreak(OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_WordBreak wordBreak) Sets the word breaking rule in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetWordBreak(const OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_WordBreak* wordBreak) Obtains the word breaking rule in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetLeadingMarginPixelMap(OH_ArkUI_ParagraphStyle* paragraphStyle, struct OH_PixelmapNative* pixelmap) Sets the PixelMap for paragraph indentation in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetLeadingMarginPixelMap(const OH_ArkUI_ParagraphStyle* paragraphStyle, struct OH_PixelmapNative** pixelmap) Obtains the PixelMap for paragraph indentation in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetLeadingMarginWidth(OH_ArkUI_ParagraphStyle* paragraphStyle, uint32_t width) Sets the width for paragraph indentation in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetLeadingMarginWidth(const OH_ArkUI_ParagraphStyle* paragraphStyle, uint32_t* width) Obtains the width for paragraph indentation in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetLeadingMarginHeight(OH_ArkUI_ParagraphStyle* paragraphStyle, uint32_t height) Sets the height for paragraph indentation in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetLeadingMarginHeight(const OH_ArkUI_ParagraphStyle* paragraphStyle, uint32_t* height) Obtains the height for paragraph indentation in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetParagraphSpacing(OH_ArkUI_ParagraphStyle* paragraphStyle, uint32_t paragraphSpacing) Sets the paragraph spacing in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetParagraphSpacing(const OH_ArkUI_ParagraphStyle* paragraphStyle, uint32_t* paragraphSpacing) Obtains the paragraph spacing in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetTextVerticalAlign(OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextVerticalAlignment verticalAlignment) Sets the vertical text alignment method in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetTextVerticalAlign(const OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextVerticalAlignment* verticalAlignment) Obtains the vertical text alignment method in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_RegisterOnDrawLeadingMarginCallback(OH_ArkUI_ParagraphStyle* paragraphStyle, void(*onDraw)(ArkUI_DrawContext* context, OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo)) Registers the callback function triggered when the paragraph indentation is drawn in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_RegisterOnGetLeadingMarginCallback(OH_ArkUI_ParagraphStyle* paragraphStyle, float(*leadingMargin)()) Sets the callback function triggered when the paragraph indentation distance is obtained in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetTextDirection(OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextDirection textDirection) Sets the text direction in the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetTextDirection(const OH_ArkUI_ParagraphStyle* paragraphStyle, ArkUI_TextDirection* textDirection) Obtains the text direction in the paragraph style.
OH_ArkUI_GestureStyle* OH_ArkUI_GestureStyle_Create() Creates an OH_ArkUI_GestureStyle object.
void OH_ArkUI_GestureStyle_Destroy(OH_ArkUI_GestureStyle* gestureStyle) Releases the memory occupied by the OH_ArkUI_GestureStyle object.
ArkUI_ErrorCode OH_ArkUI_GestureStyle_RegisterOnClickCallback(OH_ArkUI_GestureStyle* gestureStyle, void(*onClick)(ArkUI_NodeEvent*)) Registers the click event callback in the event gesture style.
ArkUI_ErrorCode OH_ArkUI_GestureStyle_RegisterOnLongPressCallback(OH_ArkUI_GestureStyle* gestureStyle, void(*onLongPress)(ArkUI_GestureEvent*)) Registers the long-pressing event callback in the event gesture style.
ArkUI_ErrorCode OH_ArkUI_GestureStyle_RegisterOnTouchCallback(OH_ArkUI_GestureStyle* gestureStyle, void(*onTouch)(ArkUI_NodeEvent*)) Registers the touch event callback in the event gesture style.
OH_ArkUI_TextShadowStyle* OH_ArkUI_TextShadowStyle_Create() Creates an OH_ArkUI_TextShadowStyle object.
void OH_ArkUI_TextShadowStyle_Destroy(OH_ArkUI_TextShadowStyle* textShadowStyle) Releases the memory occupied by the OH_ArkUI_TextShadowStyle object.
ArkUI_ErrorCode OH_ArkUI_TextShadowStyle_SetTextShadow(OH_ArkUI_TextShadowStyle* textShadowStyle, const OH_ArkUI_ShadowOptions** options, uint32_t length) Sets the text shadow options for the text shadow style.
ArkUI_ErrorCode OH_ArkUI_TextShadowStyle_GetTextShadow(const OH_ArkUI_TextShadowStyle* textShadowStyle, OH_ArkUI_ShadowOptions** shadowOptions, uint32_t shadowOptionsSize, uint32_t* writeLength) Obtains the text shadow options of the text shadow style.
OH_ArkUI_DecorationStyle* OH_ArkUI_DecorationStyle_Create() Creates an OH_ArkUI_DecorationStyle object.
void OH_ArkUI_DecorationStyle_Destroy(OH_ArkUI_DecorationStyle* decorationStyle) Releases the memory occupied by the OH_ArkUI_DecorationStyle object.
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_SetTextDecorationType(OH_ArkUI_DecorationStyle* decorationStyle, ArkUI_TextDecorationType type) Sets the decoration type for the text decorative line style.
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_GetTextDecorationType(const OH_ArkUI_DecorationStyle* decorationStyle, ArkUI_TextDecorationType* type) Obtains the decoration type of the text decorative line style.
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_SetColor(OH_ArkUI_DecorationStyle* decorationStyle, uint32_t color) Sets the decoration color for the text decorative line style.
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_GetColor(const OH_ArkUI_DecorationStyle* decorationStyle, uint32_t* color) Obtains the decoration color of the text decorative line style.
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_SetTextDecorationStyle(OH_ArkUI_DecorationStyle* decorationStyle, ArkUI_TextDecorationStyle style) Sets the decoration style for the text decorative line style.
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_GetTextDecorationStyle(const OH_ArkUI_DecorationStyle* decorationStyle, ArkUI_TextDecorationStyle* style) Obtains the decoration style of the text decorative line style.
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_SetThicknessScale(OH_ArkUI_DecorationStyle* decorationStyle, float thicknessScale) Sets the thickness scaling factor of the text decorative line style.
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_GetThicknessScale(const OH_ArkUI_DecorationStyle* decorationStyle, float* thicknessScale) Obtains the thickness scaling factor of the text decorative line style.
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_SetEnableMultiType(OH_ArkUI_DecorationStyle* decorationStyle, bool enableMultiType) Sets whether to enable the display of multiple decorative lines in the text decorative line style.
ArkUI_ErrorCode OH_ArkUI_DecorationStyle_GetEnableMultiType(const OH_ArkUI_DecorationStyle* decorationStyle, bool* enableMultiType) Obtains whether the display of multiple decorative lines is enabled in the text decorative line style.
OH_ArkUI_BaselineOffsetStyle* OH_ArkUI_BaselineOffsetStyle_Create() Creates an OH_ArkUI_BaselineOffsetStyle object.
void OH_ArkUI_BaselineOffsetStyle_Destroy(OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle) Releases the memory occupied by the OH_ArkUI_BaselineOffsetStyle object.
ArkUI_ErrorCode OH_ArkUI_BaselineOffsetStyle_SetBaselineOffset(OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle, float baselineOffset) Sets the baseline offset.
ArkUI_ErrorCode OH_ArkUI_BaselineOffsetStyle_GetBaselineOffset(const OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle, float* baselineOffset) Obtains the baseline offset.
OH_ArkUI_LetterSpacingStyle* OH_ArkUI_LetterSpacingStyle_Create() Creates an OH_ArkUI_LetterSpacingStyle object.
void OH_ArkUI_LetterSpacingStyle_Destroy(OH_ArkUI_LetterSpacingStyle* letterSpacingStyle) Releases the memory occupied by the OH_ArkUI_LetterSpacingStyle object.
ArkUI_ErrorCode OH_ArkUI_LetterSpacingStyle_SetLetterSpacing(OH_ArkUI_LetterSpacingStyle* letterSpacingStyle, float letterSpacing) Sets the letter spacing.
ArkUI_ErrorCode OH_ArkUI_LetterSpacingStyle_GetLetterSpacing(const OH_ArkUI_LetterSpacingStyle* letterSpacingStyle, float* letterSpacing) Obtains the letter spacing.
OH_ArkUI_LineHeightStyle* OH_ArkUI_LineHeightStyle_Create() Creates an OH_ArkUI_LineHeightStyle object.
void OH_ArkUI_LineHeightStyle_Destroy(OH_ArkUI_LineHeightStyle* lineHeightStyle) Releases the memory occupied by the OH_ArkUI_LineHeightStyle object.
ArkUI_ErrorCode OH_ArkUI_LineHeightStyle_SetLineHeight(OH_ArkUI_LineHeightStyle* lineHeightStyle, float lineHeight) Sets the line height.
ArkUI_ErrorCode OH_ArkUI_LineHeightStyle_GetLineHeight(const OH_ArkUI_LineHeightStyle* lineHeightStyle, float* lineHeight) Obtains the line height.
ArkUI_ErrorCode OH_ArkUI_LineHeightStyle_SetLineHeightMultiple(OH_ArkUI_LineHeightStyle* lineHeightStyle, float lineHeightMultiple) Sets a line height multiplier.
ArkUI_ErrorCode OH_ArkUI_LineHeightStyle_GetLineHeightMultiple(const OH_ArkUI_LineHeightStyle* lineHeightStyle, float* lineHeightMultiple) Obtains the line height multiplier.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_SetLineSpacingStyle(OH_ArkUI_SpanStyle* spanStyle, const OH_ArkUI_LineSpacingStyle* lineSpacingStyle) Sets a line spacing style for the styled string style object.
ArkUI_ErrorCode OH_ArkUI_SpanStyle_GetLineSpacingStyle(const OH_ArkUI_SpanStyle* spanStyle, OH_ArkUI_LineSpacingStyle* lineSpacingStyle) Obtains the line spacing style of the styled string style object.
OH_ArkUI_LineSpacingStyle* OH_ArkUI_LineSpacingStyle_Create() Creates an OH_ArkUI_LineSpacingStyle object.
void OH_ArkUI_LineSpacingStyle_Destroy(OH_ArkUI_LineSpacingStyle* lineSpacingStyle) Releases the memory occupied by the OH_ArkUI_LineSpacingStyle object.
ArkUI_ErrorCode OH_ArkUI_LineSpacingStyle_SetLineSpacing(OH_ArkUI_LineSpacingStyle* lineSpacingStyle, float lineSpacing) Sets line spacing.
ArkUI_ErrorCode OH_ArkUI_LineSpacingStyle_GetLineSpacing(const OH_ArkUI_LineSpacingStyle* lineSpacingStyle, float* lineSpacing) Obtains line spacing.
ArkUI_ErrorCode OH_ArkUI_LineSpacingStyle_SetOnlyBetweenLines(OH_ArkUI_LineSpacingStyle* lineSpacingStyle, bool onlyBetweenLines) Sets whether the line spacing takes effect only between lines.
ArkUI_ErrorCode OH_ArkUI_LineSpacingStyle_GetOnlyBetweenLines(const OH_ArkUI_LineSpacingStyle* lineSpacingStyle, bool* onlyBetweenLines) Obtains whether the line spacing takes effect only between lines.
OH_ArkUI_BackgroundColorStyle* OH_ArkUI_BackgroundColorStyle_Create() Creates an OH_ArkUI_BackgroundColorStyle object.
void OH_ArkUI_BackgroundColorStyle_Destroy(OH_ArkUI_BackgroundColorStyle* style) Releases the memory occupied by the OH_ArkUI_BackgroundColorStyle object.
ArkUI_ErrorCode OH_ArkUI_BackgroundColorStyle_SetColor(OH_ArkUI_BackgroundColorStyle* style, uint32_t color) Sets the background color for the background color style.
ArkUI_ErrorCode OH_ArkUI_BackgroundColorStyle_GetColor(const OH_ArkUI_BackgroundColorStyle* style, uint32_t* color) Obtains the background color of the background color style.
ArkUI_ErrorCode OH_ArkUI_BackgroundColorStyle_SetRadius(OH_ArkUI_BackgroundColorStyle* style, float topLeft, float topRight, float bottomLeft, float bottomRight) Sets the background radii for the background color style.
ArkUI_ErrorCode OH_ArkUI_BackgroundColorStyle_GetRadius(const OH_ArkUI_BackgroundColorStyle* style, float* topLeft, float* topRight, float* bottomLeft, float* bottomRight) Obtains the background radii of the background color style.
OH_ArkUI_UrlStyle* OH_ArkUI_UrlStyle_Create() Creates an OH_ArkUI_UrlStyle object.
void OH_ArkUI_UrlStyle_Destroy(OH_ArkUI_UrlStyle* style) Releases the memory occupied by the OH_ArkUI_UrlStyle object.
ArkUI_ErrorCode OH_ArkUI_UrlStyle_SetUrl(OH_ArkUI_UrlStyle* style, const char* url) Sets the URL content for the URL style.
ArkUI_ErrorCode OH_ArkUI_UrlStyle_GetUrl(const OH_ArkUI_UrlStyle* style, char* buffer, int32_t bufferSize, int32_t* writeLength) Obtains the URL content of the URL style.
OH_ArkUI_UserDataSpan* OH_ArkUI_UserDataSpan_Create() Creates an OH_ArkUI_UserDataSpan object.
void OH_ArkUI_UserDataSpan_Destroy(OH_ArkUI_UserDataSpan* userDataSpan) Releases the memory occupied by the OH_ArkUI_UserDataSpan object.
ArkUI_ErrorCode OH_ArkUI_UserDataSpan_SetUserData(OH_ArkUI_UserDataSpan* userDataSpan, void* userData) Sets the user data in the user data span style.
ArkUI_ErrorCode OH_ArkUI_UserDataSpan_GetUserData(const OH_ArkUI_UserDataSpan* userDataSpan, void** userData) Obtains the user data in the user data span style.
OH_ArkUI_CustomSpan* OH_ArkUI_CustomSpan_Create() Creates an OH_ArkUI_CustomSpan object.
void OH_ArkUI_CustomSpan_Destroy(OH_ArkUI_CustomSpan* customSpan) Releases the memory occupied by the OH_ArkUI_CustomSpan object.
ArkUI_ErrorCode OH_ArkUI_CustomSpan_RegisterOnMeasureCallback(OH_ArkUI_CustomSpan* customSpan, ArkUI_CustomSpanMetrics*(*onMeasure)(float)) Registers the callback function triggered when metrics are obtained for the custom span.
ArkUI_ErrorCode OH_ArkUI_CustomSpan_RegisterOnDrawCallback(OH_ArkUI_CustomSpan* customSpan, void(*onDraw)(ArkUI_DrawContext*, ArkUI_CustomSpanDrawInfo*)) Registers the callback function triggered when the custom span is drawn.
OH_ArkUI_ImageAttachment* OH_ArkUI_ImageAttachment_Create() Creates an OH_ArkUI_ImageAttachment object.
void OH_ArkUI_ImageAttachment_Destroy(OH_ArkUI_ImageAttachment* imageAttachment) Releases the memory occupied by the OH_ArkUI_ImageAttachment object.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetPixelMap(OH_ArkUI_ImageAttachment* imageAttachment, struct OH_PixelmapNative* pixelmap) Sets the image data source in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetPixelMap(const OH_ArkUI_ImageAttachment* imageAttachment, struct OH_PixelmapNative** pixelmap) Obtains the image data source in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetResource(OH_ArkUI_ImageAttachment* imageAttachment, const char* resource) Sets the image resource address in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetResource(const OH_ArkUI_ImageAttachment* imageAttachment, char* buffer, int32_t bufferSize, int32_t* writeLength) Obtains the image resource address in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetSizeWidth(OH_ArkUI_ImageAttachment* imageAttachment, float width) Sets the image width in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetSizeWidth(const OH_ArkUI_ImageAttachment* imageAttachment, float* width) Obtains the image width in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetSizeHeight(OH_ArkUI_ImageAttachment* imageAttachment, float height) Sets the image height in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetSizeHeight(const OH_ArkUI_ImageAttachment* imageAttachment, float* height) Obtains the image height in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetVerticalAlign(OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_ImageSpanAlignment verticalAlign) Sets the image alignment method in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetVerticalAlign(const OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_ImageSpanAlignment* verticalAlign) Obtains the image alignment method in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetObjectFit(OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_ObjectFit objectFit) Sets the image scaling type in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetObjectFit(const OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_ObjectFit* objectFit) Obtains the image scaling type in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetMargin(OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_Margin margin) Sets the image margin in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetMargin(const OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_Margin* margin) Obtains the image margin in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetPadding(OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_Margin padding) Sets the image padding in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetPadding(const OH_ArkUI_ImageAttachment* imageAttachment, ArkUI_Margin* padding) Obtains the image padding in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetBorderRadiuses(OH_ArkUI_ImageAttachment* imageAttachment, float topLeft, float topRight, float bottomLeft, float bottomRight) Sets the image border radii in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetBorderRadiuses(const OH_ArkUI_ImageAttachment* imageAttachment, float* topLeft, float* topRight, float* bottomLeft, float* bottomRight) Obtains the image border radii in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetColorFilter(OH_ArkUI_ImageAttachment* imageAttachment, const float* colorFilter, uint32_t size) Sets the image color filter in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetColorFilter(const OH_ArkUI_ImageAttachment* imageAttachment, float** colorFilter, uint32_t colorFilterSize, uint32_t* writeLength) Obtains the image color filter in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetDrawingColorFilter(OH_ArkUI_ImageAttachment* imageAttachment, const OH_Drawing_ColorFilter* drawingColorFilter) Sets the image drawing color filter in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetDrawingColorFilter(const OH_ArkUI_ImageAttachment* imageAttachment, OH_Drawing_ColorFilter* drawingColorFilter) Obtains the image drawing color filter in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetSyncLoad(OH_ArkUI_ImageAttachment* imageAttachment, bool syncLoad) Sets whether to load the image synchronously in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetSyncLoad(const OH_ArkUI_ImageAttachment* imageAttachment, bool* syncLoad) Obtains whether the image is loaded synchronously in the image style.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_SetSupportSvg(OH_ArkUI_ImageAttachment* imageAttachment, bool supportSvg) Sets whether to enable the enhanced SVG tag parsing feature in the image style. If this feature is enabled, extended SVG tags and attributes can be parsed.
ArkUI_ErrorCode OH_ArkUI_ImageAttachment_GetSupportSvg(const OH_ArkUI_ImageAttachment* imageAttachment, bool* supportSvg) Obtains whether the enhanced SVG tag parsing feature is enabled in the image style.
ArkUI_ErrorCode OH_ArkUI_TextEditorChangeEvent_GetRangeBefore(const OH_ArkUI_TextEditorChangeEvent* event, uint32_t* start, uint32_t* end) Obtains the range of the original text to be replaced in the text change information.
ArkUI_ErrorCode OH_ArkUI_TextEditorChangeEvent_GetReplacementStyledString(const OH_ArkUI_TextEditorChangeEvent* event, ArkUI_StyledString_Descriptor* descriptor) Obtains the styled string used for replacement in the text change information.
ArkUI_ErrorCode OH_ArkUI_TextEditorChangeEvent_GetPreviewStyledString(const OH_ArkUI_TextEditorChangeEvent* event, ArkUI_StyledString_Descriptor* descriptor) Obtains the styled string of the previewed content in the text change information.
void OH_ArkUI_TextLayoutManager_Dispose(ArkUI_TextLayoutManager* layoutManager) Releases the memory occupied by the text layout manager object.
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetLineCount(ArkUI_TextLayoutManager* layoutManager, int32_t* outLineCount) Obtains the number of lines.
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) Obtains the drawing area information of characters or placeholders within a specified text range under the given rectangle width and height.
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetGlyphPositionAtCoordinate(ArkUI_TextLayoutManager* layoutManager, double dx, double dy, OH_Drawing_PositionAndAffinity** outPos) Obtains the position of the glyph closest to the given coordinates.
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetLineMetrics(ArkUI_TextLayoutManager* layoutManager, int32_t lineNumber, OH_Drawing_LineMetrics* outMetrics) Obtains the information about the specified line, including line metrics, text style information, and font properties.
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetCharacterPositionAtCoordinate(ArkUI_TextLayoutManager* layoutManager, double dx, double dy, OH_Drawing_PositionAndAffinity** outPos) Obtains the position information of the character closest to the specified coordinates. The difference between this API and OH_ArkUI_TextLayoutManager_GetGlyphPositionAtCoordinate is as follows: This API returns character-level position information, which is applicable to character encoding-based scenarios such as text editing and cursor positioning. GetGlyphPositionAtCoordinate returns glyph-level position information, which is applicable to rendering-related precise positioning scenarios.
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetGlyphRangeForCharacterRange(ArkUI_TextLayoutManager* layoutManager, OH_Drawing_Range* charRange, OH_Drawing_Range** outGlyphRange, OH_Drawing_Range** outActualCharRange) Obtains the glyph range generated by the specified character range.
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetCharacterRangeForGlyphRange(ArkUI_TextLayoutManager* layoutManager, OH_Drawing_Range* glyphRange, OH_Drawing_Range** outCharRange, OH_Drawing_Range** outActualGlyphRange) Obtains the character range generated by the specified glyph range.
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetCharacterPositionAtCoordinateWithEncoding(ArkUI_TextLayoutManager* layoutManager, double dx, double dy, OH_ArkUI_TextEncoding encoding, OH_Drawing_PositionAndAffinity** outPos) Obtains the position information of the character closest to the specified coordinates based on the specified encoding type.
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetGlyphRangeForCharacterRangeWithEncoding(ArkUI_TextLayoutManager* layoutManager, OH_Drawing_Range* charRange, OH_ArkUI_TextEncoding encoding, OH_Drawing_Range** outGlyphRange, OH_Drawing_Range** outActualCharRange) Obtains the glyph range and the actual character range based on the specified encoding type and text character range.
ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetCharacterRangeForGlyphRangeWithEncoding(ArkUI_TextLayoutManager* layoutManager, OH_Drawing_Range* glyphRange, OH_ArkUI_TextEncoding encoding, OH_Drawing_Range** outCharRange, OH_Drawing_Range** outActualGlyphRange) Obtains the character range and the actual glyph range based on the specified encoding type and text glyph range.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetLinearGradient(OH_ArkUI_ParagraphStyle* paragraphStyle, const OH_ArkUI_LinearGradientOptions* linearGradient) Sets linear gradient for a paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetLinearGradient(const OH_ArkUI_ParagraphStyle* paragraphStyle, OH_ArkUI_LinearGradientOptions* linearGradient) Obtains the linear gradient of the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetRadialGradient(OH_ArkUI_ParagraphStyle* paragraphStyle, const OH_ArkUI_RadialGradientOptions* radialGradient) Sets radial gradient for a paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetRadialGradient(const OH_ArkUI_ParagraphStyle* paragraphStyle, OH_ArkUI_RadialGradientOptions* radialGradient) Obtains the radial gradient of the paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetTailIndents(OH_ArkUI_ParagraphStyle* paragraphStyle, const float* tailIndents, uint32_t size) Sets tail indentation for a paragraph style.
ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetTailIndents(const OH_ArkUI_ParagraphStyle* paragraphStyle, float** tailIndents, uint32_t tailIndentsSize, uint32_t* writeLength) Obtains the tail indentation of the paragraph style.

Enum Description

[h2]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.

[h2]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, which is applicable to common text scenarios that do not require the superscript or subscript effect.
OH_ARKUI_SUPERSCRIPTSTYLE_SUPERSCRIPT = 1 Superscript text style, which is applicable to scenarios such as exponent representation (for example, x²) in mathematical formulas or footnote reference marks.
OH_ARKUI_SUPERSCRIPTSTYLE_SUBSCRIPT = 2 Subscript text style, which is applicable to scenarios such as element subscript representation (for example, H₂O) in chemical formulas or subscript representation of mathematical variables.

[h2]OH_ArkUI_TextEncoding

enum OH_ArkUI_TextEncoding

Description

Enumerates the text encoding types supported by the text layout query API.

Since: 26.0.0

Value Description
OH_ARKUI_TEXT_ENCODING_UTF8 = 0 UTF-8 encoding. The character position or range is calculated based on the UTF-8 byte offset.
OH_ARKUI_TEXT_ENCODING_UTF16 = 1 UTF-16 encoding. The character position or range is calculated based on the UTF-16 code unit offset.

Function Description

[h2]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.

When the object is no longer used, call OH_ArkUI_StyledString_Destroy to destroy it.

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. The possible causes include insufficient memory or invalid parameters (for example, the style or collection parameter is a null pointer).

[h2]OH_ArkUI_StyledString_Destroy()

void OH_ArkUI_StyledString_Destroy(ArkUI_StyledString* handle)

Description

Releases the memory occupied by the ArkUI_StyledString object.

Since: 12

Parameters

Name Description
ArkUI_StyledString* handle Pointer to an ArkUI_StyledString object.

[h2]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.

The style pushed by calling this API must be popped out of the stack by calling OH_ArkUI_StyledString_PopTextStyle after being used. The style that is not popped out of the stack will continuously affect the subsequent text layout. The typical usage process is as follows: PushTextStyle → AddText → PopTextStyle.

Since: 12

Parameters

Name Description
ArkUI_StyledString* handle Pointer to an ArkUI_StyledString object.
OH_Drawing_TextStyle* style Pointer to the OH_Drawing_TextStyle object, which is created by OH_Drawing_CreateTextStyle.

[h2]OH_ArkUI_StyledString_AddText()

void OH_ArkUI_StyledString_AddText(ArkUI_StyledString* handle, const char* content)

Description

Adds text for a styled string. The added text uses the typesetting style at the top of the current stack. The style is pushed by OH_ArkUI_StyledString_PushTextStyle. After the style at the top of the stack is popped out of the stack through OH_ArkUI_StyledString_PopTextStyle, the text added later will use the new style at the top.

Since: 12

Parameters

Name Description
ArkUI_StyledString* handle Pointer to an ArkUI_StyledString object.
const char* content Pointer to the text content.

[h2]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.

This API must be called after OH_ArkUI_StyledString_PushTextStyle to remove the previously pushed style from the stack. Calling this API on an empty stack has no effect.

Since: 12

Parameters

Name Description
ArkUI_StyledString* handle Pointer to an ArkUI_StyledString object.

[h2]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 because the handle parameter is a null pointer.

[h2]OH_ArkUI_StyledString_AddPlaceholder()

void OH_ArkUI_StyledString_AddPlaceholder(ArkUI_StyledString* handle, OH_Drawing_PlaceholderSpan* placeholder)

Description

Adds a placeholder to reserve a blank area with the specified width and height or embed custom content in a styled string. The size and other information are specified by OH_Drawing_PlaceholderSpan.

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.

[h2]OH_ArkUI_StyledString_Descriptor_Create()

ArkUI_StyledString_Descriptor* OH_ArkUI_StyledString_Descriptor_Create(void)

Description

Creates an ArkUI_StyledString_Descriptor object.

When the object is no longer used, call OH_ArkUI_StyledString_Descriptor_Destroy to destroy it.

Since: 14

Return value

Type Description
ArkUI_StyledString_Descriptor* Pointer to the ArkUI_StyledString_Descriptor object, which is used to store the text and style information of the styled string.

[h2]OH_ArkUI_StyledString_Descriptor_Destroy()

void OH_ArkUI_StyledString_Descriptor_Destroy(ArkUI_StyledString_Descriptor* descriptor)

Description

Releases the memory occupied by the ArkUI_StyledString_Descriptor object.

Since: 14

Parameters

Name Description
ArkUI_StyledString_Descriptor* descriptor Pointer to an ArkUI_StyledString_Descriptor object.

[h2]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. The possible causes are that the input parameter is a null pointer or the parameter value is not within the valid range. Ensure that the parameter is valid.

[h2]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. The possible causes are that the input parameter is a null pointer or the parameter value is not within the valid range. Ensure that the parameter is valid.

Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. The possible causes are that the styled string object has been destroyed or not correctly created. Ensure that a valid styled string object is used.

[h2]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 HTML. This pointer is internally managed and is released when OH_ArkUI_StyledString_Descriptor_Destroy() is called.

[h2]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.

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 the plain text content of the styled string.
const OH_ArkUI_SpanStyle** styles Double pointer to the style set of the styled string, which points to an OH_ArkUI_SpanStyle object array. Before using each OH_ArkUI_SpanStyle object in the array, you need to call OH_ArkUI_SpanStyle_SetStart and OH_ArkUI_SpanStyle_SetLength to set the usage scope of the style.
int32_t length Number of elements in the style object array. The value range is [0, +∞). The value must be the same as the actual length of the array to which the passed styles pointer points.

Return value

Type Description
ArkUI_StyledString_Descriptor*

Pointer to the created ArkUI_StyledString_Descriptor object.

If a null pointer is returned, the creation fails because the input parameter is a null pointer or the parameter value is invalid.

[h2]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.

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 because the input parameter is a null pointer or the parameter value is invalid.

[h2]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.

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 because the input parameter is a null pointer or the parameter value is invalid.

[h2]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 output parameter, which is used to receive the length of 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. The possible causes are that the descriptor or length is a null pointer. Ensure that the parameter is valid.

Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. The possible causes are that the styled string object has been destroyed or not correctly created. Ensure that a valid styled string object is used.

[h2]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. The possible causes are that the descriptor, buffer, or writeLength is a null pointer. Ensure that the parameter is valid.

Returns ARKUI_ERROR_CODE_INVALID_STYLED_STRING if the styled string is invalid. The possible causes are that the styled string object has been destroyed or not correctly created. Ensure that a valid styled string object is used.

Returns ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR if the provided buffer size is less than the length of the data to be written. To solve this issue, obtain the minimum buffer size using the writeLength parameter, allocate a buffer of sufficient size, and call the API again.

[h2]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.

[h2]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]. If the value is out of range, ARKUI_ERROR_CODE_PARAM_INVALID is returned.
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.

[h2]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 enumeration in 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.

[h2]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. Currently, the following HTML tags can be converted: <p>, <span>, <img>, <br>, <strong>, <b>, <a>, <i>, <em>, <s>, <u>, <del>, <sup>, <sub>, <cite>, <dfn>, <small>, <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, <ol>, <ul>, and <li>.

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.

[h2]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.

[h2]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.

[h2]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.

[h2]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. The difference between this API and OH_ArkUI_StyledString_Descriptor_SetStyle is as follows: ReplaceStyle clears all existing styles of all types within the specified range and then sets a new style. SetStyle sets a style for the specified range and replaces only the existing style of the same type, without affecting other types of styles. You are advised to use ReplaceStyle when you need to completely replace the existing style and use SetStyle when you need to add a style.

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.

[h2]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. The difference between this API and OH_ArkUI_StyledString_Descriptor_ReplaceStyle is as follows: SetStyle sets a style for a specified range and replaces only the existing style of the same type, without affecting other types of styles. It is applicable to scenarios where styles are overlaid. ReplaceStyle clears all existing styles of all types within the specified range and then sets a new style. It is applicable to scenarios where existing styles need to be completely replaced.

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.

[h2]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.

After the style is removed, the default style of the corresponding attribute of the TextEditor component is used. For example, after the text style is removed, the default font style 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 enumeration in 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.

[h2]OH_ArkUI_StyledString_Descriptor_ClearStyles()

ArkUI_ErrorCode OH_ArkUI_StyledString_Descriptor_ClearStyles(ArkUI_StyledString_Descriptor* descriptor)

Description

Clears all styles of a styled string.

After the styles are cleared, the default style of the corresponding attribute of the TextEditor component is used. For example, after the text style is cleared, the default font style 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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

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.

[h2]OH_ArkUI_TextStyle_Create()

OH_ArkUI_TextStyle* OH_ArkUI_TextStyle_Create()

Description

Creates an OH_ArkUI_TextStyle object.

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, which is used to define the text font style.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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 provided buffer size is less than the length of the data to be written. To solve this issue, obtain the minimum buffer size using the writeLength parameter, allocate a buffer of sufficient size, and call the API again.

[h2]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. The value range is [0, +∞). If a negative value is passed, the default font size is used. The default value is 16 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.

[h2]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.

[h2]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 enumerated value of ArkUI_FontWeight. The default value is ARKUI_FONT_WEIGHT_W400.

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.

[h2]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 enumerated value of ArkUI_FontWeight. The default value is ARKUI_FONT_WEIGHT_W400.

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.

[h2]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.

[h2]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.

[h2]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. The value range is (-∞, +∞). A negative value results in solid text. A positive value results in outlined text. A value of 0 applies no stroke effect. Default value: 0vp.

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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]OH_ArkUI_SpanStyle_Create()

OH_ArkUI_SpanStyle* OH_ArkUI_SpanStyle_Create()

Description

Creates an OH_ArkUI_SpanStyle object.

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, which is used to set the scope and specific style of the styled string.

[h2]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.

[h2]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.

[h2]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. This parameter must be used together with OH_ArkUI_SpanStyle_SetLength to specify the scope where the style takes effect. The value range is [0, Length of the styled string]. If the value is out of the range, 0 is used.

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.

[h2]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.

[h2]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. This parameter must be used together with OH_ArkUI_SpanStyle_SetStart to specify the scope where the style takes effect. The value range is [0, Difference between the length of the styled string and the value of start]. If the value is less than 0 or exceeds the difference between the string length and the value of start, it is treated as the difference between the string length 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.

[h2]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.

[h2]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.

This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object. A SpanStyle object can hold only one type of style. After a new type of style is set, other types of styles (such as GestureStyle and ParagraphStyle) that have been set will be cleared.

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.

[h2]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.

[h2]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.

  • This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object. A SpanStyle object can hold only one type of style. After a new type of style is set, other types of styles (such as TextStyle and GestureStyle) that have been set will be cleared.

  • The style of a paragraph is the one (if any) set for the first element or the paragraph style of the bound component.

  • In versions earlier than API version 26.0.0, if the first placeholder in a paragraph of a styled string is OH_ArkUI_CustomSpan or OH_ArkUI_ImageAttachment, the paragraph style set for the paragraph does not take effect. Since API version 26.0.0, the paragraph style takes effect.

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.

[h2]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.

[h2]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.

This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object. A SpanStyle object can hold only one type of style. After a new type of style is set, other types of styles (such as TextStyle and ParagraphStyle) that have been set will be cleared.

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.

[h2]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.

[h2]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.

This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object. A SpanStyle object can hold only one type of style. After a new type of style is set, other types of styles (such as GestureStyle and ParagraphStyle) that have been set will be cleared.

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.

[h2]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.

[h2]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.

This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object. A SpanStyle object can hold only one type of style. After a new type of style is set, other types of styles (such as GestureStyle and ParagraphStyle) that have been set will be cleared.

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.

[h2]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.

[h2]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.

This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object. A SpanStyle object can hold only one type of style. After a new type of style is set, other types of styles (such as GestureStyle and ParagraphStyle) that have been set will be cleared.

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.

[h2]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.

[h2]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.

This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object. A SpanStyle object can hold only one type of style. After a new type of style is set, other types of styles (such as GestureStyle and ParagraphStyle) that have been set will be cleared.

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.

[h2]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.

[h2]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.

This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object. A SpanStyle object can hold only one type of style. After a new type of style is set, other types of styles (such as GestureStyle and ParagraphStyle) that have been set will be cleared.

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.

[h2]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.

[h2]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.

This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object. A SpanStyle object can hold only one type of style. After a new type of style is set, other types of styles (such as GestureStyle and ParagraphStyle) that have been set will be cleared.

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.

[h2]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.

[h2]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.

This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object. A SpanStyle object can hold only one type of style. After a new type of style is set, other types of styles (such as GestureStyle and ParagraphStyle) that have been set will be cleared.

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.

[h2]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.

[h2]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.

This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object. A SpanStyle object can hold only one type of style. After a new type of style is set, other types of styles (such as GestureStyle and ParagraphStyle) that have been set will be cleared.

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.

[h2]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.

[h2]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.

This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object. A SpanStyle object can hold only one type of style. After a new type of style is set, other types of styles (such as GestureStyle and ParagraphStyle) that have been set will be cleared.

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.

[h2]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.

[h2]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.

This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object. A SpanStyle object can hold only one type of style. After a new type of style is set, other types of styles (such as GestureStyle and ParagraphStyle) that have been set will be cleared.

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.

[h2]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.

[h2]OH_ArkUI_LeadingMarginSpanDrawInfo_Create()

OH_ArkUI_LeadingMarginSpanDrawInfo* OH_ArkUI_LeadingMarginSpanDrawInfo_Create()

Description

Creates an OH_ArkUI_LeadingMarginSpanDrawInfo object.

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, which is used to define the custom drawing information for paragraph indentation.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]OH_ArkUI_ParagraphStyle_Create()

OH_ArkUI_ParagraphStyle* OH_ArkUI_ParagraphStyle_Create()

Description

Creates an OH_ArkUI_ParagraphStyle object.

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, which is used to define the paragraph style.

[h2]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.

[h2]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 mode. 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.

[h2]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 mode. 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.

[h2]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. The value range is [0, +∞). If a negative value is passed, the default value 0 is used.

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.

[h2]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.

[h2]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. The value range is [0, +∞). If a negative number is passed, there is no limit.

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.

[h2]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.

[h2]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.

[h2]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.

[h2]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. Different word breaking policies apply to different scenarios. For details, see the enumerated values of ArkUI_WordBreak.

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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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 mode. 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.

[h2]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 mode. 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.

[h2]OH_ArkUI_ParagraphStyle_RegisterOnDrawLeadingMarginCallback()

ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_RegisterOnDrawLeadingMarginCallback(OH_ArkUI_ParagraphStyle* paragraphStyle, void(*onDraw)(ArkUI_DrawContext* context, OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo))

Description

Registers 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, OH_ArkUI_LeadingMarginSpanDrawInfo* drawInfo) Pointer to the callback function triggered when the paragraph indentation is drawn. Callback parameters: context indicates the graphics drawing context, and drawInfo indicates the custom drawing information object 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.

[h2]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. Pointer to the callback return value, indicating the paragraph indentation distance, 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.

[h2]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.

[h2]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.

[h2]OH_ArkUI_GestureStyle_Create()

OH_ArkUI_GestureStyle* OH_ArkUI_GestureStyle_Create()

Description

Creates an OH_ArkUI_GestureStyle object.

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, which is used to define the event gesture style.

[h2]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.

[h2]OH_ArkUI_GestureStyle_RegisterOnClickCallback()

ArkUI_ErrorCode OH_ArkUI_GestureStyle_RegisterOnClickCallback(OH_ArkUI_GestureStyle* gestureStyle, void(*onClick)(ArkUI_NodeEvent*))

Description

Registers 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*) Pointer to the callback function for the click event. Callback parameter: event indicates the node event object, which contains information about 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.

[h2]OH_ArkUI_GestureStyle_RegisterOnLongPressCallback()

ArkUI_ErrorCode OH_ArkUI_GestureStyle_RegisterOnLongPressCallback(OH_ArkUI_GestureStyle* gestureStyle, void(*onLongPress)(ArkUI_GestureEvent*))

Description

Registers 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*) Pointer to the callback function for the long-pressing event. Callback parameter: event indicates the gesture event object, which contains information about 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.

[h2]OH_ArkUI_GestureStyle_RegisterOnTouchCallback()

ArkUI_ErrorCode OH_ArkUI_GestureStyle_RegisterOnTouchCallback(OH_ArkUI_GestureStyle* gestureStyle, void(*onTouch)(ArkUI_NodeEvent*))

Description

Registers 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*) Pointer to the callback function for the touch event. Callback parameter: event indicates the node event object, which contains information about 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.

[h2]OH_ArkUI_TextShadowStyle_Create()

OH_ArkUI_TextShadowStyle* OH_ArkUI_TextShadowStyle_Create()

Description

Creates an OH_ArkUI_TextShadowStyle object.

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, which is used to define the text shadow style.

[h2]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.

[h2]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 Number of elements in the array of 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.

[h2]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.

[h2]OH_ArkUI_DecorationStyle_Create()

OH_ArkUI_DecorationStyle* OH_ArkUI_DecorationStyle_Create()

Description

Creates an OH_ArkUI_DecorationStyle object.

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, which is used to define the text decorative line style.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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, +∞). If a negative number is passed, the value does not take effect. Default value: 1.

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.

[h2]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.

[h2]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. If true is passed, the display of multiple decorative lines is enabled, allowing multiple types of decorative lines (for example, both underline and strikethrough) to be displayed at the same time. This is applicable to scenarios where a composite decorative effect is required. If false is passed, the display of multiple decorative lines is disabled, and only a single type of decorative line is displayed. This is applicable to scenarios where only one type of decorative line is required.

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.

[h2]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 indicates the display of multiple decorative lines is 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.

[h2]OH_ArkUI_BaselineOffsetStyle_Create()

OH_ArkUI_BaselineOffsetStyle* OH_ArkUI_BaselineOffsetStyle_Create()

Description

Creates an OH_ArkUI_BaselineOffsetStyle object.

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, which is used to define the baseline offset style.

[h2]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.

[h2]OH_ArkUI_BaselineOffsetStyle_SetBaselineOffset()

ArkUI_ErrorCode OH_ArkUI_BaselineOffsetStyle_SetBaselineOffset(OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle, float baselineOffset)

Description

Sets the baseline offset. This API is applicable to scenarios where the text baseline position needs to be adjusted, for example, positioning the superscript and subscript, and vertically aligning the icon with the text in a line.

Since: 24

Parameters

Name Description
OH_ArkUI_BaselineOffsetStyle* baselineOffsetStyle Pointer to the OH_ArkUI_BaselineOffsetStyle object.
float baselineOffset Baseline offset, in vp. The value range is (-∞, +∞). Positive and negative values correspond to different offset directions. The value 0 indicates no offset. The specific direction effect needs to be determined based on the scenario, such as the superscript and subscript.

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.

[h2]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.

[h2]OH_ArkUI_LetterSpacingStyle_Create()

OH_ArkUI_LetterSpacingStyle* OH_ArkUI_LetterSpacingStyle_Create()

Description

Creates an OH_ArkUI_LetterSpacingStyle object.

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, which is used to define the letter spacing style.

[h2]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.

[h2]OH_ArkUI_LetterSpacingStyle_SetLetterSpacing()

ArkUI_ErrorCode OH_ArkUI_LetterSpacingStyle_SetLetterSpacing(OH_ArkUI_LetterSpacingStyle* letterSpacingStyle, float letterSpacing)

Description

Sets the letter spacing. This API is applicable to scenarios where the text spacing needs to be adjusted, for example, increasing the spacing for titles to improve readability or decreasing the spacing for compact typesetting.

Since: 24

Parameters

Name Description
OH_ArkUI_LetterSpacingStyle* letterSpacingStyle Pointer to the OH_ArkUI_LetterSpacingStyle object.
float letterSpacing Letter spacing value, in vp. The value range is (-∞, +∞). A positive value indicates that the character spacing is increased, a negative value indicates that the character spacing is decreased, and 0 indicates that the default spacing is used.

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.

[h2]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.

[h2]OH_ArkUI_LineHeightStyle_Create()

OH_ArkUI_LineHeightStyle* OH_ArkUI_LineHeightStyle_Create()

Description

Creates an OH_ArkUI_LineHeightStyle object.

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, which is used to define the line height style.

[h2]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.

[h2]OH_ArkUI_LineHeightStyle_SetLineHeight()

ArkUI_ErrorCode OH_ArkUI_LineHeightStyle_SetLineHeight(OH_ArkUI_LineHeightStyle* lineHeightStyle, float lineHeight)

Description

Sets the line height.

If this API and OH_ArkUI_LineHeightStyle_SetLineHeightMultiple are used at the same time, only lineHeightMultiple takes effect. If the value of lineHeightMultiple is less than 0, the setting does not take effect. In this case, use lineHeight to set 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. If both this parameter and OH_ArkUI_LineHeightStyle_SetLineHeightMultiple are set, only lineHeightMultiple takes effect. If lineHeightMultiple is set to a value less than 0, the setting does not take effect. In this case, use lineHeight to set the line height. The value range is (-∞, +∞). A negative value indicates that the font size is adaptive.

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.

[h2]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.

[h2]OH_ArkUI_LineHeightStyle_SetLineHeightMultiple()

ArkUI_ErrorCode OH_ArkUI_LineHeightStyle_SetLineHeightMultiple(OH_ArkUI_LineHeightStyle* lineHeightStyle, float lineHeightMultiple)

Description

Sets a line height multiplier.

  • 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 by calling OH_ArkUI_LineHeightStyle_SetLineHeight().

  • 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, +∞). If a negative number is passed, the value does not take effect. If 0 is passed, the value is equivalent to 1.

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.

[h2]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.

[h2]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.

This operation will replace other styles that have been set in the OH_ArkUI_SpanStyle object. A SpanStyle object can hold only one type of style. After a new type of style is set, other types of styles (such as GestureStyle and ParagraphStyle) that have been set will be cleared.

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.

[h2]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, which is used to define the line spacing 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.

[h2]OH_ArkUI_LineSpacingStyle_Create()

OH_ArkUI_LineSpacingStyle* OH_ArkUI_LineSpacingStyle_Create()

Description

Creates an OH_ArkUI_LineSpacingStyle object.

When the object is no longer used, call OH_ArkUI_LineSpacingStyle_Destroy to destroy it.

Since: 26.0.0

Return value

Type Description
OH_ArkUI_LineSpacingStyle* Pointer to the OH_ArkUI_LineSpacingStyle object, which is used to define the line spacing style.

[h2]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.

[h2]OH_ArkUI_LineSpacingStyle_SetLineSpacing()

ArkUI_ErrorCode OH_ArkUI_LineSpacingStyle_SetLineSpacing(OH_ArkUI_LineSpacingStyle* lineSpacingStyle, float lineSpacing)

Description

Sets line spacing.

If this API and OH_ArkUI_LineHeightStyle_SetLineHeightMultiple are used at the same time, only lineHeightMultiple takes effect. If the value of lineHeightMultiple is less than 0, the setting does not take effect, and the line spacing takes effect normally.

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. The value range is (-∞, +∞). If both this parameter and OH_ArkUI_LineHeightStyle_SetLineHeightMultiple are set, only lineHeightMultiple takes effect. If the value of lineHeightMultiple is less than 0, the setting does not take effect, and the line spacing takes effect normally.

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.

[h2]OH_ArkUI_LineSpacingStyle_GetLineSpacing()

ArkUI_ErrorCode OH_ArkUI_LineSpacingStyle_GetLineSpacing(const OH_ArkUI_LineSpacingStyle* lineSpacingStyle, float* lineSpacing)

Description

Obtains 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.

[h2]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.

[h2]OH_ArkUI_LineSpacingStyle_GetOnlyBetweenLines()

ArkUI_ErrorCode OH_ArkUI_LineSpacingStyle_GetOnlyBetweenLines(const OH_ArkUI_LineSpacingStyle* lineSpacingStyle, bool* onlyBetweenLines)

Description

Obtains 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.

[h2]OH_ArkUI_BackgroundColorStyle_Create()

OH_ArkUI_BackgroundColorStyle* OH_ArkUI_BackgroundColorStyle_Create()

Description

Creates an OH_ArkUI_BackgroundColorStyle object.

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, which is used to define the background color style.

[h2]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.

[h2]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.

[h2]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.

[h2]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. The value range is [0, +∞). If a negative value is passed, the default value 0 is used.
float topRight Radius of the upper right corner, in vp. The value range is [0, +∞). If a negative value is passed, the default value 0 is used.
float bottomLeft Radius of the lower left corner, in vp. The value range is [0, +∞). If a negative value is passed, the default value 0 is used.
float bottomRight Radius of the lower right corner, in vp. The value range is [0, +∞). If a negative value is passed, the default value 0 is used.

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.

[h2]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.

[h2]OH_ArkUI_UrlStyle_Create()

OH_ArkUI_UrlStyle* OH_ArkUI_UrlStyle_Create()

Description

Creates an OH_ArkUI_UrlStyle object.

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, which is used to define the URL style.

[h2]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.

[h2]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.

[h2]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. You can obtain the minimum required buffer size through the writeLength parameter, allocate a buffer of sufficient size, and call this API again.

[h2]OH_ArkUI_UserDataSpan_Create()

OH_ArkUI_UserDataSpan* OH_ArkUI_UserDataSpan_Create()

Description

Creates an OH_ArkUI_UserDataSpan object.

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, which is used to define the user data span style.

[h2]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.

[h2]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.

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.

[h2]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.

[h2]OH_ArkUI_CustomSpan_Create()

OH_ArkUI_CustomSpan* OH_ArkUI_CustomSpan_Create()

Description

Creates an OH_ArkUI_CustomSpan object.

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, which is used to define the custom span.

[h2]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.

[h2]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. This API is applicable to scenarios where the size needs to be calculated based on the content when custom content (such as custom icons, inline controls, and special emojis) is embedded in the text. The size returned by the callback will affect the placeholder size of the span in text typesetting.

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.

[h2]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. This API is applicable to scenarios where non-standard text content needs to be drawn, for example, drawing custom icons, decorative graphics, or special marks in text. Through this callback, you can use the graphics drawing context to implement any custom drawing effect.

Since: 24

Parameters

Name Description
OH_ArkUI_CustomSpan* customSpan Pointer to the OH_ArkUI_CustomSpan object.
void(*onDraw)(ArkUI_DrawContext*, ArkUI_CustomSpanDrawInfo*) Callback function triggered during drawing. Callback parameters: context indicates the graphics drawing context, and 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.

[h2]OH_ArkUI_ImageAttachment_Create()

OH_ArkUI_ImageAttachment* OH_ArkUI_ImageAttachment_Create()

Description

Creates an OH_ArkUI_ImageAttachment object.

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, which is used to define the image style object.

[h2]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.

[h2]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.

If both this API and OH_ArkUI_ImageAttachment_SetResource are used at the same time, 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.

[h2]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.

[h2]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.

If both this API and OH_ArkUI_ImageAttachment_SetPixelMap are used at the same time, 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.

[h2]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.

[h2]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. The value range is [0, +∞). The default value 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.

[h2]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. The value range is [0, +∞). The default value 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.

[h2]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. 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.

[h2]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.

[h2]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 mode. 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.

[h2]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 mode. 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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]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. The value range is [0, +∞). If a negative value is passed, the default value 0 is used.
float topRight Radius of the upper right corner, in vp. The value range is [0, +∞). If a negative value is passed, the default value 0 is used.
float bottomLeft Radius of the lower left corner, in vp. The value range is [0, +∞). If a negative value is passed, the default value 0 is used.
float bottomRight Radius of the lower right corner, in vp. The value range is [0, +∞). If a negative value is passed, the default value 0 is used.

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.

[h2]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. Value range: [0, +∞).
float* topRight Pointer to the radius of the upper right corner, in vp. Value range: [0, +∞).
float* bottomLeft Pointer to the radius of the lower left corner, in vp. Value range: [0, +∞).
float* bottomRight Pointer to the radius of the lower right corner, in vp. Value range: [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.

[h2]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.

If both this API and OH_ArkUI_ImageAttachment_SetDrawingColorFilter are used at the same time, 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, which is a float array containing color matrix transformation coefficients used to transform the image color. The array length is specified by the size parameter.
uint32_t size Number of elements in the 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.

[h2]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.

[h2]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.

If both this API and OH_ArkUI_ImageAttachment_SetColorFilter are used at the same time, 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.

[h2]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.

[h2]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.

This attribute is valid only when the image source is set to a resource address by calling 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. The value true indicates synchronous loading. During synchronous loading, if the UI thread is blocked, the placeholder image is not displayed. The value false indicates asynchronous loading.

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.

[h2]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.

[h2]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. After this feature is enabled, more SVG tags and attributes can be parsed, improving the rendering compatibility of SVG images.

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.

[h2]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. After this feature is enabled, more SVG tags and attributes can be parsed, improving the rendering compatibility of SVG images.

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.

[h2]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 original text 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.

[h2]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.

[h2]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.

[h2]OH_ArkUI_TextLayoutManager_Dispose()

void OH_ArkUI_TextLayoutManager_Dispose(ArkUI_TextLayoutManager* layoutManager)

Description

Releases the memory occupied by the text layout manager object.

Since: 22

Parameters

Name Description
ArkUI_TextLayoutManager* layoutManager Pointer to the ArkUI_TextLayoutManager object.

[h2]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.

[h2]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.

[h2]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 information of the character closest to the given coordinates. The returned position index is the UTF-16 character offset instead of the glyph offset. A glyph is a rendering visual unit and may have a many-to-many mapping relationship with a character. For example, if a text contains two Chinese characters and five letters, the glyph index range is [0, 7], the corresponding UTF-8 character index range is [0, 11], and the UTF-16 character index range is [0, 7].

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.

[h2]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.

[h2]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.

The difference between this API and OH_ArkUI_TextLayoutManager_GetGlyphPositionAtCoordinate is as follows: This API returns character-level position information, which is applicable to character encoding-based scenarios such as text editing and cursor positioning. GetGlyphPositionAtCoordinate returns glyph-level position information, which is applicable to rendering-related precise positioning scenarios.

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.

[h2]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.

[h2]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.

[h2]OH_ArkUI_TextLayoutManager_GetCharacterPositionAtCoordinateWithEncoding()

ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetCharacterPositionAtCoordinateWithEncoding(ArkUI_TextLayoutManager* layoutManager, double dx, double dy, OH_ArkUI_TextEncoding encoding, OH_Drawing_PositionAndAffinity** outPos)

Description

Obtains the position information of the character closest to the specified coordinates based on the specified encoding type.

Since: 26.0.0

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_ArkUI_TextEncoding encoding Encoding type used for the character position.
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.

[h2]OH_ArkUI_TextLayoutManager_GetGlyphRangeForCharacterRangeWithEncoding()

ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetGlyphRangeForCharacterRangeWithEncoding(ArkUI_TextLayoutManager* layoutManager, OH_Drawing_Range* charRange, OH_ArkUI_TextEncoding encoding,
OH_Drawing_Range** outGlyphRange, OH_Drawing_Range** outActualCharRange)

Description

Obtains the glyph range and the actual character range based on the specified encoding type and text character range.

After the OH_Drawing_Range objects returned by outGlyphRange and outActualCharRange are used, you need to release them by calling OH_Drawing_ReleaseRangeBuffer.

Since: 26.0.0

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_ArkUI_TextEncoding encoding Encoding type used for 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.

[h2]OH_ArkUI_TextLayoutManager_GetCharacterRangeForGlyphRangeWithEncoding()

ArkUI_ErrorCode OH_ArkUI_TextLayoutManager_GetCharacterRangeForGlyphRangeWithEncoding(ArkUI_TextLayoutManager* layoutManager, OH_Drawing_Range* glyphRange, OH_ArkUI_TextEncoding encoding,
OH_Drawing_Range** outCharRange, OH_Drawing_Range** outActualGlyphRange)

Description

Obtains the character range and the actual glyph range based on the specified encoding type and text glyph range.

After the OH_Drawing_Range objects returned by outCharRange and outActualGlyphRange are used, you need to release them by calling OH_Drawing_ReleaseRangeBuffer.

Since: 26.0.0

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_ArkUI_TextEncoding encoding Encoding type used for the character 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.

[h2]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.

[h2]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.

[h2]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.

[h2]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.

[h2]OH_ArkUI_ParagraphStyle_SetTailIndents()

ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_SetTailIndents(OH_ArkUI_ParagraphStyle* paragraphStyle, const float* tailIndents, uint32_t size)

Description

Sets tail indentation for a paragraph style.

All input pointer parameters must be allocated, managed, and released by the caller.

Since: 26.0.0

Parameters

Name Description
OH_ArkUI_ParagraphStyle* paragraphStyle Pointer to the OH_ArkUI_ParagraphStyle object.
const float* tailIndents Pointer to the tail indentation value array. Unit: fp. The value range is [0, +∞). The valid length is specified by size. If the value of size is 1, all text lines use the same tail indentation value specified by tailIndents[0]. If the value of size is greater than 1, the ith line (counted from 0) uses tailIndents[i] as the tail indentation value. When the number of text lines exceeds the value of size, the value of tailIndents[size - 1] is reused for indentation of the excess lines.
uint32_t size Number of valid tail indentation values in the tailIndents array.

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.

[h2]OH_ArkUI_ParagraphStyle_GetTailIndents()

ArkUI_ErrorCode OH_ArkUI_ParagraphStyle_GetTailIndents(const OH_ArkUI_ParagraphStyle* paragraphStyle, float** tailIndents, uint32_t tailIndentsSize, uint32_t* writeLength)

Description

Obtains the tail indentation of the paragraph style.

All input pointer parameters must be allocated, managed, and released by the caller.

Since: 26.0.0

Parameters

Name Description
const OH_ArkUI_ParagraphStyle* paragraphStyle Pointer to the OH_ArkUI_ParagraphStyle object.
float** tailIndents Double pointer to the tail indentation value array, in fp.
uint32_t tailIndentsSize Size of the tailIndents buffer.
uint32_t* writeLength Pointer to the number of tail indentation values actually written to the buffer.

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.

Returns ARKUI_ERROR_CODE_BUFFER_SIZE_ERROR if the buffer length is less than the minimum limit.