From dcef4dbaaa7fc0b79e57c416efe615ed0be73b4e Mon Sep 17 00:00:00 2001 From: guoxing Date: Wed, 6 Dec 2023 09:44:12 +0000 Subject: [PATCH 1/6] encode Signed-off-by: guoxing --- .../native_drawing/drawing_text_typography.h | 269 ++++++++++++++++++ 1 file changed, 269 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 1576b967a..ce4de9f1d 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -44,6 +44,7 @@ #include "drawing_types.h" #include "stdint.h" +#include #ifdef __cplusplus extern "C" { @@ -148,6 +149,94 @@ enum OH_Drawing_FontStyle { FONT_STYLE_ITALIC, }; +/** + * @brief Enumerates text decoration style. + */ +enum OH_Drawing_TextDecorationStyle { + TEXT_DECORATION_STYLE_SOLID, + TEXT_DECORATION_STYLE_DOUBLE, + TEXT_DECORATION_STYLE_DOTTED, + TEXT_DECORATION_STYLE_DASHED, + TEXT_DECORATION_STYLE_WAVY, +}; + +/** + * @brief Enumerates ellipsis modal. + */ +enum OH_Drawing_EllipsisModal { + ELLIPSIS_MODAL_HEAD = 0, + ELLIPSIS_MODAL_MIDDLE = 1, + ELLIPSIS_MODAL_TAIL = 2, +}; + +/** + * @brief Enumerates break strategy. + */ +enum OH_Drawing_BreakStrategy { + BREAK_STRATEGY_GREEDY = 0, + BREAK_STRATEGY_HIGH_QUALITY = 1, + BREAK_STRATEGY_BALANCED = 2, +}; + +/** + * @brief Enumerates word break type. + */ +enum OH_Drawing_WordBreakType { + WORD_BREAK_TYPE_NORMAL = 0, + WORD_BREAK_TYPE_BREAK_ALL = 1, + WORD_BREAK_TYPE_BREAK_WORD = 2, +}; + +/** + * @brief Enumerates rect height style. + */ +enum OH_Drawing_RectHeightStyle { + RECT_HEIGHT_STYLE_TIGHT, + RECT_HEIGHT_STYLE_MAX, + RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE, + RECT_HEIGHT_STYLE_INCLUDELINESPACETOP, + RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM, + RECT_HEIGHT_STYLE_STRUCT, +}; + +/** + * @brief Enumerates rect Width style. + */ +enum OH_Drawing_RectWidthStyle { + RECT_WIDTH_STYLE_TIGHT, + RECT_WIDTH_STYLE_MAX, +}; + +typedef struct { + float left_; + float right_; + float top_; + float bottom_; +} OH_Drawing_Rect; + +typedef struct { + OH_Drawing_Rect rect_; + OH_Drawing_TextDirection direction_; +} OH_Drawing_TextBox; + +/** + * @brief Enumerates affinity. + */ +enum OH_Drawing_Affinity { + AFFINITY_UPSTREAM, + AFFINITY_DOWNSTREAM, +}; + +typedef struct { + size_t pos_; + OH_Drawing_Affinity affinity_; +} OH_Drawing_PositionAndAffinity; + +typedef struct { + size_t start_; + size_t end_; +} OH_Drawing_Range; + /** * @brief Creates an OH_Drawing_TypographyStyle object. * @@ -511,6 +600,186 @@ double OH_Drawing_TypographyGetAlphabeticBaseline(OH_Drawing_Typography*); */ double OH_Drawing_TypographyGetIdeographicBaseline(OH_Drawing_Typography*); +/** + * @brief Gets the exceed maxLines. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @return Returns the exceed maxLines. + * @since 11 + * @version 1.0 + */ +bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography*); + +/** + * @brief Gets the rects for range. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @return Returns the rects for range. + * @since 11 + * @version 1.0 + */ +OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography*, + size_t, size_t, OH_Drawing_RectHeightStyle, OH_Drawing_RectWidthStyle); + +/** + * @brief Gets the rects for placeholders. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @return Returns the rects for placeholders. + * @since 11 + * @version 1.0 + */ +OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders(OH_Drawing_Typography*); + +/** + * @brief Gets the glyphposition at coordinate. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @return Returns the glyphposition at coordinate. + * @since 11 + * @version 1.0 + */ +OH_Drawing_PositionAndAffinity OH_Drawing_TypographyGetGlyphPositionAtCoordinate(OH_Drawing_Typography*, + double, double); + +/** + * @brief Gets the glyphposition at coordinate with cluster. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @return Returns the glyphposition at coordinate with cluster. + * @since 11 + * @version 1.0 + */ +OH_Drawing_PositionAndAffinity OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster(OH_Drawing_Typography*, + double, double); + +/** + * @brief Gets the word boundary. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @return Returns the word boundary. + * @since 11 + * @version 1.0 + */ +OH_Drawing_Range OH_Drawing_TypographyGetWordBoundary(OH_Drawing_Typography*, size_t); + +/** + * @brief Gets the line count. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @return Returns the line count. + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_TypographyGetLineCount(OH_Drawing_Typography*); + +/** + * @brief Sets the decoration style. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleDecorationStyle(OH_Drawing_TextStyle*, int); + +/** + * @brief Sets the decoration thickness scale. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleDecorationThicknessScale(OH_Drawing_TextStyle*, double); + +/** + * @brief Sets the letter spacing. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleLetterSpacing(OH_Drawing_TextStyle*, double); + +/** + * @brief Sets the word spacing. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleWordSpacing(OH_Drawing_TextStyle*, double); + +/** + * @brief Sets the half leading. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleHalfLeading(OH_Drawing_TextStyle*, bool); + +/** + * @brief Sets the ellipsis. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle*, std::u16string); + +/** + * @brief Sets the ellipsis modal. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleEllipsisModal(OH_Drawing_TextStyle*, int); + +/** + * @brief Sets the break strategy. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextBreakStrategy(OH_Drawing_TypographyStyle*, int); + +/** + * @brief Sets the word break type. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextWordBreakType(OH_Drawing_TypographyStyle*, int); + +/** + * @brief Sets the ellipsis modal. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle*, int); + #ifdef __cplusplus } #endif -- Gitee From 2020e29d8df0c9c50750715bf0e95a080d0fef15 Mon Sep 17 00:00:00 2001 From: guoxing Date: Mon, 11 Dec 2023 12:32:03 +0000 Subject: [PATCH 2/6] =?UTF-8?q?=E8=A7=84=E8=8C=83=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: guoxing --- .../native_drawing/drawing_text_typography.h | 80 ++++++++++++++++++- 1 file changed, 78 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 ce4de9f1d..6064b8d47 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -44,7 +44,6 @@ #include "drawing_types.h" #include "stdint.h" -#include #ifdef __cplusplus extern "C" { @@ -153,10 +152,15 @@ enum OH_Drawing_FontStyle { * @brief Enumerates text decoration style. */ enum OH_Drawing_TextDecorationStyle { + /** Solid style */ TEXT_DECORATION_STYLE_SOLID, + /** Double style */ TEXT_DECORATION_STYLE_DOUBLE, + /** Dotted style */ TEXT_DECORATION_STYLE_DOTTED, + /** Dashed style */ TEXT_DECORATION_STYLE_DASHED, + /** Wavy style */ TEXT_DECORATION_STYLE_WAVY, }; @@ -164,8 +168,11 @@ enum OH_Drawing_TextDecorationStyle { * @brief Enumerates ellipsis modal. */ enum OH_Drawing_EllipsisModal { + /** Head modal */ ELLIPSIS_MODAL_HEAD = 0, + /** Middle modal */ ELLIPSIS_MODAL_MIDDLE = 1, + /** Tail modal */ ELLIPSIS_MODAL_TAIL = 2, }; @@ -173,8 +180,11 @@ enum OH_Drawing_EllipsisModal { * @brief Enumerates break strategy. */ enum OH_Drawing_BreakStrategy { + /** Greedy strategy */ BREAK_STRATEGY_GREEDY = 0, + /** Quality strategy */ BREAK_STRATEGY_HIGH_QUALITY = 1, + /** Balanced strategy */ BREAK_STRATEGY_BALANCED = 2, }; @@ -182,8 +192,11 @@ enum OH_Drawing_BreakStrategy { * @brief Enumerates word break type. */ enum OH_Drawing_WordBreakType { + /** Normal type */ WORD_BREAK_TYPE_NORMAL = 0, + /** Break All type */ WORD_BREAK_TYPE_BREAK_ALL = 1, + /** Break Word type */ WORD_BREAK_TYPE_BREAK_WORD = 2, }; @@ -191,11 +204,17 @@ enum OH_Drawing_WordBreakType { * @brief Enumerates rect height style. */ enum OH_Drawing_RectHeightStyle { + /** Tight style */ RECT_HEIGHT_STYLE_TIGHT, + /** Max style */ RECT_HEIGHT_STYLE_MAX, + /** Includelinespacemiddle style */ RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE, + /** Includelinespacetop style */ RECT_HEIGHT_STYLE_INCLUDELINESPACETOP, + /** Includelinespacebottom style */ RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM, + /** Struct style */ RECT_HEIGHT_STYLE_STRUCT, }; @@ -203,19 +222,39 @@ enum OH_Drawing_RectHeightStyle { * @brief Enumerates rect Width style. */ enum OH_Drawing_RectWidthStyle { + /** Tight style */ RECT_WIDTH_STYLE_TIGHT, + /** Max style */ RECT_WIDTH_STYLE_MAX, }; +/** + * @brief Defines the rect of a textbox, including the left, right, top and bottom. + * + * @since 11 + * @version 1.0 + */ typedef struct { + /** left of textbox */ float left_; + /** right of textbox */ float right_; + /** top of textbox */ float top_; + /** bottom of textbox */ float bottom_; } OH_Drawing_Rect; +/** + * @brief Defines the textbox of typography, including the rect and direction. + * + * @since 11 + * @version 1.0 + */ typedef struct { + /** rect of textBox */ OH_Drawing_Rect rect_; + /** direction of textBox */ OH_Drawing_TextDirection direction_; } OH_Drawing_TextBox; @@ -223,17 +262,35 @@ typedef struct { * @brief Enumerates affinity. */ enum OH_Drawing_Affinity { + /** upstream affinity */ AFFINITY_UPSTREAM, + /** downstream affinity */ AFFINITY_DOWNSTREAM, }; +/** + * @brief Defines the position and affinity of typography, including the position and affinity. + * + * @since 11 + * @version 1.0 + */ typedef struct { + /** position of typography */ size_t pos_; + /** affinity of typography */ OH_Drawing_Affinity affinity_; } OH_Drawing_PositionAndAffinity; +/** + * @brief Defines the range of typography, including the start and end. + * + * @since 11 + * @version 1.0 + */ typedef struct { + /** start of range */ size_t start_; + /** end of range */ size_t end_; } OH_Drawing_Range; @@ -616,6 +673,10 @@ bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param size_t Indicates the start of range to set. + * @param size_t Indicates the end of range to set. + * @param OH_Drawing_RectHeightStyle Indicates the height style to set. For details, see the enum OH_Drawing_RectHeightStyle. + * @param OH_Drawing_RectWidthStyle Indicates the width style to set. For details, see the enum OH_Drawing_RectWidthStyle. * @return Returns the rects for range. * @since 11 * @version 1.0 @@ -639,6 +700,8 @@ OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders(OH_Drawing_Typo * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param double Indicates the positionX of typography to set. + * @param double Indicates the positionY of typography to set. * @return Returns the glyphposition at coordinate. * @since 11 * @version 1.0 @@ -651,6 +714,8 @@ OH_Drawing_PositionAndAffinity OH_Drawing_TypographyGetGlyphPositionAtCoordinate * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param double Indicates the positionX of typography to set. + * @param double Indicates the positionY of typography to set. * @return Returns the glyphposition at coordinate with cluster. * @since 11 * @version 1.0 @@ -663,6 +728,7 @@ OH_Drawing_PositionAndAffinity OH_Drawing_TypographyGetGlyphPositionAtCoordinate * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param size_t Indicates the size of text to set. * @return Returns the word boundary. * @since 11 * @version 1.0 @@ -685,6 +751,7 @@ size_t OH_Drawing_TypographyGetLineCount(OH_Drawing_Typography*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param int Indicates the text decoration style to set. For details, see the enum OH_Drawing_TextDecorationStyle. * @since 11 * @version 1.0 */ @@ -695,6 +762,7 @@ void OH_Drawing_SetTextStyleDecorationStyle(OH_Drawing_TextStyle*, int); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param double Indicates the thickness scale of text decoration to set. * @since 11 * @version 1.0 */ @@ -705,6 +773,7 @@ void OH_Drawing_SetTextStyleDecorationThicknessScale(OH_Drawing_TextStyle*, doub * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param double Indicates the letter space to set. * @since 11 * @version 1.0 */ @@ -715,6 +784,7 @@ void OH_Drawing_SetTextStyleLetterSpacing(OH_Drawing_TextStyle*, double); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param double Indicates the word space to set. * @since 11 * @version 1.0 */ @@ -725,6 +795,7 @@ void OH_Drawing_SetTextStyleWordSpacing(OH_Drawing_TextStyle*, double); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param bool Indicates the half leading to set. * @since 11 * @version 1.0 */ @@ -735,16 +806,18 @@ void OH_Drawing_SetTextStyleHalfLeading(OH_Drawing_TextStyle*, bool); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param char* Indicates the pointer to ellipsis style. * @since 11 * @version 1.0 */ -void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle*, std::u16string); +void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle*, char*); /** * @brief Sets the ellipsis modal. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param int Indicates the ellipsis model to set. For details, see the enum OH_Drawing_EllipsisModal. * @since 11 * @version 1.0 */ @@ -755,6 +828,7 @@ void OH_Drawing_SetTextStyleEllipsisModal(OH_Drawing_TextStyle*, int); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param int Indicates the break strategy to set. For details, see the enum OH_Drawing_BreakStrategy. * @since 11 * @version 1.0 */ @@ -765,6 +839,7 @@ void OH_Drawing_SetTypographyTextBreakStrategy(OH_Drawing_TypographyStyle*, int) * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param int Indicates the word break type to set. For details, see the enum OH_Drawing_WordBreakType. * @since 11 * @version 1.0 */ @@ -775,6 +850,7 @@ void OH_Drawing_SetTypographyTextWordBreakType(OH_Drawing_TypographyStyle*, int) * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param int Indicates the ellipsis modal to set. For details, see the enum OH_Drawing_EllipsisModal. * @since 11 * @version 1.0 */ -- Gitee From 39b3aabd32ca9d64dd11ccd90bdbdefd9e632695 Mon Sep 17 00:00:00 2001 From: guoxing Date: Tue, 12 Dec 2023 01:08:52 +0000 Subject: [PATCH 3/6] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=A7=84=E8=8C=83?= =?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: guoxing --- .../native_drawing/drawing_text_typography.h | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 6064b8d47..a451e1d80 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -150,6 +150,9 @@ enum OH_Drawing_FontStyle { /** * @brief Enumerates text decoration style. + * + * @since 11 + * @version 1.0 */ enum OH_Drawing_TextDecorationStyle { /** Solid style */ @@ -166,6 +169,9 @@ enum OH_Drawing_TextDecorationStyle { /** * @brief Enumerates ellipsis modal. + * + * @since 11 + * @version 1.0 */ enum OH_Drawing_EllipsisModal { /** Head modal */ @@ -178,6 +184,9 @@ enum OH_Drawing_EllipsisModal { /** * @brief Enumerates break strategy. + * + * @since 11 + * @version 1.0 */ enum OH_Drawing_BreakStrategy { /** Greedy strategy */ @@ -190,6 +199,9 @@ enum OH_Drawing_BreakStrategy { /** * @brief Enumerates word break type. + * + * @since 11 + * @version 1.0 */ enum OH_Drawing_WordBreakType { /** Normal type */ @@ -202,6 +214,9 @@ enum OH_Drawing_WordBreakType { /** * @brief Enumerates rect height style. + * + * @since 11 + * @version 1.0 */ enum OH_Drawing_RectHeightStyle { /** Tight style */ @@ -220,6 +235,9 @@ enum OH_Drawing_RectHeightStyle { /** * @brief Enumerates rect Width style. + * + * @since 11 + * @version 1.0 */ enum OH_Drawing_RectWidthStyle { /** Tight style */ @@ -260,6 +278,9 @@ typedef struct { /** * @brief Enumerates affinity. + * + * @since 11 + * @version 1.0 */ enum OH_Drawing_Affinity { /** upstream affinity */ -- Gitee From 5f64f07aa112f5febbd855f7e34816e62fc7a6a8 Mon Sep 17 00:00:00 2001 From: guoxing Date: Tue, 12 Dec 2023 01:35:09 +0000 Subject: [PATCH 4/6] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0ndk.jso?= =?UTF-8?q?n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: guoxing --- .../native_drawing/libnative_drawing.ndk.json | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 476344282..af71a5bdb 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -85,5 +85,22 @@ { "name": "OH_Drawing_TypographyGetMinIntrinsicWidth" }, { "name": "OH_Drawing_TypographyGetMaxIntrinsicWidth" }, { "name": "OH_Drawing_TypographyGetAlphabeticBaseline" }, - { "name": "OH_Drawing_TypographyGetIdeographicBaseline" } + { "name": "OH_Drawing_TypographyGetIdeographicBaseline" }, + { "name": "OH_Drawing_TypographyDidExceedMaxLines" }, + { "name": "OH_Drawing_TypographyGetRectsForRange" }, + { "name": "OH_Drawing_TypographyGetRectsForPlaceholders" }, + { "name": "OH_Drawing_TypographyGetGlyphPositionAtCoordinate" }, + { "name": "OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster" }, + { "name": "OH_Drawing_TypographyGetWordBoundary" }, + { "name": "OH_Drawing_TypographyGetLineCount" }, + { "name": "OH_Drawing_SetTextStyleDecorationStyle" }, + { "name": "OH_Drawing_SetTextStyleDecorationThicknessScale" }, + { "name": "OH_Drawing_SetTextStyleLetterSpacing" }, + { "name": "OH_Drawing_SetTextStyleWordSpacing" }, + { "name": "OH_Drawing_SetTextStyleHalfLeading" }, + { "name": "OH_Drawing_SetTextStyleEllipsis" }, + { "name": "OH_Drawing_SetTextStyleEllipsisModal" }, + { "name": "OH_Drawing_SetTypographyTextBreakStrategy" }, + { "name": "OH_Drawing_SetTypographyTextWordBreakType" }, + { "name": "OH_Drawing_SetTypographyTextEllipsisModal" } ] \ No newline at end of file -- Gitee From bd155f9eb35656cab751dac96a27d06be152d699 Mon Sep 17 00:00:00 2001 From: guoxing Date: Tue, 12 Dec 2023 02:22:44 +0000 Subject: [PATCH 5/6] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=A7=84=E8=8C=83?= =?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: guoxing --- .../native_drawing/libnative_drawing.ndk.json | 85 +++++++++++++++---- 1 file changed, 68 insertions(+), 17 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index af71a5bdb..5d71e801a 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -86,21 +86,72 @@ { "name": "OH_Drawing_TypographyGetMaxIntrinsicWidth" }, { "name": "OH_Drawing_TypographyGetAlphabeticBaseline" }, { "name": "OH_Drawing_TypographyGetIdeographicBaseline" }, - { "name": "OH_Drawing_TypographyDidExceedMaxLines" }, - { "name": "OH_Drawing_TypographyGetRectsForRange" }, - { "name": "OH_Drawing_TypographyGetRectsForPlaceholders" }, - { "name": "OH_Drawing_TypographyGetGlyphPositionAtCoordinate" }, - { "name": "OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster" }, - { "name": "OH_Drawing_TypographyGetWordBoundary" }, - { "name": "OH_Drawing_TypographyGetLineCount" }, - { "name": "OH_Drawing_SetTextStyleDecorationStyle" }, - { "name": "OH_Drawing_SetTextStyleDecorationThicknessScale" }, - { "name": "OH_Drawing_SetTextStyleLetterSpacing" }, - { "name": "OH_Drawing_SetTextStyleWordSpacing" }, - { "name": "OH_Drawing_SetTextStyleHalfLeading" }, - { "name": "OH_Drawing_SetTextStyleEllipsis" }, - { "name": "OH_Drawing_SetTextStyleEllipsisModal" }, - { "name": "OH_Drawing_SetTypographyTextBreakStrategy" }, - { "name": "OH_Drawing_SetTypographyTextWordBreakType" }, - { "name": "OH_Drawing_SetTypographyTextEllipsisModal" } + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyDidExceedMaxLines" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetRectsForRange" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetRectsForPlaceholders" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetGlyphPositionAtCoordinate" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetWordBoundary" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetLineCount" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTextStyleDecorationStyle" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTextStyleDecorationThicknessScale" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTextStyleLetterSpacing" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTextStyleWordSpacing" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTextStyleHalfLeading" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTextStyleEllipsis" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTextStyleEllipsisModal" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTypographyTextBreakStrategy" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTypographyTextWordBreakType" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_SetTypographyTextEllipsisModal" + } ] \ No newline at end of file -- Gitee From 042f18675f5fffa255a1060698a1f4042b935330 Mon Sep 17 00:00:00 2001 From: guoxing Date: Tue, 12 Dec 2023 03:22:40 +0000 Subject: [PATCH 6/6] =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=A7=84=E8=8C=83?= =?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: guoxing --- .../native_drawing/drawing_text_declaration.h | 24 ++ .../native_drawing/drawing_text_typography.h | 300 +++++++++++++----- .../native_drawing/libnative_drawing.ndk.json | 52 +++ 3 files changed, 288 insertions(+), 88 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h index f999968da..14cfaa33b 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_declaration.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_declaration.h @@ -82,6 +82,30 @@ typedef struct OH_Drawing_TypographyStyle OH_Drawing_TypographyStyle; */ typedef struct OH_Drawing_TypographyCreate OH_Drawing_TypographyCreate; +/** + * @brief Defines an OH_Drawing_TextBox, which is used to create an OH_Drawing_TextBox object. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_TextBox OH_Drawing_TextBox; + +/** + * @brief Defines an OH_Drawing_PositionAndAffinity, + * which is used to create an OH_Drawing_PositionAndAffinity object. + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_PositionAndAffinity OH_Drawing_PositionAndAffinity; + +/** + * @brief Defines an OH_Drawing_Range, which is used to create an OH_Drawing_Range object. + * + * @since 11 + * @version 1.0 + */ +typedef struct OH_Drawing_Range OH_Drawing_Range; + #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 a451e1d80..3559ba24b 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -148,13 +148,53 @@ enum OH_Drawing_FontStyle { FONT_STYLE_ITALIC, }; +/** + * @brief Enumerates placeholder vertical alignment. + * + * @since 11 + * @version 1.0 + */ +typedef enum { + /** Offset At Baseline */ + ALIGNMENT_OFFSET_AT_BASELINE, + /** Above Baseline */ + ALIGNMENT_ABOVE_BASELINE, + /** Below Baseline */ + ALIGNMENT_BELOW_BASELINE, + /** Top of Row Box */ + ALIGNMENT_TOP_OF_ROW_BOX, + /** Bottom of Row Box */ + ALIGNMENT_BOTTOM_OF_ROW_BOX, + /** Center of Row Box */ + ALIGNMENT_CENTER_OF_ROW_BOX, +} OH_Drawing_PlaceholderVerticalAlignment; + +/** + * @brief Defines the placeholder span. + * + * @since 11 + * @version 1.0 + */ +typedef struct { + /** width of placeholder */ + double width; + /** height of placeholder */ + double height; + /** alignment of placeholder */ + OH_Drawing_PlaceholderVerticalAlignment alignment; + /** baseline of placeholder */ + OH_Drawing_TextBaseline baseline; + /** baselineoffset of placeholder */ + double baselineOffset; +} OH_Drawing_PlaceholderSpan; + /** * @brief Enumerates text decoration style. * * @since 11 * @version 1.0 */ -enum OH_Drawing_TextDecorationStyle { +typedef enum { /** Solid style */ TEXT_DECORATION_STYLE_SOLID, /** Double style */ @@ -165,7 +205,7 @@ enum OH_Drawing_TextDecorationStyle { TEXT_DECORATION_STYLE_DASHED, /** Wavy style */ TEXT_DECORATION_STYLE_WAVY, -}; +} OH_Drawing_TextDecorationStyle; /** * @brief Enumerates ellipsis modal. @@ -173,14 +213,14 @@ enum OH_Drawing_TextDecorationStyle { * @since 11 * @version 1.0 */ -enum OH_Drawing_EllipsisModal { +typedef enum { /** Head modal */ ELLIPSIS_MODAL_HEAD = 0, /** Middle modal */ ELLIPSIS_MODAL_MIDDLE = 1, /** Tail modal */ ELLIPSIS_MODAL_TAIL = 2, -}; +} OH_Drawing_EllipsisModal; /** * @brief Enumerates break strategy. @@ -188,14 +228,14 @@ enum OH_Drawing_EllipsisModal { * @since 11 * @version 1.0 */ -enum OH_Drawing_BreakStrategy { +typedef enum { /** Greedy strategy */ BREAK_STRATEGY_GREEDY = 0, /** Quality strategy */ BREAK_STRATEGY_HIGH_QUALITY = 1, /** Balanced strategy */ BREAK_STRATEGY_BALANCED = 2, -}; +} OH_Drawing_BreakStrategy; /** * @brief Enumerates word break type. @@ -203,14 +243,14 @@ enum OH_Drawing_BreakStrategy { * @since 11 * @version 1.0 */ -enum OH_Drawing_WordBreakType { +typedef enum { /** Normal type */ WORD_BREAK_TYPE_NORMAL = 0, /** Break All type */ WORD_BREAK_TYPE_BREAK_ALL = 1, /** Break Word type */ WORD_BREAK_TYPE_BREAK_WORD = 2, -}; +} OH_Drawing_WordBreakType; /** * @brief Enumerates rect height style. @@ -218,7 +258,7 @@ enum OH_Drawing_WordBreakType { * @since 11 * @version 1.0 */ -enum OH_Drawing_RectHeightStyle { +typedef enum { /** Tight style */ RECT_HEIGHT_STYLE_TIGHT, /** Max style */ @@ -231,7 +271,7 @@ enum OH_Drawing_RectHeightStyle { RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM, /** Struct style */ RECT_HEIGHT_STYLE_STRUCT, -}; +} OH_Drawing_RectHeightStyle; /** * @brief Enumerates rect Width style. @@ -239,81 +279,12 @@ enum OH_Drawing_RectHeightStyle { * @since 11 * @version 1.0 */ -enum OH_Drawing_RectWidthStyle { +typedef enum { /** Tight style */ RECT_WIDTH_STYLE_TIGHT, /** Max style */ RECT_WIDTH_STYLE_MAX, -}; - -/** - * @brief Defines the rect of a textbox, including the left, right, top and bottom. - * - * @since 11 - * @version 1.0 - */ -typedef struct { - /** left of textbox */ - float left_; - /** right of textbox */ - float right_; - /** top of textbox */ - float top_; - /** bottom of textbox */ - float bottom_; -} OH_Drawing_Rect; - -/** - * @brief Defines the textbox of typography, including the rect and direction. - * - * @since 11 - * @version 1.0 - */ -typedef struct { - /** rect of textBox */ - OH_Drawing_Rect rect_; - /** direction of textBox */ - OH_Drawing_TextDirection direction_; -} OH_Drawing_TextBox; - -/** - * @brief Enumerates affinity. - * - * @since 11 - * @version 1.0 - */ -enum OH_Drawing_Affinity { - /** upstream affinity */ - AFFINITY_UPSTREAM, - /** downstream affinity */ - AFFINITY_DOWNSTREAM, -}; - -/** - * @brief Defines the position and affinity of typography, including the position and affinity. - * - * @since 11 - * @version 1.0 - */ -typedef struct { - /** position of typography */ - size_t pos_; - /** affinity of typography */ - OH_Drawing_Affinity affinity_; -} OH_Drawing_PositionAndAffinity; - -/** - * @brief Defines the range of typography, including the start and end. - * - * @since 11 - * @version 1.0 - */ -typedef struct { - /** start of range */ - size_t start_; - /** end of range */ - size_t end_; -} OH_Drawing_Range; +} OH_Drawing_RectWidthStyle; /** * @brief Creates an OH_Drawing_TypographyStyle object. @@ -678,6 +649,17 @@ double OH_Drawing_TypographyGetAlphabeticBaseline(OH_Drawing_Typography*); */ double OH_Drawing_TypographyGetIdeographicBaseline(OH_Drawing_Typography*); +/** + * @brief Sets the placeholder. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object. + * @param OH_Drawing_PlaceholderSpan Indicates the pointer to an OH_Drawing_PlaceholderSpan object. + * @since 11 + * @version 1.0 + */ +void OH_Drawing_TypographyHandlerAddPlaceholder(OH_Drawing_TypographyCreate*, OH_Drawing_PlaceholderSpan*); + /** * @brief Gets the exceed maxLines. * @@ -696,8 +678,10 @@ bool OH_Drawing_TypographyDidExceedMaxLines(OH_Drawing_Typography*); * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. * @param size_t Indicates the start of range to set. * @param size_t Indicates the end of range to set. - * @param OH_Drawing_RectHeightStyle Indicates the height style to set. For details, see the enum OH_Drawing_RectHeightStyle. - * @param OH_Drawing_RectWidthStyle Indicates the width style to set. For details, see the enum OH_Drawing_RectWidthStyle. + * @param OH_Drawing_RectHeightStyle Indicates the height style to set. + * For details, see the enum OH_Drawing_RectHeightStyle. + * @param OH_Drawing_RectWidthStyle Indicates the width style to set. + * For details, see the enum OH_Drawing_RectWidthStyle. * @return Returns the rects for range. * @since 11 * @version 1.0 @@ -716,6 +700,77 @@ OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForRange(OH_Drawing_Typography* */ OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders(OH_Drawing_Typography*); +/** + * @brief Gets left from textbox. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. + * @param int Indicates the index of textbox. + * @return Returns left from textbox. + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetLeftFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief Gets right from textbox. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. + * @param int Indicates the index of textbox. + * @return Returns right from textbox. + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetRightFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief Gets top from textbox. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. + * @param int Indicates the index of textbox. + * @return Returns top from textbox. + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetTopFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief Gets bottom from textbox. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. + * @param int Indicates the index of textbox. + * @return Returns bottom from textbox. + * @since 11 + * @version 1.0 + */ +float OH_Drawing_GetBottomFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief Gets direction from textbox. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. + * @param int Indicates the index of textbox. + * @return Returns direction from textbox. + * @since 11 + * @version 1.0 + */ +int OH_Drawing_GetTextDirectionFromTextBox(OH_Drawing_TextBox*, int); + +/** + * @brief Gets size of textbox. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextBox Indicates the pointer to an OH_Drawing_TextBox object. + * @return Returns size of textbox. + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetSizeOfTextBox(OH_Drawing_TextBox*); + /** * @brief Gets the glyphposition at coordinate. * @@ -727,7 +782,7 @@ OH_Drawing_TextBox* OH_Drawing_TypographyGetRectsForPlaceholders(OH_Drawing_Typo * @since 11 * @version 1.0 */ -OH_Drawing_PositionAndAffinity OH_Drawing_TypographyGetGlyphPositionAtCoordinate(OH_Drawing_Typography*, +OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinate(OH_Drawing_Typography*, double, double); /** @@ -741,9 +796,31 @@ OH_Drawing_PositionAndAffinity OH_Drawing_TypographyGetGlyphPositionAtCoordinate * @since 11 * @version 1.0 */ -OH_Drawing_PositionAndAffinity OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster(OH_Drawing_Typography*, +OH_Drawing_PositionAndAffinity* OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster(OH_Drawing_Typography*, double, double); +/** + * @brief Gets position from position and affinity. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_PositionAndAffinity Indicates the pointer to an OH_Drawing_PositionAndAffinity object. + * @return Returns position from position and affinity. + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetPositionFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*); + +/** + * @brief Gets affinity from position and affinity. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_PositionAndAffinity Indicates the pointer to an OH_Drawing_PositionAndAffinity object. + * @return Returns affinity from position and affinity. + * @since 11 + * @version 1.0 + */ +int OH_Drawing_GetAffinityFromPositionAndAffinity(OH_Drawing_PositionAndAffinity*); + /** * @brief Gets the word boundary. * @@ -754,7 +831,29 @@ OH_Drawing_PositionAndAffinity OH_Drawing_TypographyGetGlyphPositionAtCoordinate * @since 11 * @version 1.0 */ -OH_Drawing_Range OH_Drawing_TypographyGetWordBoundary(OH_Drawing_Typography*, size_t); +OH_Drawing_Range* OH_Drawing_TypographyGetWordBoundary(OH_Drawing_Typography*, size_t); + +/** + * @brief Gets start from range. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Range Indicates the pointer to an OH_Drawing_Range object. + * @return Returns start from range. + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetStartFromRange(OH_Drawing_Range*); + +/** + * @brief Gets end from range. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Range Indicates the pointer to an OH_Drawing_Range object. + * @return Returns end from range. + * @since 11 + * @version 1.0 + */ +size_t OH_Drawing_GetEndFromRange(OH_Drawing_Range*); /** * @brief Gets the line count. @@ -772,7 +871,8 @@ size_t OH_Drawing_TypographyGetLineCount(OH_Drawing_Typography*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param int Indicates the text decoration style to set. For details, see the enum OH_Drawing_TextDecorationStyle. + * @param int Indicates the text decoration style to set. + * For details, see the enum OH_Drawing_TextDecorationStyle. * @since 11 * @version 1.0 */ @@ -831,7 +931,7 @@ void OH_Drawing_SetTextStyleHalfLeading(OH_Drawing_TextStyle*, bool); * @since 11 * @version 1.0 */ -void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle*, char*); +void OH_Drawing_SetTextStyleEllipsis(OH_Drawing_TextStyle*, const char*); /** * @brief Sets the ellipsis modal. @@ -877,6 +977,30 @@ void OH_Drawing_SetTypographyTextWordBreakType(OH_Drawing_TypographyStyle*, int) */ void OH_Drawing_SetTypographyTextEllipsisModal(OH_Drawing_TypographyStyle*, int); +/** + * @brief get line height. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param int Indicates the line number. + * @return Returns line height. + * @since 11 + * @version 1.0 + */ +double OH_Drawing_TypographyGetLineHeight(OH_Drawing_Typography*, int); + +/** + * @brief get line width. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_Typography Indicates the pointer to an OH_Drawing_Typography object. + * @param int Indicates the line number. + * @return Returns line width. + * @since 11 + * @version 1.0 + */ +double OH_Drawing_TypographyGetLineWidth(OH_Drawing_Typography*, int); + #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 5d71e801a..2e4cd3e9b 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -86,6 +86,10 @@ { "name": "OH_Drawing_TypographyGetMaxIntrinsicWidth" }, { "name": "OH_Drawing_TypographyGetAlphabeticBaseline" }, { "name": "OH_Drawing_TypographyGetIdeographicBaseline" }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyHandlerAddPlaceholder" + }, { "first_introduced": "11", "name": "OH_Drawing_TypographyDidExceedMaxLines" @@ -98,6 +102,30 @@ "first_introduced": "11", "name": "OH_Drawing_TypographyGetRectsForPlaceholders" }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetLeftFromTextBox" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetRightFromTextBox" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetTopFromTextBox" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetBottomFromTextBox" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetTextDirectionFromTextBox" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetSizeOfTextBox" + }, { "first_introduced": "11", "name": "OH_Drawing_TypographyGetGlyphPositionAtCoordinate" @@ -106,10 +134,26 @@ "first_introduced": "11", "name": "OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster" }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetPositionFromPositionAndAffinity" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetAffinityFromPositionAndAffinity" + }, { "first_introduced": "11", "name": "OH_Drawing_TypographyGetWordBoundary" }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetStartFromRange" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_GetEndFromRange" + }, { "first_introduced": "11", "name": "OH_Drawing_TypographyGetLineCount" @@ -153,5 +197,13 @@ { "first_introduced": "11", "name": "OH_Drawing_SetTypographyTextEllipsisModal" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetLineHeight" + }, + { + "first_introduced": "11", + "name": "OH_Drawing_TypographyGetLineWidth" } ] \ No newline at end of file -- Gitee