diff --git a/graphic/graphic_2d/native_drawing/BUILD.gn b/graphic/graphic_2d/native_drawing/BUILD.gn index 88c0459bc9fd316e2be057729c6e97d9081011e3..27dbdba9769f66bd2ccb78708688c71ad92843d1 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 0000000000000000000000000000000000000000..6e6032c61b6111be70bc8b8110c0a1eec7661838 --- /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 contrast mode to enhance readability. + * @since 20 + * @version 1.0 + */ +typedef enum { + /** 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 contrast mode of text rendering. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param action OH_Drawing_TextHighContrast object. + * @since 20 + */ +void OH_Drawing_SetTextHighContrast(OH_Drawing_TextHighContrast action); +#ifdef __cplusplus +} +#endif +/** @} */ +#endif // C_INCLUDE_DRAWING_TEXT_GLOBAL_H diff --git a/graphic/graphic_2d/native_drawing/drawing_text_run.h b/graphic/graphic_2d/native_drawing/drawing_text_run.h index 8873eaaf23e7389d04a20395f7281ebdd6a0ba39..fafd279a968602bf4b1446a82d8a06bb8b8f187c 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 diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index e13687d429e5ac4b5fe5f166a49471ba61797534..91bdff1262ddee5345bcc3c8dc37166ecd8157cf 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_SetTextHighContrast" } ] \ No newline at end of file