From 6b99590bc53e58fa0a621ab1ee32e6f5896d46ce Mon Sep 17 00:00:00 2001 From: mobHot Date: Sun, 20 Apr 2025 20:58:15 +0800 Subject: [PATCH 1/2] add the support for trimming line end space Signed-off-by: mobHot Change-Id: Ie9ed8598790afff270517980b095e260e3e1ed75 --- .../native_drawing/drawing_text_typography.h | 12 ++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index f08f8060c..ddadac9db 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -2922,6 +2922,18 @@ void OH_Drawing_SetTypographyTextTab(OH_Drawing_TypographyStyle* style, OH_Drawi */ size_t OH_Drawing_GetDrawingArraySize(OH_Drawing_Array* drawingArray); +/** +* @brief Sets whether to optimize whitespace at the end of each line for text typography. +* +* @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing +* @param style Indicates the pointer to an OH_Drawing_TypographyStyle object. +* @param trailingSpaceOptimized Boolean value indicating whether to optimize whitespace at the end of each line +* for text typography to set. +* @since 20 +* @version 1.0 +*/ +void OH_Drawing_SetTypographyTextTrailingSpaceOptimized(OH_Drawing_TypographyStyle* style, bool trailingSpaceOptimized); + /** * @brief Set text badge type. * diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index d39f4f1c0..c80bb63c5 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -1794,6 +1794,10 @@ "first_introduced": "18", "name": "OH_Drawing_CanvasDrawPixelMapNine" }, + { + "first_introduced": "20", + "name": "OH_Drawing_SetTypographyTextTrailingSpaceOptimized" + }, { "first_introduced": "20", "name": "OH_Drawing_SetTextStyleBadgeType" -- Gitee From 5fc670bbec696eb8307d0886dc4ec6233ef0e271 Mon Sep 17 00:00:00 2001 From: mobHot Date: Mon, 5 May 2025 17:01:43 +0800 Subject: [PATCH 2/2] add the support for updating color and decoration Signed-off-by: mobHot Change-Id: Ie307fb95d17080cfb864ead948e9d70bcd6a1de4 --- .../native_drawing/drawing_text_typography.h | 48 +++++++++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 16 +++++++ 2 files changed, 64 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index ddadac9db..f9f741b2a 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -2621,6 +2621,54 @@ int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount(OH_Drawing_Typography* typ */ void OH_Drawing_TypographyUpdateFontSize(OH_Drawing_Typography* typography, size_t from, size_t to, float fontSize); +/** + * @brief Update the font color of the typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param typography Indicates the pointer to the text OH_Drawing_Typography object. + * @param color Indicates the color to update. + * @since 20 + * @version 1.0 + */ +void OH_Drawing_TypographyUpdateFontColor(OH_Drawing_Typography* typography, uint32_t color); + +/** + * @brief Update the decoration of the typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param typography Indicates the pointer to the text OH_Drawing_Typography object. + * @param decoration Indicates the text decoration to update. For details, see the enum + * OH_Drawing_TextDecoration. + * @since 20 + * @version 1.0 + */ +void OH_Drawing_TypographyUpdateDecoration(OH_Drawing_Typography* typography, OH_Drawing_TextDecoration decoration); + +/** + * @brief Update the decoration thickness scale of the typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param typography Indicates the pointer to the text OH_Drawing_Typography object. + * @param decorationThicknessScale Indicates the thickness scale of the text decoration to update. + * @since 20 + * @version 1.0 + */ +void OH_Drawing_TypographyUpdateDecorationThicknessScale(OH_Drawing_Typography* typography, + double decorationThicknessScale); + +/** + * @brief Update the decoration style of the typography. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param typography Indicates the pointer to the text OH_Drawing_Typography object. + * @param decorationStyle Indicates the text decoration style to update. + * For details, see the enum OH_Drawing_TextDecorationStyle. + * @since 20 + * @version 1.0 + */ +void OH_Drawing_TypographyUpdateDecorationStyle(OH_Drawing_Typography* typography, + OH_Drawing_TextDecorationStyle decorationStyle); + /** * @brief Get whether the text layout enables line styles. * diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index c80bb63c5..ba89b8f93 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -1470,6 +1470,22 @@ "first_introduced": "12", "name": "OH_Drawing_TypographyUpdateFontSize" }, + { + "first_introduced": "20", + "name": "OH_Drawing_TypographyUpdateFontColor" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_TypographyUpdateDecoration" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_TypographyUpdateDecorationThicknessScale" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_TypographyUpdateDecorationStyle" + }, { "first_introduced": "12", "name": "OH_Drawing_TypographyTextGetLineStyle" -- Gitee