diff --git a/graphic/graphic_2d/native_drawing/drawing_font.h b/graphic/graphic_2d/native_drawing/drawing_font.h index de07d098a7480ae8ebd5b6e1d334f1cd081dfcec..e940990845fd91aefae0e10fb810d8bb3850c32b 100644 --- a/graphic/graphic_2d/native_drawing/drawing_font.h +++ b/graphic/graphic_2d/native_drawing/drawing_font.h @@ -497,6 +497,33 @@ typedef struct OH_Drawing_Font_Metrics { */ float OH_Drawing_FontGetMetrics(OH_Drawing_Font* font, OH_Drawing_Font_Metrics* fontMetrics); +/** + * @brief Sets whether to follow the theme font. If the value is true, the theme font is used when typeface is not set. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param font Indicates the pointer to an OH_Drawing_Font object. + * @param followed Indicates whether to follow the theme font. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if font is nullptr. + * @since 15 + */ +OH_Drawing_ErrorCode OH_Drawing_FontSetThemeFontFollowed(OH_Drawing_Font* font, bool followed); + +/** + * @brief Gets whether to follow the theme font. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param font Indicates the pointer to an OH_Drawing_Font object. + * @param followed Indicates whether to follow the theme font. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if font or followed is nullptr. + * @since 15 + */ +OH_Drawing_ErrorCode OH_Drawing_FontIsThemeFontFollowed(const OH_Drawing_Font* font, bool* followed); + #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 feb5ec6643e57d034881ce43672cf7bdb5141800..e07fccd887ee78ec30d8789cd8bf88bd66bbd70e 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -238,6 +238,10 @@ "first_introduced": "12", "name": "OH_Drawing_FontIsSubpixel" }, + { + "first_introduced": "15", + "name": "OH_Drawing_FontIsThemeFontFollowed" + }, { "first_introduced": "12", "name": "OH_Drawing_FontMeasureSingleCharacter" @@ -276,6 +280,10 @@ "first_introduced": "12", "name": "OH_Drawing_FontSetSubpixel" }, + { + "first_introduced": "15", + "name": "OH_Drawing_FontSetThemeFontFollowed" + }, { "first_introduced": "12", "name": "OH_Drawing_FontTextToGlyphs"