From 292be2512e0b9d9b0e5e11bc8d072cc0055fc150 Mon Sep 17 00:00:00 2001 From: mobHot Date: Thu, 13 Mar 2025 10:35:55 +0800 Subject: [PATCH 1/3] add the interface of GetRunFont Signed-off-by: mobHot Change-Id: I7f49eb23af1961b7c81f8e4f569a51e86850aea2 --- graphic/graphic_2d/native_drawing/drawing_text_run.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_run.h b/graphic/graphic_2d/native_drawing/drawing_text_run.h index 8873eaaf2..fafd279a9 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_run.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_run.h @@ -208,6 +208,17 @@ void OH_Drawing_DestroyRunPositions(OH_Drawing_Array* positions); * @since 18 */ uint32_t OH_Drawing_GetRunGlyphCount(OH_Drawing_Run* run); + +/** + * @brief Gets the Font Object of run. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param run Indicates the pointer to an OH_Drawing_Run object. + * @return The Font Object of run. + * @since 20 + * @version 1.0 + */ +OH_Drawing_Font* OH_Drawing_GetRunFont(OH_Drawing_Run* run); #ifdef __cplusplus } #endif -- Gitee From 0cdf492ec3038d409f521f5e4d5247f443a1d13a Mon Sep 17 00:00:00 2001 From: mobHot Date: Thu, 13 Mar 2025 12:03:24 +0800 Subject: [PATCH 2/3] add the interface of high constract mode Signed-off-by: mobHot Change-Id: Id868c79c08ca7e2b5b509b927cded0e93d9631d0 --- graphic/graphic_2d/native_drawing/BUILD.gn | 1 + .../native_drawing/drawing_text_global.h | 77 +++++++++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 4 + 3 files changed, 82 insertions(+) create mode 100644 graphic/graphic_2d/native_drawing/drawing_text_global.h diff --git a/graphic/graphic_2d/native_drawing/BUILD.gn b/graphic/graphic_2d/native_drawing/BUILD.gn index 88c0459bc..27dbdba97 100644 --- a/graphic/graphic_2d/native_drawing/BUILD.gn +++ b/graphic/graphic_2d/native_drawing/BUILD.gn @@ -106,5 +106,6 @@ ohos_ndk_library("libnative_drawing_ndk") { "native_drawing/drawing_text_typography.h", "native_drawing/drawing_typeface.h", "native_drawing/drawing_types.h", + "native_drawing/drawing_text_global.h", ] } diff --git a/graphic/graphic_2d/native_drawing/drawing_text_global.h b/graphic/graphic_2d/native_drawing/drawing_text_global.h new file mode 100644 index 000000000..af0e126be --- /dev/null +++ b/graphic/graphic_2d/native_drawing/drawing_text_global.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides the global text capability. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 20 + * @version 1.0 + */ + +/** + * @file drawing_text_global.h + * + * @brief Declares functions related to run in the drawing module. + * + * @kit ArkGraphics2D + * @library libnative_drawing.so + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @since 20 + * @version 1.0 + */ + +#ifndef C_INCLUDE_DRAWING_TEXT_GLOBAL_H +#define C_INCLUDE_DRAWING_TEXT_GLOBAL_H + +#include "drawing_text_declaration.h" +#include "drawing_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Defines text rendering high constract mode to enhance readability. + * @since 20 + * @version 1.0 + */ +typedef enum { + /** Follow system's high constract settings for text rendering */ + TEXT_FOLLOW_SYSTEM_HIGH_CONSTRACT, + /** Disable high constract rendering regardless of system settings */ + TEXT_APP_DISABLE_HIGH_CONSTRACT, + /** Enable high constract rendering regardless of system settings */ + TEXT_APP_ENABLE_HIGH_CONSTRACT, + TEXT_HIGH_CONSTRACT_BUTT +} OH_Drawing_TextHighConstract; + +/** + * @brief Sets high constract mode of text rendering. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param action OH_Drawing_TextHighConstract object. + * @since 20 + */ +void OH_Drawing_SetTextHighConstract(OH_Drawing_TextHighConstract action); +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // C_INCLUDE_DRAWING_TEXT_GLOBAL_H diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index e13687d42..a6c08d50e 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -1793,5 +1793,9 @@ { "first_introduced": "18", "name": "OH_Drawing_CanvasDrawPixelMapNine" + }, + { + "first_introduced": "20", + "name": "OH_Drawing_SetTextHighConstract" } ] \ No newline at end of file -- Gitee From 74ebb5f7ab574ab2a7b1aa7a2c46dd2ef55c193d Mon Sep 17 00:00:00 2001 From: mobHot Date: Thu, 13 Mar 2025 12:03:24 +0800 Subject: [PATCH 3/3] add the interface of high constract mode Signed-off-by: mobHot Change-Id: Id868c79c08ca7e2b5b509b927cded0e93d9631d0 --- .../native_drawing/drawing_text_global.h | 24 +++++++++---------- .../native_drawing/libnative_drawing.ndk.json | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_global.h b/graphic/graphic_2d/native_drawing/drawing_text_global.h index af0e126be..6e6032c61 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_global.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_global.h @@ -48,28 +48,28 @@ extern "C" { #endif /** - * @brief Defines text rendering high constract mode to enhance readability. + * @brief Defines text rendering high contrast mode to enhance readability. * @since 20 * @version 1.0 */ typedef enum { - /** Follow system's high constract settings for text rendering */ - TEXT_FOLLOW_SYSTEM_HIGH_CONSTRACT, - /** Disable high constract rendering regardless of system settings */ - TEXT_APP_DISABLE_HIGH_CONSTRACT, - /** Enable high constract rendering regardless of system settings */ - TEXT_APP_ENABLE_HIGH_CONSTRACT, - TEXT_HIGH_CONSTRACT_BUTT -} OH_Drawing_TextHighConstract; + /** Follow system's high contrast settings for text rendering */ + TEXT_FOLLOW_SYSTEM_HIGH_CONTRAST, + /** Disable high contrast rendering regardless of system settings */ + TEXT_APP_DISABLE_HIGH_CONTRAST, + /** Enable high contrast rendering regardless of system settings */ + TEXT_APP_ENABLE_HIGH_CONTRAST, + TEXT_HIGH_CONTRAST_BUTT +} OH_Drawing_TextHighContrast; /** - * @brief Sets high constract mode of text rendering. + * @brief Sets high contrast mode of text rendering. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param action OH_Drawing_TextHighConstract object. + * @param action OH_Drawing_TextHighContrast object. * @since 20 */ -void OH_Drawing_SetTextHighConstract(OH_Drawing_TextHighConstract action); +void OH_Drawing_SetTextHighContrast(OH_Drawing_TextHighContrast action); #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 a6c08d50e..91bdff126 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -1796,6 +1796,6 @@ }, { "first_introduced": "20", - "name": "OH_Drawing_SetTextHighConstract" + "name": "OH_Drawing_SetTextHighContrast" } ] \ No newline at end of file -- Gitee