diff --git a/build-tools/capi_parser/src/coreImpl/parser/kit_sub_system/c_file_kit_sub_system.json b/build-tools/capi_parser/src/coreImpl/parser/kit_sub_system/c_file_kit_sub_system.json
index 668e349dea236349fdb94eb55890b8fc711ec894..cbe3dff8771b9ea5282a1a3c0fbbcaeb7e9f5bb9 100644
--- a/build-tools/capi_parser/src/coreImpl/parser/kit_sub_system/c_file_kit_sub_system.json
+++ b/build-tools/capi_parser/src/coreImpl/parser/kit_sub_system/c_file_kit_sub_system.json
@@ -269,6 +269,11 @@
"kitName": "ArkGraphicsD",
"subSystem": "图形图像"
},
+ {
+ "filePath": "graphic/graphic_2d/native_drawing/drawing_text_run.h",
+ "kitName": "ArkGraphicsD",
+ "subSystem": "图形图像"
+ },
{
"filePath": "graphic/graphic_2d/native_drawing/drawing_text_typography.h",
"kitName": "ArkGraphicsD",
diff --git a/graphic/graphic_2d/native_drawing/BUILD.gn b/graphic/graphic_2d/native_drawing/BUILD.gn
index aea6e1dc4d1cfb37bb9425bf80c1ba123ca28877..d9d0fa8f69f1b55f0e42f00bd248342a554bc53e 100644
--- a/graphic/graphic_2d/native_drawing/BUILD.gn
+++ b/graphic/graphic_2d/native_drawing/BUILD.gn
@@ -49,6 +49,7 @@ ohos_ndk_headers("native_drawing_header") {
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_shadow_layer.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_surface.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_blob.h",
+ "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_run.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_declaration.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_text_typography.h",
"//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_typeface.h",
@@ -94,6 +95,7 @@ ohos_ndk_library("libnative_drawing_ndk") {
"native_drawing/drawing_shadow_layer.h",
"native_drawing/drawing_surface.h",
"native_drawing/drawing_text_blob.h",
+ "native_drawing/drawing_text_run.h",
"native_drawing/drawing_text_declaration.h",
"native_drawing/drawing_text_typography.h",
"native_drawing/drawing_typeface.h",
diff --git a/graphic/graphic_2d/native_drawing/drawing_text_run.h b/graphic/graphic_2d/native_drawing/drawing_text_run.h
new file mode 100644
index 0000000000000000000000000000000000000000..cce354ab760c4c43215c36afbb6c5894ffb061a5
--- /dev/null
+++ b/graphic/graphic_2d/native_drawing/drawing_text_run.h
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2024 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef C_INCLUDE_DRAWING_TEXT_RUN_H
+#define C_INCLUDE_DRAWING_TEXT_RUN_H
+
+/**
+ * @addtogroup Drawing
+ * @{
+ *
+ * @brief Provides the text run capability.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ *
+ * @since 14
+ * @version 1.0
+ */
+
+/**
+ * @file drawing_text_run.h
+ *
+ * @brief Declares functions related to run in the drawing module.
+ *
+ * @since 14
+ * @version 1.0
+ */
+
+#include "drawing_text_declaration.h"
+#include "drawing_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * @brief Gets the run glyph indices ,the offset of the index relative to the entire paragraph.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param run Indicates the pointer to an OH_Drawing_Run object.
+ * @param start The run of start index.
+ * @param length The run of length, if start and length are set to 0, then get all of the current run.
+ * @return Run of glyph indices array object OH_Drawing_Array.
+ * @since 14
+ */
+OH_Drawing_Array* OH_Drawing_GetRunStringIndices(OH_Drawing_Run* run, int64_t start, int64_t length);
+
+/**
+ * @brief Gets the run glyph indices by index.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param stringIndices the run glyph indices array object OH_Drawing_Array.
+ * @param index The run of glyph index.
+ * @return Run of glyph indices element.
+ * @since 14
+ */
+uint64_t OH_Drawing_GetRunStringIndicesByIndex(OH_Drawing_Array* stringIndices, size_t index);
+
+/**
+ * @brief Releases the memory run glyph indices array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param stringIndices glyph indices array object OH_Drawing_Array.
+ * @since 14
+ */
+void OH_Drawing_DestroyRunStringIndices(OH_Drawing_Array* stringIndices);
+
+/**
+ * @brief Gets the range run glyph location and length.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param run Indicates the pointer to an OH_Drawing_Run object.
+ * @param location The run of glyph location.
+ * @param length The run of glyph length.
+ * @since 14
+ */
+void OH_Drawing_GetRunStringRange(OH_Drawing_Run* run, uint64_t* location, uint64_t* length);
+
+/**
+ * @brief Gets the run typographic bound.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param run Indicates the pointer to an OH_Drawing_Run object.
+ * @param ascent The run of ascent.
+ * @param descent The run of descent.
+ * @param leading The run of leading.
+ * @return run typographic width.
+ * @since 14
+ */
+float OH_Drawing_GetRunTypographicBounds(OH_Drawing_Run* run, float* ascent, float* descent, float* leading);
+
+/**
+ * @brief Paints text on the canvas.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param canvas Indicates the pointer to an OH_Drawing_Canvas object.
+ * @param run Indicates the pointer to an OH_Drawing_Run object.
+ * @param x Indicates the x coordinate.
+ * @param y Indicates the y coordinate.
+ * @since 14
+ */
+void OH_Drawing_RunPaint(OH_Drawing_Canvas* canvas, OH_Drawing_Run* run, double x, double y);
+
+/**
+ * @brief Gets the run image bound.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param run Indicates the pointer to an OH_Drawing_Run object.
+ * @return The run image bounds to an OH_Drawing_Rect object.
+ * @since 14
+ */
+OH_Drawing_Rect* OH_Drawing_GetRunImageBounds(OH_Drawing_Run* run);
+
+ /**
+ * @brief Releases the memory run image bounds pointer.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param rect Run image bounds to an OH_Drawing_Rect object.
+ * @since 14
+ */
+void OH_Drawing_DestroyRunImageBounds(OH_Drawing_Rect* rect);
+
+/**
+ * @brief Gets the range glyph identifier for each character.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param run Indicates the pointer to an OH_Drawing_Run object.
+ * @param start The run of start index.
+ * @param length The run of length, if start and length are set to 0, then get all of the current run.
+ * @return Run of glyph array object OH_Drawing_ArrayOH_Drawing_Array.
+ * @param index The run of glyph index.
+ * @return Run of glyph element.
+ * @since 14
+ * @version 1.0
+ */
+uint16_t OH_Drawing_GetRunGlyphsByIndex(OH_Drawing_Array* glyphs, size_t index);
+
+/**
+ * @brief Releases the memory run glyph array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param glyphs The run of glyph array object OH_Drawing_Array.
+ * @since 14
+ */
+void OH_Drawing_DestroyRunGlyphs(OH_Drawing_Array* glyphs);
+
+/**
+ * @brief Gets the range glyph position array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param run Indicates the pointer to an OH_Drawing_Run object.
+ * @param start The run of start index.
+ * @param length The run of length, if start and length are set to 0, then get all of the current run.
+ * @return Run of position array object OH_Drawing_Array.
+ * @since 14
+ */
+OH_Drawing_Array* OH_Drawing_GetRunPositions(OH_Drawing_Run* run, int64_t start, int64_t length);
+
+/**
+ * @brief Gets the glyph position by index.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param positions The run of position array object OH_Drawing_Array.
+ * @param index The run of glyph index.
+ * @return Run of glyph position pointer to an OH_Drawing_Point object.
+ * @since 14
+ * @version 1.0
+ */
+OH_Drawing_Point* OH_Drawing_GetRunPositionsByIndex(OH_Drawing_Array* positions, size_t index);
+
+/**
+ * @brief Releases the memory run of position array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param positions The run of position array object OH_Drawing_Array.
+ * @since 14
+ */
+void OH_Drawing_DestroyRunPositions(OH_Drawing_Array* positions);
+
+/**
+ * @brief Gets the number of glyph.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param run Indicates the pointer to an OH_Drawing_Run object.
+ * @return The number of glyph.
+ * @since 14
+ */
+uint32_t OH_Drawing_GetRunGlyphCount(OH_Drawing_Run* run);
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif // C_INCLUDE_DRAWING_TEXT_RUN_H
\ No newline at end of file
diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
index 9c5b0d26911786bccd36ed4d9437843b3385b714..8dfb586d95544da423a3d4bfd2f7deb8ab470504 100644
--- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
+++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
@@ -1465,5 +1465,65 @@
{
"first_introduced": "13",
"name":"OH_Drawing_RecordCmdDestroy"
+ },
+ {
+ "first_introduced": "14",
+ "name":"OH_Drawing_GetRunStringIndices"
+ },
+ {
+ "first_introduced": "14",
+ "name":"OH_Drawing_GetRunStringIndicesByIndex"
+ },
+ {
+ "first_introduced": "14",
+ "name":"OH_Drawing_DestroyRunStringIndices"
+ },
+ {
+ "first_introduced": "14",
+ "name":"OH_Drawing_GetRunStringRange"
+ },
+ {
+ "first_introduced": "14",
+ "name":"OH_Drawing_GetRunTypographicBounds"
+ },
+ {
+ "first_introduced": "14",
+ "name":"OH_Drawing_RunPaint"
+ },
+ {
+ "first_introduced": "14",
+ "name":"OH_Drawing_GetRunImageBounds"
+ },
+ {
+ "first_introduced": "14",
+ "name":"OH_Drawing_DestroyRunImageBounds"
+ },
+ {
+ "first_introduced": "14",
+ "name":"OH_Drawing_GetRunGlyphs"
+ },
+ {
+ "first_introduced": "14",
+ "name":"OH_Drawing_GetRunGlyphsByIndex"
+ },
+ {
+ "first_introduced": "14",
+ "name":"OH_Drawing_DestroyRunGlyphs"
+ },
+ {
+ "first_introduced": "14",
+ "name":"OH_Drawing_GetRunPositions"
+ },
+ {
+ "first_introduced": "14",
+ "name":"OH_Drawing_GetRunPositionsByIndex"
+ },
+ {
+ "first_introduced": "14",
+ "name":"OH_Drawing_DestroyRunPositions"
+ },
+ {
+ "first_introduced": "14",
+ "name":"OH_Drawing_GetRunGlyphCount"
}
]
\ No newline at end of file