diff --git a/graphic/graphic_2d/native_drawing/drawing_font.h b/graphic/graphic_2d/native_drawing/drawing_font.h
index 38ea644f359e53892c949eb6f499df748d079975..55f088bcf335fb3cbc4d4ea47ed57325e0fc2bb6 100644
--- a/graphic/graphic_2d/native_drawing/drawing_font.h
+++ b/graphic/graphic_2d/native_drawing/drawing_font.h
@@ -497,6 +497,56 @@ typedef struct OH_Drawing_Font_Metrics {
*/
float OH_Drawing_FontGetMetrics(OH_Drawing_Font*, OH_Drawing_Font_Metrics*);
+/**
+ * @brief Get the text outline path.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object.
+ * @param text Indicates the character storage encoded with text encoding.
+ * @param byteLength Indicates the text length in bytes.
+ * @param encoding Indicates the text encoding.
+ * @param x Indicates x coordinates of the text.
+ * @param y Indicates y coordinates of the text.
+ * @return Returns an OH_Drawing_Path object, must be release by OH_Drawing_PathDestroy.
+ * Returns nullptr if OH_Drawing_Font is nullptr.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_Path* OH_Drawing_FontGetTextPath(OH_Drawing_Font* cFont, const void* text, size_t byteLength,
+ OH_Drawing_TextEncoding encoding, float x, float y);
+
+/**
+ * @brief Retrieves the bound rect for each glyph in glyph array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object.
+ * @param glyphs Indicates the array of glyph indices to be measured.
+ * @param count Indicates the number of glyphs.
+ * @param OH_Drawing_Array The bound rect array for each glyph, returned to the caller.
+ * @since 13
+ * @version 1.0
+ * @note OH_Drawing_Array object must be allocated by OH_Drawing_RectCreateArray function.
+ * @note Size of OH_Drawing_Array must be bigger than glyph counts.
+ * @note OH_Drawing_Rect use y-axis-goes-down system, y axis is inverted to the y-axis-goes-up system.
+ * @note OH_Drawing_Rect use two points(left-bottom & right-top) to describe the bound.
+ * @note The bound rect will be snap to integral boundaries.
+ */
+void OH_Drawing_FontGetBounds(const OH_Drawing_Font*, const uint16_t* glyphs, int count, OH_Drawing_Array*);
+
+/**
+ * @brief Create a path object for specified Glyph.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font Indicates the pointer to an OH_Drawing_Font object.
+ * @param glyph glyph index to be obtained.
+ * @return Returns an OH_Drawing_Path object of specified glyph index, return nullptr if error happened.
+ * @since 13
+ * @version 1.0
+ * @note OH_Drawing_Path use y-axis-goes-down system, y axis is inverted to the y-axis-goes-up system.
+ * @note Return value must be released by OH_Drawing_PathDestroy function.
+ */
+OH_Drawing_Path* OH_Drawing_FontCreatePathForGlyph(OH_Drawing_Font*, uint16_t glyph);
+
#ifdef __cplusplus
}
#endif
diff --git a/graphic/graphic_2d/native_drawing/drawing_rect.h b/graphic/graphic_2d/native_drawing/drawing_rect.h
index e07abff68df1f0ac2cd19ec03a9dacac6565144f..d753f5fa774853bd1f5f70bd04c0c079aa8f8076 100644
--- a/graphic/graphic_2d/native_drawing/drawing_rect.h
+++ b/graphic/graphic_2d/native_drawing/drawing_rect.h
@@ -214,6 +214,54 @@ void OH_Drawing_RectCopy(OH_Drawing_Rect* src, OH_Drawing_Rect* dst);
*/
void OH_Drawing_RectDestroy(OH_Drawing_Rect*);
+/**
+ * @brief Creates an OH_Drawing_Array object, which is used to store multiple OH_Drawing_Rect object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param size Indicates the size of the array object
+ * @return Returns the pointer to the OH_Drawing_Array object created.
+ * @since 13
+ * @version 1.0
+ * @note OH_Drawing_Array must be release by OH_Drawing_RectDestroyArray function.
+ * @note Return nullptr if size invalid.
+ */
+OH_Drawing_Array* OH_Drawing_RectCreateArray(size_t size);
+
+/**
+ * @brief Return the size of an OH_Drawing_Array object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Array Indicates the array object
+ * @return The size of the array object
+ * @since 13
+ * @version 1.0
+ * @note Return zero if OH_Drawing_Array invalid.
+ */
+size_t OH_Drawing_RectGetArraySize(OH_Drawing_Array*);
+
+/**
+ * @brief return the specified OH_Drawing_Rect object from OH_Drawing_Array object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param rectArr Indicates the array object
+ * @param index Indicates the index of array, caller must make sure the index is valid.
+ * @return Returns the pointer to the OH_Drawing_Rect object.
+ * @since 13
+ * @version 1.0
+ * @note Return nullptr if OH_Drawing_Array or index invalid.
+ */
+OH_Drawing_Rect* OH_Drawing_RectGetArrayElement(OH_Drawing_Array* rectArr, size_t index);
+
+/**
+ * @brief Destroys an array OH_Drawing_Rect object and reclaims the memory occupied by the object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Array Indicates the pointer to an OH_Drawing_Array object.
+ * @since 13
+ * @version 1.0
+ */
+void OH_Drawing_RectDestroyArray(OH_Drawing_Array*);
+
#ifdef __cplusplus
}
#endif
diff --git a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h
index 9a324c807a683863d649a9e7bc6ec5139a59f919..3d49007d8eeeadf961d7c5783b59874a57ec95e9 100644
--- a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h
+++ b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h
@@ -60,6 +60,14 @@ typedef struct OH_Drawing_FontCollection OH_Drawing_FontCollection;
*/
typedef struct OH_Drawing_Typography OH_Drawing_Typography;
+/**
+ * @brief Defines an OH_Drawing_LineTypography, which is used to perform line layout.
+ *
+ * @since 13
+ * @version 1.0
+ */
+typedef struct OH_Drawing_LineTypography OH_Drawing_LineTypography;
+
/**
* @brief Defines an OH_Drawing_TextStyle, which is used to manage text colors and decorations.
*
@@ -125,6 +133,30 @@ 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 13
+ * @version 1.0
+ */
+typedef struct OH_Drawing_TextTab OH_Drawing_TextTab;
+
+/**
+ * @brief Defines an OH_Drawing_TextLine, which is used to manage text line.
+ *
+ * @since 13
+ * @version 1.0
+ */
+typedef struct OH_Drawing_TextLine OH_Drawing_TextLine;
+
+/**
+ * @brief Defines an OH_Drawing_Run, which is used to manage run.
+ *
+ * @since 13
+ * @version 1.0
+ */
+typedef struct OH_Drawing_Run OH_Drawing_Run;
+
#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..ac5d965f67466e9f89ca24c4fa73c3f1aa3de4e9 100644
--- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h
+++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h
@@ -412,6 +412,19 @@ typedef struct OH_Drawing_FontConfigInfo {
OH_Drawing_FontFallbackGroup* fallbackGroupSet;
} OH_Drawing_FontConfigInfo;
+/**
+ * @brief Type style flag.
+ *
+ * @since 13
+ * @version 1.0
+ */
+typedef enum {
+ /** Italic font */
+ ITALIC = 1 << 0,
+ /** Bold font */
+ BOLD = 1 << 1,
+} OH_Drawing_FontTypeStyle;
+
/**
* @brief Describes the font information.
*
@@ -420,27 +433,48 @@ typedef struct OH_Drawing_FontConfigInfo {
*/
typedef struct OH_Drawing_FontDescriptor {
/** The file path of System font */
- char* path;
+ char* path = NULL;
/** A name that uniquely identifies the font */
- char* postScriptName;
+ char* postScriptName = NULL;
/** The name of System font */
- char* fullName;
+ char* fullName = NULL;
/** The family of System font */
- char* fontFamily;
+ char* fontFamily = NULL;
/** The subfont family of the system font */
- char* fontSubfamily;
+ char* fontSubfamily = NULL;
/** The weight of System font */
- int weight;
+ int weight = 0;
/** The width of System font */
- int width;
+ int width = 0;
/** Whether the system font is tilted */
- int italic;
+ int italic = 0;
/** Whether the system font is compact */
- bool monoSpace;
+ bool monoSpace = false;
/** whether symbolic fonts are supported */
- bool symbolic;
+ bool symbolic = false;
+ /** Font size */
+ size_t size = 0;
+ /** Font style flag, from OH_Drawing_FontTypeStyle */
+ int typeStyle = 0;
} OH_Drawing_FontDescriptor;
+/**
+ * @brief An enumeration of system font types.
+ *
+ * @since 13
+ * @version 1.0
+ */
+typedef enum {
+ /** All font types */
+ ALL = 1 << 0,
+ /** System generic font type */
+ GENERIC = 1 << 1,
+ /** Stylish font type */
+ STYLISH = 1 << 2,
+ /** Installed font types */
+ INSTALLED = 1 << 3,
+} OH_Drawing_SystemFontType;
+
/**
* @brief The metrics of line.
*
@@ -1460,6 +1494,31 @@ OH_Drawing_FontDescriptor* OH_Drawing_CreateFontDescriptor(void);
*/
void OH_Drawing_DestroyFontDescriptor(OH_Drawing_FontDescriptor*);
+/**
+ * @brief Obtain all system font descriptive symbols that match the specified font descriptor. Where the 'path' and
+ * 'size' fields are not considered as valid matching values. If all the fields of the parameters
+ * OH_Drawing_FontDescriptor are default, obtain all system font descriptors. If the match fails, return nullptr.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontDescriptor The pointer to the OH_Drawing_FontDescriptor object.
+ * @param size_t Indicates the count of obtained OH_Drawing_FontDescriptor.
+ * @return Returns an array of OH_Drawing_FontDescriptor.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_FontDescriptor* OH_Drawing_MatchFontDescriptors(OH_Drawing_FontDescriptor*, size_t*);
+
+/**
+ * @brief Releases the OH_Drawing_FontDescriptor array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontDescriptor Pointer to OH_Drawing_FontDescriptor array.
+ * @param size_t Represents the number of members of the OH_Drawing_FontDescriptor array.
+ * @since 13
+ * @version 1.0
+ */
+void OH_Drawing_DestroyFontDescriptors(OH_Drawing_FontDescriptor*, size_t);
+
/**
* @brief Creates an OH_Drawing_FontParser object.
*
@@ -1480,6 +1539,50 @@ OH_Drawing_FontParser* OH_Drawing_CreateFontParser(void);
*/
void OH_Drawing_DestroyFontParser(OH_Drawing_FontParser*);
+/**
+ * @brief Get font details according to the full name of the font.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param char* Indicates the full name of the font.
+ * @return Indicates the pointer to a font descriptor object OH_Drawing_FontDescriptor.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_FontDescriptor* OH_Drawing_GetFontDescriptorByName(const char* fullName);
+
+/**
+ * @brief Obtain the corresponding font list based on the font type.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_SystemFontType Indicates enumerates of system font type.
+ * @return Returns an array of full name.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_Array* OH_Drawing_GetSystemFontListByType(OH_Drawing_SystemFontType fontType);
+
+/**
+ * @brief Gets the full name indices by index.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Array Indicates an array of full name.
+ * @param size_t The index of full name.
+ * @return Returns a full name of the font.
+ * @since 13
+ * @version 1.0
+ */
+char* OH_Drawing_GetSystemFontListElement(OH_Drawing_Array* fullNameList, size_t index);
+
+/**
+ * @brief Releases the memory occupied by a list of system font names.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Array Indicates an array of full name.
+ * @since 13
+ * @version 1.0
+ */
+void OH_Drawing_DestroySystemFontListByType(OH_Drawing_Array* fullNameList);
+
/**
* @brief Gets a list of system font names.
*
@@ -2753,6 +2856,529 @@ 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 if text tab.
+ * @return Returns the pointer to the OH_Drawing_TextTab object created.
+ * @since 13
+ * @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 13
+ * @version 1.0
+ */
+void OH_Drawing_DestroyTextTab(OH_Drawing_TextTab*);
+
+/**
+ * @brief Get align 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 13
+ * @version 1.0
+ */
+OH_Drawing_TextAlign OH_Drawing_GetTextTabAlign(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 13
+ * @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.
+ *
+ * @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 13
+ * @version 1.0
+ */
+void OH_Drawing_SetTypographyTextTab(OH_Drawing_TypographyStyle*, OH_Drawing_TextTab* TextTab);
+
+/**
+ * @brief Creates an OH_Drawing_LineTypography object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object.
+ * @return Returns the pointer to the OH_Drawing_LineTypography object created.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_LineTypography* OH_Drawing_CreateLineTypography(OH_Drawing_TypographyCreate* handler);
+
+/**
+ * @brief Releases the memory occupied by an OH_Drawing_LineTypography object.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_LineTypography Indicates the pointer to an OH_Drawing_LineTypography object.
+ * @since 13
+ * @version 1.0
+ */
+void OH_Drawing_DestroyLineTypography(OH_Drawing_LineTypography* lineTypography);
+
+/**
+ * @brief Calculate the line breakpoint based on the width provided.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object.
+ * @param startIndex Indicates the starting point for the line-break calculations.
+ * @param width Indicates the requested line-break width.
+ * @return Returns the count of the characters from startIndex that would cause the line break.
+ * @since 13
+ * @version 1.0
+ */
+size_t OH_Drawing_LineTypographyGetLineBreak(OH_Drawing_LineTypography* lineTypography,
+ size_t startIndex, double width);
+
+/**
+ * @brief Creates a text line object based on the text range provided.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_LineTypography Indicates the pointer to an OH_Drawing_TypographyCreate object.
+ * @param startIndex Indicates the starting index of the text range.
+ * @param count Indicates the characters count of the text range. If the value is set to 0, return nullptr.
+ * @return Returns the pointer to the OH_Drawing_TextLine object created.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_TextLine* OH_Drawing_LineTypographyCreateLine(OH_Drawing_LineTypography* lineTypography,
+ size_t startIndex, size_t count);
+
+/**
+ * @brief Gets the run glyph indices.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Run Indicates the pointer to an OH_Drawing_Run object.
+ * @param start The run of start index.
+ * @param end The run of end index.
+ * @return Run of glyph indices array.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_Array* OH_Drawing_GetRunStringIndices(OH_Drawing_Run* run, uint32_t start, uint32_t end);
+
+/**
+ * @brief Gets the run glyph indices by index.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Array the run glyph indices array.
+ * @param index The run of glyph index.
+ * @return Run of glyph indices element.
+ * @since 13
+ * @version 1.0
+ */
+uint32_t OH_Drawing_GetRunStringIndicesElement(OH_Drawing_Array* stringIndices, size_t index);
+
+/**
+ * @brief Releases the memory run glyph indices array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param stringIndices glyph indices the pointer.
+ * @since 13
+ * @version 1.0
+ */
+void OH_Drawing_DestroyRunStringIndices(OH_Drawing_Array* stringIndices);
+
+/**
+ * @brief Gets the range run glyph location and length.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_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 13
+ * @version 1.0
+ */
+void OH_Drawing_GetRunStringRange(OH_Drawing_Run* run, uint32_t* location, uint32_t* length);
+
+/**
+ * @brief Gets the run typographic bound.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_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 13
+ * @version 1.0
+ */
+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 OH_Drawing_Canvas Indicates the pointer to an OH_Drawing_Canvas object.
+ * @param OH_Drawing_Run Indicates the pointer to an OH_Drawing_Run object.
+ * @param x Indicates the x coordinate.
+ * @param y Indicates the y coordinate.
+ * @since 13
+ * @version 1.0
+ */
+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 OH_Drawing_Run Indicates the pointer to an OH_Drawing_Run object.
+ * @return OH_Drawing_Rect The run image bounds.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_Rect* OH_Drawing_GetRunImageBounds(OH_Drawing_Run* run);
+
+ /**
+ * @brief Releases the memory run image bounds pointer.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Rect Run image bounds pointer.
+ * @since 13
+ * @version 1.0
+ */
+void OH_Drawing_DestroyRunImageBounds(OH_Drawing_Rect* rect);
+
+/**
+ * @brief Gets the range glyph identifier for each character.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Run Indicates the pointer to an OH_Drawing_Run object.
+ * @param start The run of start index.
+ * @param end The run of end index.
+ * @return Run of glyph array.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_Array* OH_Drawing_GetRunGlyphs(OH_Drawing_Run* run, uint32_t start, uint32_t end);
+
+/**
+ * @brief Gets the glyph identifier by index.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param glyphs The run of glyph array.
+ * @param index The run of glyph index.
+ * @return Run of glyph element.
+ * @since 13
+ * @version 1.0
+ */
+uint16_t OH_Drawing_GetRunGlyphsElement(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.
+ * @since 13
+ * @version 1.0
+ */
+void OH_Drawing_DestroyRunGlyphs(OH_Drawing_Array* glyphs);
+
+/**
+ * @brief Gets the range glyph position array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Run Indicates the pointer to an OH_Drawing_Run object.
+ * @param start The run of start index.
+ * @param end The run of end index.
+ * @return Run of position array.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_Array* OH_Drawing_GetRunPositions(OH_Drawing_Run* run, uint32_t start, uint32_t end);
+
+/**
+ * @brief Gets the glyph position by index.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Array The run of position array.
+ * @param index The run of glyph index.
+ * @return Run of glyph position pointer.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_Point* OH_Drawing_GetRunPositionsElement(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.
+ * @since 13
+ * @version 1.0
+ */
+void OH_Drawing_DestroyRunPositions(OH_Drawing_Array* positions);
+
+/**
+ * @brief Gets the number of glyph.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Run Indicates the pointer to an OH_Drawing_Run object.
+ * @return The number of glyph.
+ * @since 13
+ * @version 1.0
+ */
+uint32_t OH_Drawing_GetRunGlyphCount(OH_Drawing_Run* run);
+
+/**
+ * @brief Get DrawingArray size.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param drawingArray Indicates the pointer to the array object OH_Drawing_Array.
+ * @return Size of array.
+ * @since 13
+ * @version 1.0
+ */
+size_t OH_Drawing_GetDrawingArraySize(OH_Drawing_Array* drawingArray);
+
+/**
+ * @brief Get text line information.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Indicates the pointer to a typography object OH_Drawing_Typography.
+ * @return Indicates the pointer to a text line array object OH_Drawing_Array.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_Array* OH_Drawing_TypographyGetTextLines(OH_Drawing_Typography* typography);
+
+/**
+ * @brief Releases the memory occupied by the text line array object OH_Drawing_Array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param lines Indicates the pointer to the text line array object OH_Drawing_Array.
+ * @since 13
+ * @version 1.0
+ */
+void OH_Drawing_DestroyTextLines(OH_Drawing_Array* lines);
+
+/**
+ * @brief Releases the memory occupied by the text line object OH_Drawing_TextLine.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Indicates the pointer to the text line object OH_Drawing_TextLine.
+ * @since 13
+ * @version 1.0
+ */
+void OH_Drawing_DestroyTextLine(OH_Drawing_TextLine* line);
+
+/**
+ * @brief Get the text line object by index.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param lines Indicates the pointer to the text line array object OH_Drawing_Array.
+ * @param index text line object index.
+ * @return Indicates the pointer to a text line object OH_Drawing_TextLine.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_TextLine* OH_Drawing_GetTextLinesIndex(OH_Drawing_Array* lines, size_t index);
+
+/**
+ * @brief Get the count of glyphs.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Indicates the pointer to an OH_Drawing_TextLine object.
+ * @return Returns the count of glyphs.
+ * @since 13
+ * @version 1.0
+ */
+double OH_Drawing_TextLineGetGlyphCount(OH_Drawing_TextLine* line);
+
+/**
+ * @brief Get the range of text line.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Indicates the pointer to an OH_Drawing_TextLine object.
+ * @param start Indicates the pointer to text line start position.
+ * @param end Indicates the pointer to text line end position.
+ * @since 13
+ * @version 1.0
+ */
+void OH_Drawing_TextLineGetTextRange(OH_Drawing_TextLine* line, size_t* start, size_t* end);
+
+/**
+ * @brief Get the glyph runs array of text line.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Indicates the pointer to an OH_Drawing_TextLine object.
+ * @return Indicates the pointer to a glyph runs array object of text line OH_Drawing_Array.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_Array* OH_Drawing_TextLineGetGlyphRuns(OH_Drawing_TextLine* line);
+
+/**
+ * @brief Releases the memory occupied by the run array object OH_Drawing_Array.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param runs Indicates the pointer to the run array object OH_Drawing_Array.
+ * @since 13
+ * @version 1.0
+ */
+void OH_Drawing_DestroyRuns(OH_Drawing_Array* runs);
+
+/**
+ * @brief Get the run object by index.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param runs Indicates the pointer to the run array object OH_Drawing_Array.
+ * @param index run object index.
+ * @return Indicates the pointer to a run object OH_Drawing_Run.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_Run* OH_Drawing_GetRunsIndex(OH_Drawing_Array* runs, size_t index);
+
+/**
+ * @brief Paint the range of text line.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Indicates the pointer to an OH_Drawing_TextLine object.
+ * @param canvas Draw the text line on the canvas.
+ * @param x Represents the X-axis position on the canvas.
+ * @param y Represents the Y-axis position on the canvas.
+ * @return Returns the pointer to the OH_Drawing_TextLine object created.
+ * @since 13
+ * @version 1.0
+ */
+void OH_Drawing_TextLinePaint(OH_Drawing_TextLine* line, OH_Drawing_Canvas* canvas, double x, double y);
+
+/**
+ * @brief Creates a text line object that is aligned at both ends.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Indicates the pointer to an OH_Drawing_TextLine object.
+ * @param justifiedFactor The coefficients that align the two ends.
+ * @param justifiedWidth The width of the two ends aligned.
+ * @return Returns the pointer to the OH_Drawing_TextLine object created.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_TextLine* OH_Drawing_TextLineCreateJustifiedLine(OH_Drawing_TextLine* line, double justifiedFactor,
+ double justifiedWidth);
+
+/**
+ * @brief Gets the text line typographic bounds.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Indicates the pointer to an OH_Drawing_TextLine object.
+ * @param ascent Indicates the distance that the pointer points to remain above the baseline.
+ * @param descent Indicates the pointer to the distance that remains below the baseline.
+ * @param leading Indicates the pointer to the line Spacing.
+ * @return Returns The total width of the typesetting border.
+ * @since 13
+ * @version 1.0
+ */
+double OH_Drawing_TextLineGetTypographicBounds(OH_Drawing_TextLine* line, double* ascent, double* descent,
+ double* leading);
+
+/**
+ * @brief Gets the text line image bounds.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Indicates the pointer to an OH_Drawing_TextLine object.
+ * @return Returns the pointer to the OH_Drawing_Rect struct created.
+ * @since 13
+ * @version 1.0
+ */
+OH_Drawing_Rect* OH_Drawing_TextLineGetImageBounds(OH_Drawing_TextLine* line);
+
+/**
+ * @brief Gets the tail space width.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Indicates the pointer to an OH_Drawing_TextLine object.
+ * @return Returns the tail space width.
+ * @since 13
+ * @version 1.0
+ */
+double OH_Drawing_TextLineGetTrailingSpaceWidth(OH_Drawing_TextLine* line);
+
+/**
+ * @brief Gets the index of the given character position.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Indicates the pointer to an OH_Drawing_TextLine object.
+ * @param point The given character position.
+ * @return Returns the character offset for a given index.
+ * @since 13
+ * @version 1.0
+ */
+int32_t OH_Drawing_TextLineGetIndexForCharacterPosition(OH_Drawing_TextLine* line, OH_Drawing_Point* point);
+
+/**
+ * @brief Gets the offset of the given character index.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Indicates the pointer to an OH_Drawing_TextLine object.
+ * @param index The given character index.
+ * @return Returns the character offset for a given index.
+ * @since 13
+ * @version 1.0
+ */
+double OH_Drawing_TextLineGetOffsetForCharacterIndex(OH_Drawing_TextLine* line, int32_t index);
+
+/**
+ * @brief User-defined callback functions for using offsets and indexes.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param offset Character offset is traversed as an argument to the callback function.
+ * @param index Character index is traversed as an argument to the callback function.
+ * @param leadingEdge Whether the current offset is at the character front, as an argument to the callback function.
+ * @return The return value of the user-defined callback function.
+ * If false is returned, the traversal continues.
+ * If true is returned, the traversal stops.
+ * @since 13
+ * @version 1.0
+ */
+typedef bool (*CustomCallback)(double offset, int32_t index, bool leadingEdge);
+
+/**
+ * @brief traversal character offset and index in text lines.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Indicates the pointer to an OH_Drawing_TextLine object.
+ * @param callback User-defined callback functions, see CustomCallback.
+ * @since 13
+ * @version 1.0
+ */
+void OH_Drawing_TextLineTraversalCharacterOffsetAndIndex(OH_Drawing_TextLine* line, CustomCallback callback);
+
+/**
+ * @brief Gets the text offset based on the given alignment factor and alignment width.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param line Indicates the pointer to an OH_Drawing_TextLine object.
+ * @param alignmentFactor The coefficients that text needs to be aligned.
+ * Less than or equal to 0 is left justified, 0.5 is center justified,
+ * and greater than or equal to 1 is right justified.
+ * @param alignmentWidth The width of the text to be aligned.
+ * Returns 0 if it is less than the actual width of the text.
+ * @return Returns the offset of the aligned text.
+ * @since 13
+ * @version 1.0
+ */
+double OH_Drawing_TextLineGetAlignmentOffset(OH_Drawing_TextLine* line, double alignmentFactor, double alignmentWidth);
+
#ifdef __cplusplus
}
#endif
diff --git a/graphic/graphic_2d/native_drawing/drawing_types.h b/graphic/graphic_2d/native_drawing/drawing_types.h
index 0755375b707e8dcb97e6da2a175ad4916fced01a..4dd3f2e6e25e445e8d0c31852ad8b9bd7436c272 100644
--- a/graphic/graphic_2d/native_drawing/drawing_types.h
+++ b/graphic/graphic_2d/native_drawing/drawing_types.h
@@ -167,6 +167,15 @@ typedef struct OH_Drawing_PathEffect OH_Drawing_PathEffect;
*/
typedef struct OH_Drawing_Rect OH_Drawing_Rect;
+/**
+ * @brief Defines an array object, which is used to store multiple NDK object.
+ *
+ * @since 13
+ * @version 1.0
+ */
+
+typedef struct OH_Drawing_Array OH_Drawing_Array;
+
/**
* @brief Defines a roundRect, which is used to describe the round rectangle.
*
diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
index e6b537d689180ed7bab0240807f39131bf57958a..79463e8b0df781e6225d2651c98cc85149cba973 100644
--- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
+++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
@@ -902,6 +902,14 @@
"first_introduced": "12",
"name": "OH_Drawing_DestroyFontDescriptor"
},
+ {
+ "first_introduced": "13",
+ "name": "OH_Drawing_MatchFontDescriptors"
+ },
+ {
+ "first_introduced": "13",
+ "name": "OH_Drawing_DestroyFontDescriptors"
+ },
{
"first_introduced": "12",
"name": "OH_Drawing_CreateFontParser"
@@ -910,6 +918,22 @@
"first_introduced": "12",
"name": "OH_Drawing_DestroyFontParser"
},
+ {
+ "first_introduced": "13",
+ "name": "OH_Drawing_GetFontDescriptorByName"
+ },
+ {
+ "first_introduced": "13",
+ "name": "OH_Drawing_GetSystemFontListByType"
+ },
+ {
+ "first_introduced": "13",
+ "name": "OH_Drawing_GetSystemFontListElement"
+ },
+ {
+ "first_introduced": "13",
+ "name": "OH_Drawing_DestroySystemFontListByType"
+ },
{
"first_introduced": "12",
"name": "OH_Drawing_FontParserGetSystemFontList"
@@ -1442,6 +1466,206 @@
"first_introduced": "12",
"name":"OH_Drawing_SetTextShadow"
},
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_FontGetTextPath"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_CreateTextTab"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_DestroyTextTab"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_GetTextTabAlign"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_GetTextTabLocation"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_SetTypographyTextTab"
+ },
+ {
+ "first_introduced": "13",
+ "name": "OH_Drawing_CreateLineTypography"
+ },
+ {
+ "first_introduced": "13",
+ "name": "OH_Drawing_DestroyLineTypography"
+ },
+ {
+ "first_introduced": "13",
+ "name": "OH_Drawing_LineTypographyGetLineBreak"
+ },
+ {
+ "first_introduced": "13",
+ "name": "OH_Drawing_LineTypographyCreateLine"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_GetRunStringIndices"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_GetRunStringIndicesElement"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_DestroyRunStringIndices"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_GetRunStringRange"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_GetRunTypographicBounds"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_RunPaint"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_GetRunImageBounds"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_DestroyRunImageBounds"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_GetRunGlyphs"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_GetRunGlyphsElement"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_DestroyRunGlyphs"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_GetRunPositions"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_GetRunPositionsElement"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_DestroyRunPositions"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_GetRunGlyphCount"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_GetDrawingArraySize"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_TypographyGetTextLines"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_DestroyTextLines"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_DestroyTextLine"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_GetTextLinesIndex"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_TextLineGetGlyphCount"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_TextLineGetTextRange"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_TextLineGetGlyphRuns"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_DestroyRuns"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_GetRunsIndex"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_TextLinePaint"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_TextLineCreateJustifiedLine"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_TextLineGetTypographicBounds"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_TextLineGetImageBounds"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_TextLineGetTrailingSpaceWidth"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_TextLineGetIndexForCharacterPosition"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_TextLineGetOffsetForCharacterIndex"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_TextLineTraversalCharacterOffsetAndIndex"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_TextLineGetAlignmentOffset"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_FontGetBounds"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_FontCreatePathForGlyph"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_RectCreateArray"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_RectGetArraySize"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_RectGetArrayElement"
+ },
+ {
+ "first_introduced": "13",
+ "name":"OH_Drawing_RectDestroyArray"
+ },
{
"first_introduced": "13",
"name":"OH_Drawing_Drawing_CanvasDrawRecordCmd"