diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h
index ce73be523ba252f81d1b3094dc9a4c36ea3ebe6b..761c87664a243c9e38a0ad6b4f10b1e2ff691d05 100644
--- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h
+++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h
@@ -286,6 +286,41 @@ typedef enum {
RECT_WIDTH_STYLE_MAX,
} OH_Drawing_RectWidthStyle;
+/**
+ * @brief Text line position information
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct {
+ /** Text ascender height */
+ double ascender;
+ /** Tex descender height */
+ double descender;
+ /** The height of a capital letter */
+ double capHeight;
+ /** The height of a lowercase letter */
+ double xHeight;
+ /** Text width */
+ double width;
+ /** Line height */
+ double height;
+ /**
+ * The distance from the left end of the text to the left end of the container,
+ * aligned to 0, is the width of the container minus the width of the line of text
+ */
+ double x;
+ /**
+ * The height from the top of the text to the top of the container, the first line is 0,
+ * and the second line is the height of the first line
+ */
+ double y;
+ /** Line start character index */
+ size_t startIndex;
+ /** End of line character index */
+ size_t endIndex;
+} OH_Drawing_LineInfo;
+
/**
* @brief Creates an OH_Drawing_TypographyStyle object.
*
@@ -471,6 +506,94 @@ void OH_Drawing_SetTextStyleFontStyle(OH_Drawing_TextStyle*, int /* OH_Drawing_F
*/
void OH_Drawing_SetTextStyleLocale(OH_Drawing_TextStyle*, const char*);
+/**
+ * @brief Sets the foreground brush style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleForegroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*);
+
+/**
+ * @brief Gets the foreground brush style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @return Indicates the pointer to an OH_Drawing_Brush object.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Brush* OH_Drawing_GetTextStyleForegroundBrush(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Sets the foreground pen style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Pen object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleForegroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*);
+
+/**
+ * @brief Gets the foreground pen style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @return Indicates the pointer to an OH_Drawing_Pen object.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Pen* OH_Drawing_GetTextStyleForegroundPen(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Sets the background brush style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Brush object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleBackgroundBrush(OH_Drawing_TextStyle*, OH_Drawing_Brush*);
+
+/**
+ * @brief Gets the background brush style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @return Indicates the pointer to an OH_Drawing_Brush object.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Brush* OH_Drawing_GetTextStyleBackgroundBrush(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Sets the background pen style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @param OH_Drawing_Brush Indicates the pointer to an OH_Drawing_Pen object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_SetTextStyleBackgroundPen(OH_Drawing_TextStyle*, OH_Drawing_Pen*);
+
+/**
+ * @brief Gets the background pen style.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @return Indicates the pointer to an OH_Drawing_Pen object.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Pen* OH_Drawing_GetTextStyleBackgroundPen(OH_Drawing_TypographyStyle*);
+
/**
* @brief Creates a pointer to an OH_Drawing_TypographyCreate object.
*
@@ -1014,6 +1137,20 @@ double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography*, int);
*/
OH_Drawing_Range* OH_Drawing_TypographyGetLineTextRange(OH_Drawing_Typography*, int, bool);
+/**
+ * @brief Gets the position of the specified line or the first text of the specified line
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object.
+ * @param int Line number
+ * @param bool True is the information for the whole line, and false is the information to get the first character
+ * @param bool Whether the text width contains whitespace
+ * @return Returns the position information.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_LineInfo* OH_Drawing_TypographyGetLineInfo(OH_Drawing_Typography*, int, bool, bool);
+
#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 e916a8a3fe59e3b9ff8f3a1adf56ffaae4afd58c..cc07041e6bd806f76a161dec3221c418682f1682 100644
--- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
+++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
@@ -337,5 +337,41 @@
{
"first_introduced": "12",
"name": "OH_Drawing_TypographyGetLineTextRange"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TypographyGetLineInfo"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_SetTextStyleForegroundBrush"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_GetTextStyleForegroundBrush"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_SetTextStyleForegroundPen"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_GetTextStyleForegroundPen"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_SetTextStyleBackgroundBrush"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_GetTextStyleBackgroundBrush"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_SetTextStyleBackgroundPen"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_GetTextStyleBackgroundPen"
}
]
\ No newline at end of file