diff --git a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h index 9a324c807a683863d649a9e7bc6ec5139a59f919..1f5ff7adb372a8df31e5e0b7e97e4fab5a264eab 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h @@ -125,6 +125,14 @@ typedef struct OH_Drawing_FontParser OH_Drawing_FontParser; */ typedef struct OH_Drawing_TextShadow OH_Drawing_TextShadow; +/** + * @brief Defines an OH_Drawing_TextTab, which is used to to store the tab alignment type and position. + * + * @since 14 + * @version 1.0 + */ +typedef struct OH_Drawing_TextTab OH_Drawing_TextTab; + #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index d821c385580bc0c2fe13343d5bb52928b2a6adc0..7f4c3b9e2ad559a4f0481ace515276368ac7c0d7 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -2753,6 +2753,66 @@ void OH_Drawing_TypographyDestroyTextBox(OH_Drawing_TextBox*); void OH_Drawing_SetTextShadow(OH_Drawing_TextShadow* shadow, uint32_t color, OH_Drawing_Point* offset, double blurRadius); +/** + * @brief Creates an OH_Drawing_TextTab object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextAlign Indicates enumerates text tab alignment modes. TAB alignment, Support left alignment + * right alignment center alignment, other enumeration values are left alignment effect. + * @param float Indicates location of text tab. + * @return Returns the pointer to the OH_Drawing_TextTab object created. If the object returns NULL, + * the creation failed. The possible cause of the failure is that the application address space is used up. + * As a result, space cannot be allocated. + * @since 14 + * @version 1.0 + */ +OH_Drawing_TextTab* OH_Drawing_CreateTextTab(OH_Drawing_TextAlign alignment, float location); + +/** + * @brief Releases the memory occupied by an OH_Drawing_TextTab object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextTab Indicates the pointer to an OH_Drawing_TextTab object. + * @since 14 + * @version 1.0 + */ +void OH_Drawing_DestroyTextTab(OH_Drawing_TextTab*); + +/** + * @brief Get alignment of an OH_Drawing_TextTab object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextTab Indicates the pointer to an OH_Drawing_TextTab object. + * @return Returns align of an OH_Drawing_TextTab object. + * @since 14 + * @version 1.0 + */ +OH_Drawing_TextAlign OH_Drawing_GetTextTabAlignment(OH_Drawing_TextTab*); + +/** + * @brief Get location of an OH_Drawing_TextTab object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextTab Indicates the pointer to an OH_Drawing_TextTab object. + * @return Returns location of an OH_Drawing_TextTab object. + * @since 14 + * @version 1.0 + */ +float OH_Drawing_GetTextTabLocation(OH_Drawing_TextTab*); + +/** + * @brief Sets the text tab of OH_Drawing_TypographyStyle object. + * Tab alignment does not take effect when text alignment is also set, Or when the ellipsis style is configured. + * When the tab is not set or the tab's location property is less than or equal to 0, it is the default space effect. + * And all tabs in the paragraph after the setting are aligned according to this tab effect. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param OH_Drawing_TextTab Indicates the pointer to an OH_Drawing_TextTab object. + * @since 14 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextTab(OH_Drawing_TypographyStyle*, OH_Drawing_TextTab* TextTab); #ifdef __cplusplus } #endif diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 9c5b0d26911786bccd36ed4d9437843b3385b714..50f94f9db1f18636a0a29664781324f39966a0f8 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -1465,5 +1465,25 @@ { "first_introduced": "13", "name":"OH_Drawing_RecordCmdDestroy" + }, + { + "first_introduced": "14", + "name":"OH_Drawing_CreateTextTab" + }, + { + "first_introduced": "14", + "name":"OH_Drawing_DestroyTextTab" + }, + { + "first_introduced": "14", + "name":"OH_Drawing_GetTextTabAlignment" + }, + { + "first_introduced": "14", + "name":"OH_Drawing_GetTextTabLocation" + }, + { + "first_introduced": "14", + "name":"OH_Drawing_SetTypographyTextTab" } ] \ No newline at end of file