From 56c5cba8caa9add6105ead9b87a74ae8a5af8523 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Tue, 12 Mar 2024 13:43:19 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A3=B0=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_drawing/drawing_text_declaration.h | 8 ++ .../native_drawing/drawing_text_typography.h | 121 ++++++++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 45 ++++++- 3 files changed, 173 insertions(+), 1 deletion(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h index 542012e2a..a6cc5784a 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h @@ -122,6 +122,14 @@ typedef struct OH_Drawing_FontParser OH_Drawing_FontParser; */ typedef struct OH_Drawing_TextShadow OH_Drawing_TextShadow; +/** + * @brief Defines an OH_Drawing_RectStyle, which is used to create an OH_Drawing_RectStyle object. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_RectStyle OH_Drawing_RectStyle; + #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 6899fed88..7f308db98 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1684,6 +1684,127 @@ float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography*, int); */ void OH_Drawing_DestroyTextShadows(OH_Drawing_TextShadow*); +/** + * @brief Creates an OH_Drawing_RectStyle object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_RectStyle object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_RectStyle* OH_Drawing_CreateRectStyle(void); + +/** + * @brief Releases the memory occupied by an OH_Drawing_RectStyle object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_RectStyle Indicates the pointer to an OH_Drawing_RectStyle object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyRectStyle(OH_Drawing_RectStyle*); + +/** + * @brief Sets the background rect and styleId. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param OH_Drawing_RectStyle Indicates the pointer to an OH_Drawing_RectStyle object. + * @param int Indicates the styleId to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle*, OH_Drawing_RectStyle*, int); + +/** + * @brief Adds the symbol. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object. + * @param uint32_t Indicates the symbol to add. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TypographyHandlerAddSymbol(OH_Drawing_TypographyCreate*, uint32_t); + +/** + * @brief Sets Feature in FontFeatures. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param char Indicates the pointer to the tag to set. + * @param int Indicates the value to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleSetFeature(OH_Drawing_TextStyle*, const char*, int); + +/** + * @brief Gets value with key in fontfeatures. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param char Indicates the pointer to the key of fontfeature in map. + * @return Returns the value of the key in map. + * @since 12 + * @version 1.0 + */ +int OH_Drawing_TextStyleGetFeature(OH_Drawing_TextStyle*, const char*); + +/** + * @brief Gets all elements in fontfeatures map. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @return char Indicates the pointer to the string in Json of all elements in fontfeatures map. + * @since 12 + * @version 1.0 + */ +char* OH_Drawing_TextStyleGetFeatures(OH_Drawing_TextStyle*); + +/** + * @brief Gets size of FontFeatures map. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @return Returns the size of fontfeatures map. + * @since 12 + * @version 1.0 + */ +int OH_Drawing_TextStyleGetFeaturesSize(OH_Drawing_TextStyle*); + +/** + * @brief Clear elements in FontFeatures map. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleClearFeatures(OH_Drawing_TextStyle*); + +/** + * @brief Sets the baseline shift. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param double Indicates the baseline shift to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleSetBaseLineShift(OH_Drawing_TextStyle*, double); + +/** + * @brief Gets the baseline shift. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @return Returns the baseline shift. + * @since 12 + * @version 1.0 + */ +double OH_Drawing_TextStyleGetBaseLineShift(OH_Drawing_TextStyle*); + #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 e076cd829..145a75992 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -573,6 +573,49 @@ { "first_introduced": "12", "name": "OH_Drawing_SetTypographyTextFontHeight" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_CreateRectStyle" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_DestroyRectStyle" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleSetBackgroundRect" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyHandlerAddSymbol" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleSetFeature" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetFeature" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetFeatures" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetFeaturesSize" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleClearFeatures" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetBaseLineShift" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleSetBaseLineShift" } - ] \ No newline at end of file -- Gitee From 6bf442d4af61b25a905993962fdb6e75e909958a Mon Sep 17 00:00:00 2001 From: changleipeng Date: Wed, 13 Mar 2024 06:24:09 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_drawing/drawing_text_typography.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 7f308db98..537fa6b13 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1728,7 +1728,7 @@ void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle*, OH_Drawing_Rec void OH_Drawing_TypographyHandlerAddSymbol(OH_Drawing_TypographyCreate*, uint32_t); /** - * @brief Sets Feature in FontFeatures. + * @brief Sets features in fontfeatures of textstyle. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. @@ -1763,7 +1763,7 @@ int OH_Drawing_TextStyleGetFeature(OH_Drawing_TextStyle*, const char*); char* OH_Drawing_TextStyleGetFeatures(OH_Drawing_TextStyle*); /** - * @brief Gets size of FontFeatures map. + * @brief Gets size of fontfeatures map. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. @@ -1774,7 +1774,7 @@ char* OH_Drawing_TextStyleGetFeatures(OH_Drawing_TextStyle*); int OH_Drawing_TextStyleGetFeaturesSize(OH_Drawing_TextStyle*); /** - * @brief Clear elements in FontFeatures map. + * @brief Clear elements in fontfeatures map. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. @@ -1784,7 +1784,7 @@ int OH_Drawing_TextStyleGetFeaturesSize(OH_Drawing_TextStyle*); void OH_Drawing_TextStyleClearFeatures(OH_Drawing_TextStyle*); /** - * @brief Sets the baseline shift. + * @brief Sets the base line shift. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. @@ -1795,7 +1795,7 @@ void OH_Drawing_TextStyleClearFeatures(OH_Drawing_TextStyle*); void OH_Drawing_TextStyleSetBaseLineShift(OH_Drawing_TextStyle*, double); /** - * @brief Gets the baseline shift. + * @brief Gets the base line shift. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. -- Gitee