From 825b25427346c9b0d17e3d61d75bd24b977af88b Mon Sep 17 00:00:00 2001 From: changleipeng Date: Sat, 3 Aug 2024 14:43:37 +0800 Subject: [PATCH] add FontGetTextPath interface Signed-off-by: changleipeng Change-Id: Ic64387d13e62143184bfbf3ea6d71cf8747560a7 --- .../graphic_2d/native_drawing/drawing_font.h | 19 +++++++++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 4 ++++ 2 files changed, 23 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_font.h b/graphic/graphic_2d/native_drawing/drawing_font.h index 38ea644f3..10c34d837 100644 --- a/graphic/graphic_2d/native_drawing/drawing_font.h +++ b/graphic/graphic_2d/native_drawing/drawing_font.h @@ -497,6 +497,25 @@ typedef struct OH_Drawing_Font_Metrics { */ float OH_Drawing_FontGetMetrics(OH_Drawing_Font*, OH_Drawing_Font_Metrics*); +/** + * @brief Get the text outline path. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param font Indicates the pointer to an OH_Drawing_Font object. + * @param text Indicates the character storage encoded with text encoding. + * @param byteLength Indicates the text length in bytes. + * @param encoding OH_Drawing_TextEncoding Indicates the text encoding. + * @param x Indicates x coordinates of the text. + * @param y Indicates y coordinates of the text. + * @param path OH_Drawing_Path The path object, returned to the caller. + * @return Returns the error code. + * Returns {@link OH_DRAWING_SUCCESS} if the operation is successful. + * Returns {@link OH_DRAWING_ERROR_INVALID_PARAMETER} if any of font, text or path is nullptr. + * @since 14 + */ +OH_Drawing_ErrorCode OH_Drawing_FontGetTextPath(const OH_Drawing_Font* font, const void* text, size_t byteLength, + OH_Drawing_TextEncoding encoding, float x, float y, OH_Drawing_Path* path); + #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 9c5b0d269..6ec44ae8f 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -1465,5 +1465,9 @@ { "first_introduced": "13", "name":"OH_Drawing_RecordCmdDestroy" + }, + { + "first_introduced": "14", + "name":"OH_Drawing_FontGetTextPath" } ] \ No newline at end of file -- Gitee