From 56c5cba8caa9add6105ead9b87a74ae8a5af8523 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Tue, 12 Mar 2024 13:43:19 +0000 Subject: [PATCH 01/11] =?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 542012e2af9..a6cc5784a69 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 6899fed8896..7f308db982c 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 e076cd829af..145a75992e8 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 02/11] =?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 7f308db982c..537fa6b1391 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 From ceab5f42031fb0aff381ce7c31989996274abbe2 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Wed, 13 Mar 2024 11:24:19 +0000 Subject: [PATCH 03/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=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 | 66 +++++++------------ .../graphic_2d/native_drawing/drawing_types.h | 19 ++++++ .../native_drawing/libnative_drawing.ndk.json | 9 +-- 4 files changed, 44 insertions(+), 58 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h index a6cc5784a69..542012e2af9 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h @@ -122,14 +122,6 @@ 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 537fa6b1391..e50ab571762 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1685,85 +1685,67 @@ 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. + * @brief Set struct of background rect and styleId of text. * * @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. + * @param OH_Drawing_RectStyle_Info Indicates the pointer to an OH_Drawing_RectStyle_Info object. + * @param styleId Indicates the styleId of text to set. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle*, OH_Drawing_RectStyle*, int); +void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle*, OH_Drawing_RectStyle_Info*, int styleId); /** - * @brief Adds the symbol. + * @brief Set symbols in creating typography. * * @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. + * @param symbol Indicates the symbol to set. * @since 12 * @version 1.0 */ -void OH_Drawing_TypographyHandlerAddSymbol(OH_Drawing_TypographyCreate*, uint32_t); +void OH_Drawing_TypographyHandlerAddSymbol(OH_Drawing_TypographyCreate*, uint32_t symbol); /** - * @brief Sets features in fontfeatures of textstyle. + * @brief Set features in fontfeatures of text. * * @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. + * @param tag Indicates the pointer to the tag to set. + * @param value Indicates the value to set. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleSetFeature(OH_Drawing_TextStyle*, const char*, int); +void OH_Drawing_TextStyleSetFeature(OH_Drawing_TextStyle*, const char* tag, int value); /** - * @brief Gets value with key in fontfeatures. + * @brief Get 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. + * @param tag 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*); +int OH_Drawing_TextStyleGetFeature(OH_Drawing_TextStyle*, const char* tag); /** - * @brief Gets all elements in fontfeatures map. + * @brief Get 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. + * @param char Indicates the pointer to an destination string. + * @param destinationStr Indicates the length of destination string. + * @return destinationSize 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*); +char* OH_Drawing_TextStyleGetFeatures(OH_Drawing_TextStyle*, char* destinationStr, size_t destinationSize); /** - * @brief Gets size of fontfeatures map. + * @brief Get size of fontfeatures map. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. @@ -1784,18 +1766,18 @@ int OH_Drawing_TextStyleGetFeaturesSize(OH_Drawing_TextStyle*); void OH_Drawing_TextStyleClearFeatures(OH_Drawing_TextStyle*); /** - * @brief Sets the base line shift. + * @brief Set baseline shift of text. * * @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. + * @param lineShift Indicates the baseline shift to set. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleSetBaseLineShift(OH_Drawing_TextStyle*, double); +void OH_Drawing_TextStyleSetBaseLineShift(OH_Drawing_TextStyle*, double lineShift); /** - * @brief Gets the base line shift. + * @brief Get baseline shift of text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. diff --git a/graphic/graphic_2d/native_drawing/drawing_types.h b/graphic/graphic_2d/native_drawing/drawing_types.h index 23e50f38dc3..5065acfca4e 100644 --- a/graphic/graphic_2d/native_drawing/drawing_types.h +++ b/graphic/graphic_2d/native_drawing/drawing_types.h @@ -384,6 +384,25 @@ typedef struct { OH_Drawing_AlphaFormat alphaType; } OH_Drawing_Image_Info; +/** + * @brief Defines rectstyle info struct. + * + * @since 12 + * @version 1.0 + */ +typedef struct { + /** color of rectstyle */ + uint32_t color; + /** radius in left top of rectstyle */ + double leftTopRadius; + /** radius in right top of rectstyle */ + double rightTopRadius; + /** radius in right bottom of rectstyle */ + double rightBottomRadius; + /** radius in left bottom of rectstyle */ + double leftBottomRadius; +} OH_Drawing_RectStyle_Info; + /** * @brief Enumerates text encoding types. * @since 12 diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 989fce41ded..467774e85cb 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -582,14 +582,6 @@ "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" @@ -631,4 +623,5 @@ "first_introduced": "12", "name": "OH_Drawing_CreateSharedFontCollection" } + ] \ No newline at end of file -- Gitee From 66f200f44126bc2c222a9c6a24cceab7ef45e663 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Sat, 16 Mar 2024 08:40:39 +0000 Subject: [PATCH 04/11] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81=E4=BF=AE=E6=94=B9?= 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 | 38 +++++++++++-------- .../native_drawing/libnative_drawing.ndk.json | 13 +++---- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index e50ab571762..3f60dff5c67 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1518,7 +1518,7 @@ void OH_Drawing_SetTypographyTextLineStyleFontStyle(OH_Drawing_TypographyStyle*, * @version 1.0 */ void OH_Drawing_SetTypographyTextLineStyleFontFamilies(OH_Drawing_TypographyStyle*, int, const char* fontFamilies[]); - + /** * @brief Sets the font size of line style for text typography. * @@ -1694,7 +1694,7 @@ void OH_Drawing_DestroyTextShadows(OH_Drawing_TextShadow*); * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle*, OH_Drawing_RectStyle_Info*, int styleId); +void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle*, const OH_Drawing_RectStyle_Info*, int styleId); /** * @brief Set symbols in creating typography. @@ -1708,7 +1708,7 @@ void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle*, OH_Drawing_Rec void OH_Drawing_TypographyHandlerAddSymbol(OH_Drawing_TypographyCreate*, uint32_t symbol); /** - * @brief Set features in fontfeatures of text. + * @brief Set features of font features. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. @@ -1717,10 +1717,10 @@ void OH_Drawing_TypographyHandlerAddSymbol(OH_Drawing_TypographyCreate*, uint32_ * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleSetFeature(OH_Drawing_TextStyle*, const char* tag, int value); +void OH_Drawing_TextStyleAddFontFeature(OH_Drawing_TextStyle*, const char* tag, int value); /** - * @brief Get value with key in fontfeatures. + * @brief Get value with key of font features. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. @@ -1729,23 +1729,31 @@ void OH_Drawing_TextStyleSetFeature(OH_Drawing_TextStyle*, const char* tag, int * @since 12 * @version 1.0 */ -int OH_Drawing_TextStyleGetFeature(OH_Drawing_TextStyle*, const char* tag); +int OH_Drawing_TextStyleGetFontFeature(OH_Drawing_TextStyle*, const char* tag); + +/** + * @brief Get all elements of font features. + * + * @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_TextStyleGetFontFeatures(OH_Drawing_TextStyle*); /** - * @brief Get all elements in fontfeatures map. + * @brief Releases the memory occupied by string of font features. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param char Indicates the pointer to an destination string. - * @param destinationStr Indicates the length of destination string. - * @return destinationSize 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*, char* destinationStr, size_t destinationSize); +void OH_Drawing_DestroyFontFeature(char* fontFeatureStr); /** - * @brief Get size of fontfeatures map. + * @brief Get size of font features. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. @@ -1753,17 +1761,17 @@ char* OH_Drawing_TextStyleGetFeatures(OH_Drawing_TextStyle*, char* destinationSt * @since 12 * @version 1.0 */ -int OH_Drawing_TextStyleGetFeaturesSize(OH_Drawing_TextStyle*); +int OH_Drawing_TextStyleGetFontFeatureSize(OH_Drawing_TextStyle*); /** - * @brief Clear elements in fontfeatures map. + * @brief Clear elements of font features. * * @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*); +void OH_Drawing_TextStyleClearFontFeature(OH_Drawing_TextStyle*); /** * @brief Set baseline shift of text. diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 467774e85cb..322af33d334 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -509,7 +509,7 @@ { "first_introduced": "12", "name": "OH_Drawing_TextStyleGetBackgroundPen" - }, + }, { "first_introduced": "12", "name": "OH_Drawing_DisableFontCollectionFallback" @@ -592,23 +592,23 @@ }, { "first_introduced": "12", - "name": "OH_Drawing_TextStyleSetFeature" + "name": "OH_Drawing_TextStyleAddFontFeature" }, { "first_introduced": "12", - "name": "OH_Drawing_TextStyleGetFeature" + "name": "OH_Drawing_TextStyleGetFontFeature" }, { "first_introduced": "12", - "name": "OH_Drawing_TextStyleGetFeatures" + "name": "OH_Drawing_TextStyleGetFontFeatures" }, { "first_introduced": "12", - "name": "OH_Drawing_TextStyleGetFeaturesSize" + "name": "OH_Drawing_TextStyleGetFontFeatureSize" }, { "first_introduced": "12", - "name": "OH_Drawing_TextStyleClearFeatures" + "name": "OH_Drawing_TextStyleClearFontFeature" }, { "first_introduced": "12", @@ -617,7 +617,6 @@ { "first_introduced": "12", "name": "OH_Drawing_TextStyleSetBaseLineShift" - }, { "first_introduced": "12", -- Gitee From 9ffe55a1482bcc163b70dc6a98bef09bb28fd98e Mon Sep 17 00:00:00 2001 From: changleipeng Date: Wed, 20 Mar 2024 03:53:57 +0000 Subject: [PATCH 05/11] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= 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 | 46 ++++++++++--------- .../native_drawing/libnative_drawing.ndk.json | 4 +- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 3f60dff5c67..fe2161bc031 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -353,6 +353,19 @@ typedef struct OH_Drawing_LineMetrics { OH_Drawing_Font_Metrics firstCharMetrics; } OH_Drawing_LineMetrics; +/** + * @brief Defines the fontfeature. + * + * @since 12 + * @version 1.0 + */ +typedef struct { + /** key of fontfeature */ + char* fontFeatureKey; + /** value of fontfeature */ + int fontFeatureValue; +} OH_Drawing_FontFeature; + /** * @brief Creates an OH_Drawing_TypographyStyle object. * @@ -1697,7 +1710,7 @@ void OH_Drawing_DestroyTextShadows(OH_Drawing_TextShadow*); void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle*, const OH_Drawing_RectStyle_Info*, int styleId); /** - * @brief Set symbols in creating typography. + * @brief Add symbols in creating typography. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object. @@ -1708,7 +1721,7 @@ void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle*, const OH_Drawi void OH_Drawing_TypographyHandlerAddSymbol(OH_Drawing_TypographyCreate*, uint32_t symbol); /** - * @brief Set features of font features. + * @brief Add font feature. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. @@ -1720,37 +1733,26 @@ void OH_Drawing_TypographyHandlerAddSymbol(OH_Drawing_TypographyCreate*, uint32_ void OH_Drawing_TextStyleAddFontFeature(OH_Drawing_TextStyle*, const char* tag, int value); /** - * @brief Get value with key of font features. - * - * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param tag 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_TextStyleGetFontFeature(OH_Drawing_TextStyle*, const char* tag); - -/** - * @brief Get all elements of font features. + * @brief Get all font features. * * @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. + * @return OH_Drawing_FontFeature Indicates the pointer to an array of structures of OH_Drawing_FontFeature. * @since 12 * @version 1.0 */ -char* OH_Drawing_TextStyleGetFontFeatures(OH_Drawing_TextStyle*); +OH_Drawing_FontFeature* OH_Drawing_TextStyleGetFontFeatures(OH_Drawing_TextStyle*); /** - * @brief Releases the memory occupied by string of font features. + * @brief Release the memory occupied by array of structures of font features. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param OH_Drawing_FontFeature Indicates the pointer to an array of structures of OH_Drawing_FontFeature. + * @param fontFeatureSize Indicates the size of array of structures of OH_Drawing_FontFeature. * @since 12 * @version 1.0 */ -void OH_Drawing_DestroyFontFeature(char* fontFeatureStr); +void OH_Drawing_TextStyleDestroyFontFeatures(OH_Drawing_FontFeature*, size_t fontFeatureSize); /** * @brief Get size of font features. @@ -1761,10 +1763,10 @@ void OH_Drawing_DestroyFontFeature(char* fontFeatureStr); * @since 12 * @version 1.0 */ -int OH_Drawing_TextStyleGetFontFeatureSize(OH_Drawing_TextStyle*); +size_t OH_Drawing_TextStyleGetFontFeatureSize(OH_Drawing_TextStyle*); /** - * @brief Clear elements of font features. + * @brief Clear font features. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 322af33d334..5ce6b51f9cd 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -596,11 +596,11 @@ }, { "first_introduced": "12", - "name": "OH_Drawing_TextStyleGetFontFeature" + "name": "OH_Drawing_TextStyleGetFontFeatures" }, { "first_introduced": "12", - "name": "OH_Drawing_TextStyleGetFontFeatures" + "name": "OH_Drawing_TextStyleDestroyFontFeatures" }, { "first_introduced": "12", -- Gitee From d08f524acbb6d4a7e610668646c4c6786f7015e3 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Fri, 22 Mar 2024 03:34:58 +0000 Subject: [PATCH 06/11] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E4=B8=8E=E8=8E=B7=E5=8F=96=E9=AB=98=E5=BA=A6=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E7=9A=84=E6=8E=A5=E5=8F=A3=E5=A3=B0=E6=98=8E(=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=B3=A8=E9=87=8A=EF=BC=89?= 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 | 40 +++++++++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 8 ++++ 2 files changed, 48 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index fe2161bc031..e3680b17708 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -366,6 +366,23 @@ typedef struct { int fontFeatureValue; } OH_Drawing_FontFeature; +/** + * @brief Enumerates of heightmode of text. + * + * @since 12 + * @version 1.0 + */ +enum OH_Drawing_TextHeightBehavior { + /** both ascend of first row and last row style */ + TEXT_HEIGHT_ALL = 0x0, + /** forbidding ascend of first row style*/ + TEXT_HEIGHT_DISABLE_FIRST_ASCENT = 0x1, + /** forbidding ascend of last row style */ + TEXT_HEIGHT_DISABLE_LAST_ASCENT = 0x2, + /** neither ascend of first row nor last row style */ + TEXT_HEIGHT_DISABLE_ALL = 0x1 | 0x2, +}; + /** * @brief Creates an OH_Drawing_TypographyStyle object. * @@ -1738,6 +1755,7 @@ void OH_Drawing_TextStyleAddFontFeature(OH_Drawing_TextStyle*, const char* tag, * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. * @return OH_Drawing_FontFeature Indicates the pointer to an array of structures of OH_Drawing_FontFeature. + * Get size of font feature by OH_Drawing_TextStyleGetFontFeatureSize. * @since 12 * @version 1.0 */ @@ -1797,6 +1815,28 @@ void OH_Drawing_TextStyleSetBaseLineShift(OH_Drawing_TextStyle*, double lineShif */ double OH_Drawing_TextStyleGetBaseLineShift(OH_Drawing_TextStyle*); +/** + * @brief Set mode of applying the leading over and under text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param heightMode Indicates the mode to set. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TypographyTextSetHeightMode(OH_Drawing_TypographyStyle*, OH_Drawing_TextHeightBehavior heightMode); + +/** + * @brief Get mode of applying the leading over and under text. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @return Returns the mode. + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextHeightBehavior OH_Drawing_TypographyTextGetHeightMode(OH_Drawing_TypographyStyle*); + #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 5ce6b51f9cd..df1867f112b 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -621,6 +621,14 @@ { "first_introduced": "12", "name": "OH_Drawing_CreateSharedFontCollection" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyTextSetHeightMode" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyTextGetHeightMode" } ] \ No newline at end of file -- Gitee From 963c8ecd2515396f5d34c953413aadeaa205e134 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Tue, 26 Mar 2024 06:18:48 +0000 Subject: [PATCH 07/11] update graphic/graphic_2d/native_drawing/drawing_text_typography.h. Signed-off-by: changleipeng --- .../native_drawing/drawing_text_typography.h | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 6ab1364348f..4770a3657dd 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1816,26 +1816,6 @@ void OH_Drawing_TextStyleSetBaseLineShift(OH_Drawing_TextStyle*, double lineShif double OH_Drawing_TextStyleGetBaseLineShift(OH_Drawing_TextStyle*); /** - * @brief Set mode of applying the leading over and under text. - * - * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. - * @param heightMode Indicates the mode to set. - * @since 12 - * @version 1.0 - */ -void OH_Drawing_TypographyTextSetHeightBehavior(OH_Drawing_TypographyStyle*, OH_Drawing_TextHeightBehavior heightMode); - -/** - * @brief Get mode of applying the leading over and under text. - * - * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. - * @return Returns the mode. - * @since 12 - * @version 1.0 - */ -OH_Drawing_TextHeightBehavior OH_Drawing_TypographyTextGetHeightBehavior(OH_Drawing_TypographyStyle*); * @brief Gets the text color. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -- Gitee From ec31c530a56812cf3d725ff360353269b81f7f96 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Tue, 26 Mar 2024 06:21:32 +0000 Subject: [PATCH 08/11] update graphic/graphic_2d/native_drawing/drawing_text_typography.h. Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_text_typography.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 4770a3657dd..8f5d3a8bdd2 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -361,9 +361,9 @@ typedef struct OH_Drawing_LineMetrics { */ typedef struct { /** key of fontfeature */ - char* fontFeatureKey; + char* tag; /** value of fontfeature */ - int fontFeatureValue; + int value; } OH_Drawing_FontFeature; /** -- Gitee From 33a7a15b7f668086a21f67c9e4b1e63e3df8393e Mon Sep 17 00:00:00 2001 From: changleipeng Date: Tue, 26 Mar 2024 06:26:15 +0000 Subject: [PATCH 09/11] update graphic/graphic_2d/native_drawing/drawing_text_typography.h. Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_text_typography.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 8f5d3a8bdd2..b62fae84fe5 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1802,7 +1802,7 @@ void OH_Drawing_TextStyleClearFontFeature(OH_Drawing_TextStyle*); * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleSetBaseLineShift(OH_Drawing_TextStyle*, double lineShift); +void OH_Drawing_TextStyleSetBaselineShift(OH_Drawing_TextStyle*, double lineShift); /** * @brief Get baseline shift of text. @@ -1813,7 +1813,7 @@ void OH_Drawing_TextStyleSetBaseLineShift(OH_Drawing_TextStyle*, double lineShif * @since 12 * @version 1.0 */ -double OH_Drawing_TextStyleGetBaseLineShift(OH_Drawing_TextStyle*); +double OH_Drawing_TextStyleGetBaselineShift(OH_Drawing_TextStyle*); /** * @brief Gets the text color. -- Gitee From cdafc963ec593c85df69c78ab06623ecf2b6ef62 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Tue, 26 Mar 2024 06:27:23 +0000 Subject: [PATCH 10/11] update graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json. Signed-off-by: changleipeng --- .../native_drawing/libnative_drawing.ndk.json | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index b24a22d6bf4..b0ed71fce71 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -836,24 +836,16 @@ }, { "first_introduced": "12", - "name": "OH_Drawing_TextStyleGetBaseLineShift" + "name": "OH_Drawing_TextStyleGetBaselineShift" }, { "first_introduced": "12", - "name": "OH_Drawing_TextStyleSetBaseLineShift" + "name": "OH_Drawing_TextStyleSetBaselineShift" }, { "first_introduced": "12", "name": "OH_Drawing_CreateSharedFontCollection" }, - { - "first_introduced": "12", - "name": "OH_Drawing_TypographyTextSetHeightBehavior" - }, - { - "first_introduced": "12", - "name": "OH_Drawing_TypographyTextGetHeightBehavior" - }, { "first_introduced": "12", "name": "OH_Drawing_TextStyleGetColor" -- Gitee From 3c82b7833ebb838bab988de85c3db150af0fa335 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Wed, 27 Mar 2024 03:47:10 +0000 Subject: [PATCH 11/11] update graphic/graphic_2d/native_drawing/drawing_text_typography.h. Signed-off-by: changleipeng --- .../native_drawing/drawing_text_typography.h | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index b62fae84fe5..90c0ebb964a 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -366,23 +366,6 @@ typedef struct { int value; } OH_Drawing_FontFeature; -/** - * @brief Enumerates of heightmode of text. - * - * @since 12 - * @version 1.0 - */ -enum OH_Drawing_TextHeightBehavior { - /** both ascend of first row and last row style */ - TEXT_HEIGHT_ALL = 0x0, - /** forbidding ascend of first row style*/ - TEXT_HEIGHT_DISABLE_FIRST_ASCENT = 0x1, - /** forbidding ascend of last row style */ - TEXT_HEIGHT_DISABLE_LAST_ASCENT = 0x2, - /** neither ascend of first row nor last row style */ - TEXT_HEIGHT_DISABLE_ALL = 0x1 | 0x2, -}; - /** * @brief Creates an OH_Drawing_TypographyStyle object. * -- Gitee