From efa76c4805c944cd960a5cb5ab69791440a1c52a Mon Sep 17 00:00:00 2001 From: changleipeng Date: Mon, 11 Mar 2024 13:42:00 +0000 Subject: [PATCH 01/26] =?UTF-8?q?=E5=A2=9E=E5=8A=A0fontmgr=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/BUILD.gn | 2 + .../native_drawing/drawing_font_mgr.h | 258 ++++++++++++++++++ .../graphic_2d/native_drawing/drawing_types.h | 16 ++ .../native_drawing/libnative_drawing.ndk.json | 40 +++ 4 files changed, 316 insertions(+) create mode 100755 graphic/graphic_2d/native_drawing/drawing_font_mgr.h diff --git a/graphic/graphic_2d/native_drawing/BUILD.gn b/graphic/graphic_2d/native_drawing/BUILD.gn index 60e24af8d..3b21e1586 100644 --- a/graphic/graphic_2d/native_drawing/BUILD.gn +++ b/graphic/graphic_2d/native_drawing/BUILD.gn @@ -25,6 +25,7 @@ ohos_ndk_headers("native_drawing_header") { "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_filter.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_font.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_font_collection.h", + "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_font_mgr.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_image.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_mask_filter.h", "//interface/sdk_c/graphic/graphic_2d/native_drawing/drawing_matrix.h", @@ -60,6 +61,7 @@ ohos_ndk_library("libnative_drawing_ndk") { "native_drawing/drawing_filter.h", "native_drawing/drawing_font.h", "native_drawing/drawing_font_collection.h", + "native_drawing/drawing_font_mgr.h", "native_drawing/drawing_mask_filter.h", "native_drawing/drawing_matrix.h", "native_drawing/drawing_memory_stream.h", diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h new file mode 100755 index 000000000..1dd86149d --- /dev/null +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -0,0 +1,258 @@ +/* + * Copyright (c) 2023-2024 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. + */ + +#ifndef C_INCLUDE_DRAWING_FONT_MGR_H +#define C_INCLUDE_DRAWING_FONT_MGR_H + +/** + * @addtogroup Drawing + * @{ + * + * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * + * @since 12 + * @version 1.0 + */ + +/** + * @file drawing_font_mgr.h + * + * @brief Declares functions related to the fontmgr object in the drawing module. + * + * @since 12 + * @version 1.0 + */ + +#include "drawing_types.h" +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enumerates font weight. + * + * @since 12 + * @version 1.0 + */ +enum OH_Drawing_FontFormWeight { + /* Invisible font weight */ + INVISIBLE_WEIGHT = 0, + /* Thin font weight */ + THIN_WEIGHT = 100, + /* Extra light font weight */ + EXTRA_LIGHT_WEIGHT = 200, + /* Light font weight */ + LIGHT_WEIGHT = 300, + /* Normal font weight */ + NORMAL_WEIGHT = 400, + /* Medium font weight */ + MEDIUM_WEIGHT = 500, + /* Semi blod font weight */ + SEMI_BOLD_WEIGHT = 600, + /* Blod font weight */ + BOLD_WEIGHT = 700, + /* Extra blod font weight */ + EXTRA_BOLD_WEIGHT = 800, + /* Black font weight */ + BLACK_WEIGHT = 900, + /* Extra black font weight */ + EXTRA_BLACK_WEIGHT = 1000, +}; + +/** + * @brief Enumerates font width. + * + * @since 12 + * @version 1.0 + */ +enum OH_Drawing_FontFormWidth { + /* Ultra condensed font width */ + ULTRA_CONDENSED_WIDTH = 1, + /* Extra condensed font width */ + EXTRA_CONDENSED_WIDTH = 2, + /* condensed font width */ + CONDENSED_WIDTH = 3, + /* Semi condensed font width */ + SEMI_CONDENSED_WIDTH = 4, + /* Normal font width */ + NORMAL_WIDTH = 5, + /* Semi expanded font width */ + SEMI_EXPANDED_WIDTH = 6, + /* Expanded font width */ + EXPANDED_WIDTH = 7, + /* Extra expanded font width */ + EXTRA_EXPANDED_WIDTH = 8, + /* Ultra expanded font width */ + ULTRA_EXPANDED_WIDTH = 9, +}; + +/** + * @brief Enumerates font slant. + * + * @since 12 + * @version 1.0 + */ +enum OH_Drawing_FontFormSlant { + /* Upright font slant */ + UPRIGHT_SLANT, + /* Italic font slant */ + ITALIC_SLANT, + /* Oblique font slant */ + OBLIQUE_SLANT, +}; + +/** + * @brief Defines the font form. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_FontForm { + /** Font weight */ + OH_Drawing_FontFormWeight weight; + /** Font width */ + OH_Drawing_FontFormWidth width; + /** Font slant */ + OH_Drawing_FontFormSlant slant; +} OH_Drawing_FontForm; + +/** + * @brief Creates an OH_Drawing_FontMgr object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @return Returns the pointer to the OH_Drawing_FontMgr object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontMgr* OH_Drawing_FontMgrCreate(void); + +/** + * @brief Releases the memory occupied by an OH_Drawing_FontMgr object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_FontMgrDestroy(OH_Drawing_FontMgr*); + +/** + * @brief Gets the count of font families. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. + * @return Returns the count of font families. + * @since 12 + * @version 1.0 + */ +int OH_Drawing_FontMgrGetFamiliesCount(OH_Drawing_FontMgr*); + +/** + * @brief Gets the font family name from the index. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. + * @param int The index to get the font family name. + * @param int Used to return the size of the font family name array. + * @return Returns the font family name corresponding to the index value. + * @since 12 + * @version 1.0 + */ +char* OH_Drawing_FontMgrGetFamilyName(OH_Drawing_FontMgr*, int, int*); + +/** + * @brief Releases the memory occupied by font family name. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param char Font family name. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyFamilyName(char*); + +/** + * @brief Creates an OH_Drawing_FontStyleSet object by OH_Drawing_FontMgr object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. + * @param int The index used to get the font style set object from the font manager object. + * @return Returns the pointer to the OH_Drawing_FontStyleSet object created. + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontStyleSet* OH_Drawing_FontStyleSetCreate(OH_Drawing_FontMgr*, int); + +/** + * @brief Releases the memory occupied by an OH_Drawing_FontStyleSet object. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontStyleSet Indicates the pointer to an OH_Drawing_FontStyleSet object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_DestroyFontStyleSet(OH_Drawing_FontStyleSet*); + +/** + * @brief Get the pointer to an OH_Drawing_FontStyleSet object for the given font style set family name. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. + * @param char The family name of a font style set to be matched. + * @return Returns the pointer to the OH_Drawing_FontStyleSet object matched. + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily(OH_Drawing_FontMgr*, const char*); + +/** + * @brief Get the pointer to an OH_Drawing_Typeface object based on the given font style and family name. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. + * @param char The family name of a font style set to be matched. + * @param OH_Drawing_FontForm Indicates the pointer to an OH_Drawing_FontForm object. + * @return Returns the pointer to the OH_Drawing_Typeface object matched. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, const char* , OH_Drawing_FontForm*); + +/** + * @brief Get the pointer to an OH_Drawing_Typeface object for the given character. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. + * @param char The family name of a font style set to be matched. + * @param OH_Drawing_FontForm Indicates the pointer to an OH_Drawing_FontForm object. + * @param char An array of languages which indicate the language of character. + * @param int The array size of bcp47. + * @param int32_t A UTF8 value to be matched. + * @return Returns the pointer to the OH_Drawing_Typeface object matched. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr*, const char familyName[], + OH_Drawing_FontForm*, const char* bcp47[], int bcp47Count, int32_t character); + +#ifdef __cplusplus +} +#endif +/** @} */ +#endif diff --git a/graphic/graphic_2d/native_drawing/drawing_types.h b/graphic/graphic_2d/native_drawing/drawing_types.h index 23e50f38d..e77deef0c 100644 --- a/graphic/graphic_2d/native_drawing/drawing_types.h +++ b/graphic/graphic_2d/native_drawing/drawing_types.h @@ -400,6 +400,22 @@ typedef enum { TEXT_ENCODING_GLYPH_ID, } OH_Drawing_TextEncoding; +/** + * @brief Defines a OH_Drawing_FontMgr, which is used to manage font family. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_FontMgr OH_Drawing_FontMgr; + +/** + * @brief Defines a OH_Drawing_FontStyleSet, which is used to manage font style. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_FontStyleSet OH_Drawing_FontStyleSet; + #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 e076cd829..1010826b2 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -573,6 +573,46 @@ { "first_introduced": "12", "name": "OH_Drawing_SetTypographyTextFontHeight" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontMgrCreate" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontMgrDestroy" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontMgrGetFamiliesCount" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontMgrGetFamilyName" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_DestroyFamilyName" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontStyleSetCreate" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_DestroyFontStyleSet" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontMgrMatchFamily" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontMgrMatchFamilyStyle" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontMgrMatchFamilyStyleCharacter" } ] \ No newline at end of file -- Gitee From 7fdbacc7a96c16c0aa62af6a911fda5a5410bee3 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Mon, 11 Mar 2024 14:07:24 +0000 Subject: [PATCH 02/26] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_font_mgr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index 1dd86149d..e6ce52772 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -232,7 +232,7 @@ OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily(OH_Drawing_FontMgr*, cons * @since 12 * @version 1.0 */ -OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, const char* , OH_Drawing_FontForm*); +OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, const char*, OH_Drawing_FontForm*); /** * @brief Get the pointer to an OH_Drawing_Typeface object for the given character. -- Gitee From 74f38ec3d0e2d9a8de3ee37cb9dbf1493d3666a1 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Tue, 12 Mar 2024 09:05:09 +0000 Subject: [PATCH 03/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9Destroy=E5=8F=82?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_font_mgr.h | 2 +- graphic/graphic_2d/native_drawing/drawing_text_typography.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index e6ce52772..1f826df81 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -185,7 +185,7 @@ char* OH_Drawing_FontMgrGetFamilyName(OH_Drawing_FontMgr*, int, int*); * @since 12 * @version 1.0 */ -void OH_Drawing_DestroyFamilyName(char*); +void OH_Drawing_DestroyFamilyName(char**); /** * @brief Creates an OH_Drawing_FontStyleSet object by OH_Drawing_FontMgr object. diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 6899fed88..3e79e5907 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1233,7 +1233,7 @@ char** OH_Drawing_FontParserGetSystemFontList(OH_Drawing_FontParser*, size_t*); * @since 12 * @version 1.0 */ -void OH_Drawing_DestroySystemFontList(char**, size_t); +void OH_Drawing_DestroySystemFontList(char***, size_t); /** * @brief Gets information about the system font by font name. -- Gitee From 1820fd930e5a833039e18d26f5333bb374f8b464 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Wed, 13 Mar 2024 06:04:22 +0000 Subject: [PATCH 04/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9OH=5FDrawing=5FDestroyS?= =?UTF-8?q?ystemFontList=E6=B3=A8=E9=87=8A=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_text_typography.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 3e79e5907..a5ef10fd2 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1228,7 +1228,7 @@ char** OH_Drawing_FontParserGetSystemFontList(OH_Drawing_FontParser*, size_t*); * @brief Releases the memory occupied by a list of system font names. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param char** Indicates the pointer to a list of system font names. + * @param char Indicates the pointer to a list of system font names. * @param size_t The number of obtained system font names. * @since 12 * @version 1.0 @@ -1240,7 +1240,7 @@ void OH_Drawing_DestroySystemFontList(char***, size_t); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontParser Indicates the pointer to the font parser object OH_Drawing_FontParser. - * @param char** font name. + * @param char font name. * @return Returns system fonts information. * @since 12 * @version 1.0 -- Gitee From 39dbea883759704739d1679480e2abe25eb08724 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Wed, 13 Mar 2024 08:28:30 +0000 Subject: [PATCH 05/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_font_mgr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index 1f826df81..2a8850a7f 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023-2024 Huawei Device Co., Ltd. + * Copyright (c) 2024 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 @@ -249,7 +249,7 @@ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, con * @version 1.0 */ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr*, const char familyName[], - OH_Drawing_FontForm*, const char* bcp47[], int bcp47Count, int32_t character); + OH_Drawing_FontForm*, const char* bcp47[], int, int32_t); #ifdef __cplusplus } -- Gitee From 057f124fad45341aeb2ce5c1054f1ee8865353e5 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Sat, 16 Mar 2024 03:42:37 +0000 Subject: [PATCH 06/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9char***?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_drawing/drawing_font_mgr.h | 31 ++++++++++--------- .../native_drawing/drawing_text_typography.h | 2 +- .../graphic_2d/native_drawing/drawing_types.h | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index 2a8850a7f..bda800b21 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -169,13 +169,13 @@ int OH_Drawing_FontMgrGetFamiliesCount(OH_Drawing_FontMgr*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. - * @param int The index to get the font family name. - * @param int Used to return the size of the font family name array. + * @param index The index to get the font family name. + * @param len Used to return the size of the font family name array. * @return Returns the font family name corresponding to the index value. * @since 12 * @version 1.0 */ -char* OH_Drawing_FontMgrGetFamilyName(OH_Drawing_FontMgr*, int, int*); +char* OH_Drawing_FontMgrGetFamilyName(OH_Drawing_FontMgr*, int index, int* len); /** * @brief Releases the memory occupied by font family name. @@ -185,19 +185,19 @@ char* OH_Drawing_FontMgrGetFamilyName(OH_Drawing_FontMgr*, int, int*); * @since 12 * @version 1.0 */ -void OH_Drawing_DestroyFamilyName(char**); +void OH_Drawing_DestroyFamilyName(char* familyName); /** * @brief Creates an OH_Drawing_FontStyleSet object by OH_Drawing_FontMgr object. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. - * @param int The index used to get the font style set object from the font manager object. + * @param index The index used to get the font style set object from the font manager object. * @return Returns the pointer to the OH_Drawing_FontStyleSet object created. * @since 12 * @version 1.0 */ -OH_Drawing_FontStyleSet* OH_Drawing_FontStyleSetCreate(OH_Drawing_FontMgr*, int); +OH_Drawing_FontStyleSet* OH_Drawing_FontStyleSetCreate(OH_Drawing_FontMgr*, int index); /** * @brief Releases the memory occupied by an OH_Drawing_FontStyleSet object. @@ -214,42 +214,43 @@ void OH_Drawing_DestroyFontStyleSet(OH_Drawing_FontStyleSet*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. - * @param char The family name of a font style set to be matched. + * @param familyName The family name of a font style set to be matched. * @return Returns the pointer to the OH_Drawing_FontStyleSet object matched. * @since 12 * @version 1.0 */ -OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily(OH_Drawing_FontMgr*, const char*); +OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily(OH_Drawing_FontMgr*, const char* familyName); /** * @brief Get the pointer to an OH_Drawing_Typeface object based on the given font style and family name. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. - * @param char The family name of a font style set to be matched. + * @param familyName The family name of a font style set to be matched. * @param OH_Drawing_FontForm Indicates the pointer to an OH_Drawing_FontForm object. * @return Returns the pointer to the OH_Drawing_Typeface object matched. * @since 12 * @version 1.0 */ -OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, const char*, OH_Drawing_FontForm*); +OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, + const char* familyName, OH_Drawing_FontForm*); /** * @brief Get the pointer to an OH_Drawing_Typeface object for the given character. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. - * @param char The family name of a font style set to be matched. + * @param familyName The family name of a font style set to be matched. * @param OH_Drawing_FontForm Indicates the pointer to an OH_Drawing_FontForm object. - * @param char An array of languages which indicate the language of character. - * @param int The array size of bcp47. - * @param int32_t A UTF8 value to be matched. + * @param bcp47 An array of languages which indicate the language of character. + * @param bcp47Count The array size of bcp47. + * @param character A UTF8 value to be matched. * @return Returns the pointer to the OH_Drawing_Typeface object matched. * @since 12 * @version 1.0 */ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr*, const char familyName[], - OH_Drawing_FontForm*, const char* bcp47[], int, int32_t); + OH_Drawing_FontForm*, const char* bcp47[], int bcp47Count, int32_t character); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index a5ef10fd2..1d0c434cb 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1233,7 +1233,7 @@ char** OH_Drawing_FontParserGetSystemFontList(OH_Drawing_FontParser*, size_t*); * @since 12 * @version 1.0 */ -void OH_Drawing_DestroySystemFontList(char***, size_t); +void OH_Drawing_DestroySystemFontList(char**, size_t); /** * @brief Gets information about the system font by font name. diff --git a/graphic/graphic_2d/native_drawing/drawing_types.h b/graphic/graphic_2d/native_drawing/drawing_types.h index e77deef0c..869d73c9d 100644 --- a/graphic/graphic_2d/native_drawing/drawing_types.h +++ b/graphic/graphic_2d/native_drawing/drawing_types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 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 -- Gitee From f3ba7e39861d2f39d4345325f155cec723fc2c41 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Sat, 16 Mar 2024 07:07:33 +0000 Subject: [PATCH 07/26] =?UTF-8?q?update=20graphic/graphic=5F2d/native=5Fdr?= =?UTF-8?q?awing/drawing=5Ffont=5Fmgr.h.=20OH=5FDrawing=5FDestroyFamilyNam?= =?UTF-8?q?e=E4=BF=AE=E6=94=B9=E5=8F=82=E6=95=B0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_font_mgr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index bda800b21..c60de0f46 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -181,7 +181,7 @@ char* OH_Drawing_FontMgrGetFamilyName(OH_Drawing_FontMgr*, int index, int* len); * @brief Releases the memory occupied by font family name. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param char Font family name. + * @param familyName Font family name. * @since 12 * @version 1.0 */ -- Gitee From e5f46a5190f1f1e86f97c7fc12a9f8b829fde3fd Mon Sep 17 00:00:00 2001 From: changleipeng Date: Mon, 18 Mar 2024 06:42:54 +0000 Subject: [PATCH 08/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_drawing/drawing_font_mgr.h | 17 ++++++++--------- .../native_drawing/drawing_text_typography.h | 2 +- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index c60de0f46..db7cd31c2 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -169,19 +169,18 @@ int OH_Drawing_FontMgrGetFamiliesCount(OH_Drawing_FontMgr*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. - * @param index The index to get the font family name. - * @param len Used to return the size of the font family name array. + * @param index Indicates the index to get the font family name. * @return Returns the font family name corresponding to the index value. * @since 12 * @version 1.0 */ -char* OH_Drawing_FontMgrGetFamilyName(OH_Drawing_FontMgr*, int index, int* len); +char* OH_Drawing_FontMgrGetFamilyName(OH_Drawing_FontMgr*, int index); /** * @brief Releases the memory occupied by font family name. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param familyName Font family name. + * @param familyName Indicates the font family name. * @since 12 * @version 1.0 */ @@ -192,7 +191,7 @@ void OH_Drawing_DestroyFamilyName(char* familyName); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. - * @param index The index used to get the font style set object from the font manager object. + * @param index Indicates the index used to get the font style set object from the font manager object. * @return Returns the pointer to the OH_Drawing_FontStyleSet object created. * @since 12 * @version 1.0 @@ -214,7 +213,7 @@ void OH_Drawing_DestroyFontStyleSet(OH_Drawing_FontStyleSet*); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. - * @param familyName The family name of a font style set to be matched. + * @param familyName Indicates the family name of a font style set to be matched. * @return Returns the pointer to the OH_Drawing_FontStyleSet object matched. * @since 12 * @version 1.0 @@ -226,7 +225,7 @@ OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily(OH_Drawing_FontMgr*, cons * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. - * @param familyName The family name of a font style set to be matched. + * @param familyName Indicates the family name of a font style set to be matched. * @param OH_Drawing_FontForm Indicates the pointer to an OH_Drawing_FontForm object. * @return Returns the pointer to the OH_Drawing_Typeface object matched. * @since 12 @@ -240,7 +239,7 @@ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. - * @param familyName The family name of a font style set to be matched. + * @param familyName Indicates the family name of a font style set to be matched. * @param OH_Drawing_FontForm Indicates the pointer to an OH_Drawing_FontForm object. * @param bcp47 An array of languages which indicate the language of character. * @param bcp47Count The array size of bcp47. @@ -249,7 +248,7 @@ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, * @since 12 * @version 1.0 */ -OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr*, const char familyName[], +OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr*, const char* familyName, OH_Drawing_FontForm*, const char* bcp47[], int bcp47Count, int32_t character); #ifdef __cplusplus diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 1d0c434cb..6c0f1f090 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1240,7 +1240,7 @@ void OH_Drawing_DestroySystemFontList(char**, size_t); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontParser Indicates the pointer to the font parser object OH_Drawing_FontParser. - * @param char font name. + * @param char Indicates the font name. * @return Returns system fonts information. * @since 12 * @version 1.0 -- Gitee From 999752532ad93e44fa72695bb5d45dc3bd6e04c0 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Mon, 18 Mar 2024 07:19:55 +0000 Subject: [PATCH 09/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8C=85=E5=90=AB?= =?UTF-8?q?=E5=A4=9A=E4=BD=99=E5=A4=B4=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_font_mgr.h | 1 - 1 file changed, 1 deletion(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index db7cd31c2..2cb830246 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -39,7 +39,6 @@ #include "drawing_types.h" #include -#include #ifdef __cplusplus extern "C" { -- Gitee From 68b0a2985fae6b339151e7462e79c63829206816 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Mon, 18 Mar 2024 13:20:08 +0000 Subject: [PATCH 10/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=810318=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_font_mgr.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index 2cb830246..7812b5cdc 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -240,9 +240,9 @@ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. * @param familyName Indicates the family name of a font style set to be matched. * @param OH_Drawing_FontForm Indicates the pointer to an OH_Drawing_FontForm object. - * @param bcp47 An array of languages which indicate the language of character. - * @param bcp47Count The array size of bcp47. - * @param character A UTF8 value to be matched. + * @param bcp47 Indicates an array of languages which indicate the language of character. + * @param bcp47Count Indicates the array size of bcp47. + * @param character Indicates a UTF8 value to be matched. * @return Returns the pointer to the OH_Drawing_Typeface object matched. * @since 12 * @version 1.0 -- Gitee From 8a8642c520dfd734c428e2e3c12f1260519c904f Mon Sep 17 00:00:00 2001 From: changleipeng Date: Fri, 22 Mar 2024 06:20:34 +0000 Subject: [PATCH 11/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=810322?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_drawing/drawing_font_mgr.h | 30 +++++++++---------- .../native_drawing/drawing_text_typography.h | 4 +-- .../native_drawing/libnative_drawing.ndk.json | 4 +-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index 7812b5cdc..2966872f6 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -50,7 +50,7 @@ extern "C" { * @since 12 * @version 1.0 */ -enum OH_Drawing_FontFormWeight { +enum OH_Drawing_FontStyleWeight { /* Invisible font weight */ INVISIBLE_WEIGHT = 0, /* Thin font weight */ @@ -81,7 +81,7 @@ enum OH_Drawing_FontFormWeight { * @since 12 * @version 1.0 */ -enum OH_Drawing_FontFormWidth { +enum OH_Drawing_FontStyleWidth { /* Ultra condensed font width */ ULTRA_CONDENSED_WIDTH = 1, /* Extra condensed font width */ @@ -108,7 +108,7 @@ enum OH_Drawing_FontFormWidth { * @since 12 * @version 1.0 */ -enum OH_Drawing_FontFormSlant { +enum OH_Drawing_FontStyleSlant { /* Upright font slant */ UPRIGHT_SLANT, /* Italic font slant */ @@ -123,14 +123,14 @@ enum OH_Drawing_FontFormSlant { * @since 12 * @version 1.0 */ -typedef struct OH_Drawing_FontForm { +typedef struct OH_Drawing_FontStyleStruct { /** Font weight */ - OH_Drawing_FontFormWeight weight; + OH_Drawing_FontStyleWeight weight; /** Font width */ - OH_Drawing_FontFormWidth width; + OH_Drawing_FontStyleWidth width; /** Font slant */ - OH_Drawing_FontFormSlant slant; -} OH_Drawing_FontForm; + OH_Drawing_FontStyleSlant slant; +} OH_Drawing_FontStyleStruct; /** * @brief Creates an OH_Drawing_FontMgr object. @@ -164,7 +164,7 @@ void OH_Drawing_FontMgrDestroy(OH_Drawing_FontMgr*); int OH_Drawing_FontMgrGetFamiliesCount(OH_Drawing_FontMgr*); /** - * @brief Gets the font family name from the index. + * @brief Gets the font family name by the index. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. @@ -195,7 +195,7 @@ void OH_Drawing_DestroyFamilyName(char* familyName); * @since 12 * @version 1.0 */ -OH_Drawing_FontStyleSet* OH_Drawing_FontStyleSetCreate(OH_Drawing_FontMgr*, int index); +OH_Drawing_FontStyleSet* OH_Drawing_FontMgrCreateFontStyleSet(OH_Drawing_FontMgr*, int index); /** * @brief Releases the memory occupied by an OH_Drawing_FontStyleSet object. @@ -205,7 +205,7 @@ OH_Drawing_FontStyleSet* OH_Drawing_FontStyleSetCreate(OH_Drawing_FontMgr*, int * @since 12 * @version 1.0 */ -void OH_Drawing_DestroyFontStyleSet(OH_Drawing_FontStyleSet*); +void OH_Drawing_FontMgrDestroyFontStyleSet(OH_Drawing_FontStyleSet*); /** * @brief Get the pointer to an OH_Drawing_FontStyleSet object for the given font style set family name. @@ -225,13 +225,13 @@ OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily(OH_Drawing_FontMgr*, cons * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. * @param familyName Indicates the family name of a font style set to be matched. - * @param OH_Drawing_FontForm Indicates the pointer to an OH_Drawing_FontForm object. + * @param OH_Drawing_FontStyleStruct Indicates the pointer to an OH_Drawing_FontStyleStruct object. * @return Returns the pointer to the OH_Drawing_Typeface object matched. * @since 12 * @version 1.0 */ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, - const char* familyName, OH_Drawing_FontForm*); + const char* familyName, OH_Drawing_FontStyleStruct*); /** * @brief Get the pointer to an OH_Drawing_Typeface object for the given character. @@ -239,7 +239,7 @@ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. * @param familyName Indicates the family name of a font style set to be matched. - * @param OH_Drawing_FontForm Indicates the pointer to an OH_Drawing_FontForm object. + * @param OH_Drawing_FontStyleStruct Indicates the pointer to an OH_Drawing_FontStyleStruct object. * @param bcp47 Indicates an array of languages which indicate the language of character. * @param bcp47Count Indicates the array size of bcp47. * @param character Indicates a UTF8 value to be matched. @@ -248,7 +248,7 @@ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, * @version 1.0 */ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr*, const char* familyName, - OH_Drawing_FontForm*, const char* bcp47[], int bcp47Count, int32_t character); + OH_Drawing_FontStyleStruct*, const char* bcp47[], int bcp47Count, int32_t character); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 6c0f1f090..6899fed88 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1228,7 +1228,7 @@ char** OH_Drawing_FontParserGetSystemFontList(OH_Drawing_FontParser*, size_t*); * @brief Releases the memory occupied by a list of system font names. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing - * @param char Indicates the pointer to a list of system font names. + * @param char** Indicates the pointer to a list of system font names. * @param size_t The number of obtained system font names. * @since 12 * @version 1.0 @@ -1240,7 +1240,7 @@ void OH_Drawing_DestroySystemFontList(char**, size_t); * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontParser Indicates the pointer to the font parser object OH_Drawing_FontParser. - * @param char Indicates the font name. + * @param char** font name. * @return Returns system fonts information. * @since 12 * @version 1.0 diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index ab94e90d0..fb09bf106 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -608,11 +608,11 @@ }, { "first_introduced": "12", - "name": "OH_Drawing_FontStyleSetCreate" + "name": "OH_Drawing_FontMgrCreateFontStyleSet" }, { "first_introduced": "12", - "name": "OH_Drawing_DestroyFontStyleSet" + "name": "OH_Drawing_FontMgrDestroyFontStyleSet" }, { "first_introduced": "12", -- Gitee From bcdd9d5d607f4187e66298407168160fb56bf483 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Sun, 24 Mar 2024 08:51:26 +0000 Subject: [PATCH 12/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_font_mgr.h | 2 +- graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index 2966872f6..f632aa52f 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -183,7 +183,7 @@ char* OH_Drawing_FontMgrGetFamilyName(OH_Drawing_FontMgr*, int index); * @since 12 * @version 1.0 */ -void OH_Drawing_DestroyFamilyName(char* familyName); +void OH_Drawing_FontMgrDestroyFamilyName(char* familyName); /** * @brief Creates an OH_Drawing_FontStyleSet object by OH_Drawing_FontMgr object. diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index fb09bf106..8f656f68b 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -604,7 +604,7 @@ }, { "first_introduced": "12", - "name": "OH_Drawing_DestroyFamilyName" + "name": "OH_Drawing_FontMgrDestroyFamilyName" }, { "first_introduced": "12", -- Gitee From 1e0acab1e743848de86b4173894a6a2c1c7fcc27 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Tue, 26 Mar 2024 07:04:24 +0000 Subject: [PATCH 13/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9OH=5FDrawing=5FFontMgrG?= =?UTF-8?q?etFamiliesCount?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_font_mgr.h | 2 +- graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index f632aa52f..ff0f72862 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -161,7 +161,7 @@ void OH_Drawing_FontMgrDestroy(OH_Drawing_FontMgr*); * @since 12 * @version 1.0 */ -int OH_Drawing_FontMgrGetFamiliesCount(OH_Drawing_FontMgr*); +int OH_Drawing_FontMgrGetFamilyCount(OH_Drawing_FontMgr*); /** * @brief Gets the font family name by the index. diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 8f656f68b..8074dbaf6 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -596,7 +596,7 @@ }, { "first_introduced": "12", - "name": "OH_Drawing_FontMgrGetFamiliesCount" + "name": "OH_Drawing_FontMgrGetFamilyCount" }, { "first_introduced": "12", -- Gitee From 24fdecc2b8a8129878b766196fba1e6cf286da8f Mon Sep 17 00:00:00 2001 From: changleipeng Date: Tue, 26 Mar 2024 07:51:52 +0000 Subject: [PATCH 14/26] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_drawing/drawing_font_mgr.h | 89 +----------------- .../native_drawing/drawing_text_typography.h | 91 +++++++++++++++++++ .../native_drawing/libnative_drawing.ndk.json | 16 ++++ 3 files changed, 108 insertions(+), 88 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index ff0f72862..4803f738b 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -38,100 +38,13 @@ */ #include "drawing_types.h" +#include "drawing_text_typography.h" #include #ifdef __cplusplus extern "C" { #endif -/** - * @brief Enumerates font weight. - * - * @since 12 - * @version 1.0 - */ -enum OH_Drawing_FontStyleWeight { - /* Invisible font weight */ - INVISIBLE_WEIGHT = 0, - /* Thin font weight */ - THIN_WEIGHT = 100, - /* Extra light font weight */ - EXTRA_LIGHT_WEIGHT = 200, - /* Light font weight */ - LIGHT_WEIGHT = 300, - /* Normal font weight */ - NORMAL_WEIGHT = 400, - /* Medium font weight */ - MEDIUM_WEIGHT = 500, - /* Semi blod font weight */ - SEMI_BOLD_WEIGHT = 600, - /* Blod font weight */ - BOLD_WEIGHT = 700, - /* Extra blod font weight */ - EXTRA_BOLD_WEIGHT = 800, - /* Black font weight */ - BLACK_WEIGHT = 900, - /* Extra black font weight */ - EXTRA_BLACK_WEIGHT = 1000, -}; - -/** - * @brief Enumerates font width. - * - * @since 12 - * @version 1.0 - */ -enum OH_Drawing_FontStyleWidth { - /* Ultra condensed font width */ - ULTRA_CONDENSED_WIDTH = 1, - /* Extra condensed font width */ - EXTRA_CONDENSED_WIDTH = 2, - /* condensed font width */ - CONDENSED_WIDTH = 3, - /* Semi condensed font width */ - SEMI_CONDENSED_WIDTH = 4, - /* Normal font width */ - NORMAL_WIDTH = 5, - /* Semi expanded font width */ - SEMI_EXPANDED_WIDTH = 6, - /* Expanded font width */ - EXPANDED_WIDTH = 7, - /* Extra expanded font width */ - EXTRA_EXPANDED_WIDTH = 8, - /* Ultra expanded font width */ - ULTRA_EXPANDED_WIDTH = 9, -}; - -/** - * @brief Enumerates font slant. - * - * @since 12 - * @version 1.0 - */ -enum OH_Drawing_FontStyleSlant { - /* Upright font slant */ - UPRIGHT_SLANT, - /* Italic font slant */ - ITALIC_SLANT, - /* Oblique font slant */ - OBLIQUE_SLANT, -}; - -/** - * @brief Defines the font form. - * - * @since 12 - * @version 1.0 - */ -typedef struct OH_Drawing_FontStyleStruct { - /** Font weight */ - OH_Drawing_FontStyleWeight weight; - /** Font width */ - OH_Drawing_FontStyleWidth width; - /** Font slant */ - OH_Drawing_FontStyleSlant slant; -} OH_Drawing_FontStyleStruct; - /** * @brief Creates an OH_Drawing_FontMgr object. * diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 6899fed88..4554f099a 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -353,6 +353,48 @@ typedef struct OH_Drawing_LineMetrics { OH_Drawing_Font_Metrics firstCharMetrics; } OH_Drawing_LineMetrics; +/** + * @brief Enumerates font width. + * + * @since 12 + * @version 1.0 + */ +enum OH_Drawing_FontWidth { + /* Ultra condensed font width */ + FONT_WIDTH_ULTRA_CONDENSED = 1, + /* Extra condensed font width */ + FONT_WIDTH_EXTRA_CONDENSED = 2, + /* condensed font width */ + FONT_WIDTH_CONDENSED = 3, + /* Semi condensed font width */ + FONT_WIDTH_SEMI_CONDENSED = 4, + /* Normal font width */ + FONT_WIDTH_NORMAL = 5, + /* Semi expanded font width */ + FONT_WIDTH_SEMI_EXPANDED = 6, + /* Expanded font width */ + FONT_WIDTH_EXPANDED = 7, + /* Extra expanded font width */ + FONT_WIDTH_EXTRA_EXPANDED = 8, + /* Ultra expanded font width */ + FONT_WIDTH_ULTRA_EXPANDED = 9, +}; + +/** + * @brief Defines the font style struct. + * + * @since 12 + * @version 1.0 + */ +typedef struct OH_Drawing_FontStyleStruct { + /** Font weight */ + OH_Drawing_FontWeight weight; + /** Font width */ + OH_Drawing_FontWidth width; + /** Font slant */ + OH_Drawing_FontStyle slant; +} OH_Drawing_FontStyleStruct; + /** * @brief Creates an OH_Drawing_TypographyStyle object. * @@ -1684,6 +1726,55 @@ float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography*, int); */ void OH_Drawing_DestroyTextShadows(OH_Drawing_TextShadow*); + +/** + * @brief Sets the text style, including font weight, font width and font slant. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param OH_Drawing_FontStyleStruct Indicates an OH_Drawing_FontStyleStruct object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTextStyleFontStyleStruct(OH_Drawing_TextStyle* drawingTextStyle, + OH_Drawing_FontStyleStruct fontStyle); + +/** + * @brief Gets the text style, including font weight, font width and font slant. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @param OH_Drawing_FontStyleStruct Indicates the pointer to an OH_Drawing_FontStyleStruct object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleGetFontStyleStruct(OH_Drawing_TextStyle* drawingTextStyle, + OH_Drawing_FontStyleStruct* fontStyle); + +/** + * @brief Sets the typography style, including font weight, font width and font slant. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param OH_Drawing_FontStyleStruct Indicates an OH_Drawing_FontStyleStruct object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_SetTypographyStyleFontStyleStruct(OH_Drawing_TypographyStyle* drawingStyle, + OH_Drawing_FontStyleStruct fontStyle); + +/** + * @brief Gets the typography style, including font weight, font width and font slant. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @param OH_Drawing_FontStyleStruct Indicates the pointer to an OH_Drawing_FontStyleStruct object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TypographyStyleGetFontStyleStruct(OH_Drawing_TypographyStyle* drawingStyle, + OH_Drawing_FontStyleStruct* fontStyle); + #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 8074dbaf6..502876153 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -625,6 +625,22 @@ { "first_introduced": "12", "name": "OH_Drawing_FontMgrMatchFamilyStyleCharacter" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTextStyleFontStyleStruct" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleGetFontStyleStruct" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_SetTypographyStyleFontStyleStruct" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyStyleGetFontStyleStruct" } ] \ No newline at end of file -- Gitee From bacaca9ef668c8f355f6914d390e9fb3f8929162 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Tue, 26 Mar 2024 07:56:26 +0000 Subject: [PATCH 15/26] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_text_typography.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 4554f099a..dce51480d 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -147,6 +147,8 @@ enum OH_Drawing_FontStyle { FONT_STYLE_NORMAL, /** Italic style */ FONT_STYLE_ITALIC, + /** Oblique style */ + FONT_STYLE_OBLIQUE, }; /** -- Gitee From 27601d98e13eb93342021d9edfb9bf73ef595799 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Tue, 26 Mar 2024 08:05:33 +0000 Subject: [PATCH 16/26] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=A9=BA=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_text_typography.h | 1 - 1 file changed, 1 deletion(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index dce51480d..55aca3992 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1728,7 +1728,6 @@ float OH_Drawing_TypographyGetIndentsWithIndex(OH_Drawing_Typography*, int); */ void OH_Drawing_DestroyTextShadows(OH_Drawing_TextShadow*); - /** * @brief Sets the text style, including font weight, font width and font slant. * -- Gitee From b0d017b4ea27720097c25767b96bacd411dc0c00 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Thu, 28 Mar 2024 09:23:31 +0000 Subject: [PATCH 17/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9fontStyleStruct?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_font_mgr.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index 4803f738b..56e436e4e 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -138,13 +138,13 @@ OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily(OH_Drawing_FontMgr*, cons * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. * @param familyName Indicates the family name of a font style set to be matched. - * @param OH_Drawing_FontStyleStruct Indicates the pointer to an OH_Drawing_FontStyleStruct object. + * @param OH_Drawing_FontStyleStruct Indicates an OH_Drawing_FontStyleStruct object. * @return Returns the pointer to the OH_Drawing_Typeface object matched. * @since 12 * @version 1.0 */ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, - const char* familyName, OH_Drawing_FontStyleStruct*); + const char* familyName, OH_Drawing_FontStyleStruct); /** * @brief Get the pointer to an OH_Drawing_Typeface object for the given character. @@ -152,7 +152,7 @@ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_FontMgr Indicates the pointer to an OH_Drawing_FontMgr object. * @param familyName Indicates the family name of a font style set to be matched. - * @param OH_Drawing_FontStyleStruct Indicates the pointer to an OH_Drawing_FontStyleStruct object. + * @param OH_Drawing_FontStyleStruct Indicates an OH_Drawing_FontStyleStruct object. * @param bcp47 Indicates an array of languages which indicate the language of character. * @param bcp47Count Indicates the array size of bcp47. * @param character Indicates a UTF8 value to be matched. @@ -161,7 +161,7 @@ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, * @version 1.0 */ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr*, const char* familyName, - OH_Drawing_FontStyleStruct*, const char* bcp47[], int bcp47Count, int32_t character); + OH_Drawing_FontStyleStruct, const char* bcp47[], int bcp47Count, int32_t character); #ifdef __cplusplus } -- Gitee From 51311c513dc7d3c7c127189d1731020f2cfa1f20 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Thu, 28 Mar 2024 09:57:58 +0000 Subject: [PATCH 18/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_font_mgr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index 56e436e4e..5b48b7bbe 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -144,7 +144,7 @@ OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily(OH_Drawing_FontMgr*, cons * @version 1.0 */ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, - const char* familyName, OH_Drawing_FontStyleStruct); + const char* familyName, OH_Drawing_FontStyleStruct struct); /** * @brief Get the pointer to an OH_Drawing_Typeface object for the given character. @@ -161,7 +161,7 @@ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, * @version 1.0 */ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr*, const char* familyName, - OH_Drawing_FontStyleStruct, const char* bcp47[], int bcp47Count, int32_t character); + OH_Drawing_FontStyleStruct struct, const char* bcp47[], int bcp47Count, int32_t character); #ifdef __cplusplus } -- Gitee From e844c801a3154054f0143b88b8fede66b8b1d0f5 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Thu, 28 Mar 2024 09:59:45 +0000 Subject: [PATCH 19/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81=20=E4=BF=AE=E6=94=B9=E5=BD=A2=E5=8F=82?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_font_mgr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index 5b48b7bbe..8b4c29344 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -144,7 +144,7 @@ OH_Drawing_FontStyleSet* OH_Drawing_FontMgrMatchFamily(OH_Drawing_FontMgr*, cons * @version 1.0 */ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, - const char* familyName, OH_Drawing_FontStyleStruct struct); + const char* familyName, OH_Drawing_FontStyleStruct fontStyle); /** * @brief Get the pointer to an OH_Drawing_Typeface object for the given character. @@ -161,7 +161,7 @@ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, * @version 1.0 */ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr*, const char* familyName, - OH_Drawing_FontStyleStruct struct, const char* bcp47[], int bcp47Count, int32_t character); + OH_Drawing_FontStyleStruct fontStyle, const char* bcp47[], int bcp47Count, int32_t character); #ifdef __cplusplus } -- Gitee From a45a59abf4a1c0896cb8b40f74e3573f48f98158 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Thu, 28 Mar 2024 11:56:34 +0000 Subject: [PATCH 20/26] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A3=80=E8=A7=86?= =?UTF-8?q?=E6=84=8F=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_drawing/drawing_text_typography.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 55aca3992..c8b4716a5 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1745,12 +1745,11 @@ void OH_Drawing_SetTextStyleFontStyleStruct(OH_Drawing_TextStyle* drawingTextSty * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. - * @param OH_Drawing_FontStyleStruct Indicates the pointer to an OH_Drawing_FontStyleStruct object. + * @return Returns the OH_Drawing_FontStyleStruct object getted. * @since 12 * @version 1.0 */ -void OH_Drawing_TextStyleGetFontStyleStruct(OH_Drawing_TextStyle* drawingTextStyle, - OH_Drawing_FontStyleStruct* fontStyle); +OH_Drawing_FontStyleStruct OH_Drawing_TextStyleGetFontStyleStruct(OH_Drawing_TextStyle* drawingTextStyle); /** * @brief Sets the typography style, including font weight, font width and font slant. @@ -1769,12 +1768,11 @@ void OH_Drawing_SetTypographyStyleFontStyleStruct(OH_Drawing_TypographyStyle* dr * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. - * @param OH_Drawing_FontStyleStruct Indicates the pointer to an OH_Drawing_FontStyleStruct object. + * @return Returns the OH_Drawing_FontStyleStruct object getted. * @since 12 * @version 1.0 */ -void OH_Drawing_TypographyStyleGetFontStyleStruct(OH_Drawing_TypographyStyle* drawingStyle, - OH_Drawing_FontStyleStruct* fontStyle); +OH_Drawing_FontStyleStruct OH_Drawing_TypographyStyleGetFontStyleStruct(OH_Drawing_TypographyStyle* drawingStyle); #ifdef __cplusplus } -- Gitee From df4724361810b03e9a3ff48d9237977221f7b555 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Thu, 28 Mar 2024 13:51:09 +0000 Subject: [PATCH 21/26] =?UTF-8?q?update=20graphic/graphic=5F2d/native=5Fdr?= =?UTF-8?q?awing/drawing=5Ffont=5Fmgr.h.=20=E5=90=88=E5=B9=B6449=E5=88=B04?= =?UTF-8?q?05?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_drawing/drawing_font_mgr.h | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h index 8b4c29344..47f862f1a 100755 --- a/graphic/graphic_2d/native_drawing/drawing_font_mgr.h +++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h @@ -163,6 +163,66 @@ OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyle(OH_Drawing_FontMgr*, OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr*, const char* familyName, OH_Drawing_FontStyleStruct fontStyle, const char* bcp47[], int bcp47Count, int32_t character); +/** + * @brief Create a typeface for the given index. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontStyleSet Indicates the pointer to an OH_Drawing_FontStyleSet object. + * @param index Indicates the index of the typeface in this fontStyleSet. + * @return If successful, return a pointer to OH_Drawing_Typeface object; if failed, return nullptr. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Typeface* OH_Drawing_FontStyleSetCreateTypeface(OH_Drawing_FontStyleSet*, int index); + + /** + * @brief Get font style for the specified typeface. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontStyleSet Indicates the pointer to an OH_Drawing_FontStyleSet object. + * @param index Indicates the index of the typeface in this fontStyleSet. + * @param styleName Indicates the style name returned. + * @return Return the OH_Drawing_FontStyleStruct structure. + * @since 12 + * @version 1.0 + */ +OH_Drawing_FontStyleStruct OH_Drawing_FontStyleSetGetStyle(OH_Drawing_FontStyleSet*, int32_t index, + char** styleName); + + /** + * @brief Releases the memory styleName string. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param styleName Indicates the pointer to a string type. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_FontStyleSetFreeStyleName(char** styleName); + +/** + * @brief Get the closest matching typeface. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontStyleSet Indicates the pointer to an OH_Drawing_FontStyleSet object. + * @param fontStyleStruct Indicates the OH_Drawing_FontStyleStruct structure. + * @return A pointer to matched OH_Drawing_Typeface. + * @since 12 + * @version 1.0 + */ +OH_Drawing_Typeface* OH_Drawing_FontStyleSetMatchStyle(OH_Drawing_FontStyleSet*, + OH_Drawing_FontStyleStruct fontStyleStruct); + +/** + * @brief Get the count of typeface. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_FontStyleSet Indicates the pointer to an OH_Drawing_FontStyleSet object. + * @return The count of typeface in this font style set. + * @since 12 + * @version 1.0 + */ +int OH_Drawing_FontStyleSetCount(OH_Drawing_FontStyleSet*); + #ifdef __cplusplus } #endif -- Gitee From 20ecd55fafb00187ad2397105e68786dede046d2 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Thu, 28 Mar 2024 13:53:15 +0000 Subject: [PATCH 22/26] =?UTF-8?q?update=20graphic/graphic=5F2d/native=5Fdr?= =?UTF-8?q?awing/drawing=5Ftext=5Ftypography.h.=20=E5=90=88=E5=B9=B6449?= =?UTF-8?q?=E5=88=B0405?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_drawing/drawing_text_typography.h | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 3c156068e..cbf3e5158 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -355,6 +355,33 @@ typedef struct OH_Drawing_LineMetrics { OH_Drawing_Font_Metrics firstCharMetrics; } OH_Drawing_LineMetrics; +/** + * @brief Enumerates text style type. + * + * @since 12 + * @version 1.0 + */ +enum OH_Drawing_TextStyleType { + /** None style */ + TextStyle_NONE, + /** All attributes style */ + TextStyle_ALL_ATTRIBUTES, + /** Font style */ + TextStyle_FONT, + /** Foreground style */ + TextStyle_FOREGROUND, + /** Background style */ + TextStyle_BACKGROUND, + /** Shadow style */ + TextStyle_SHADOW, + /** Decorations style */ + TextStyle_DECORATIONS, + /** Letter spacing style */ + TextStyle_LETTER_SPACING, + /** Word spacing style */ + TextStyle_WORD_SPACING +}; + /** * @brief Enumerates font width. * @@ -2031,6 +2058,87 @@ bool OH_Drawing_TextStyleGetHalfLeading(OH_Drawing_TextStyle*); */ const char* OH_Drawing_TextStyleGetLocale(OH_Drawing_TextStyle*); +/** + * @brief Gets whether the two TextStyle objects are equal. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param style Indicates source of comparison OH_Drawing_TextStyle object. + * @param comparedStyle Indicates comparison OH_Drawing_TextStyle object. + * @return Compare result. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TextStyleIsEquals(const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle); + +/** + * @brief Gets whether the font properties of two TextStyle objects are equal. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param style Indicates source of comparison OH_Drawing_TextStyle object. + * @param comparedStyle Indicates comparison OH_Drawing_TextStyle object. + * @return Compare result. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TextStyleIsEqualsByFonts(const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle); + +/** + * @brief Gets whether two TextStyle objects match attributes + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param textStyleType Indicates enumerates of text style type. + * @param style Indicates source of comparison OH_Drawing_TextStyle object. + * @param comparedStyle Indicates comparison OH_Drawing_TextStyle object. + * @return Match attributes result. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TextStyleIsMatchOneAttribute(const OH_Drawing_TextStyle* style, + const OH_Drawing_TextStyle* comparedStyle, OH_Drawing_TextStyleType textStyleType); + +/** + * @brief Set placeholder of TextStyle. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @since 12 + * @version 1.0 + */ +void OH_Drawing_TextStyleSetPlaceholder(OH_Drawing_TextStyle* style); + +/** + * @brief Gets whether placeholder is enable. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object. + * @return Whether placeholder is enable. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TextStyleIsPlaceholder(OH_Drawing_TextStyle* style); + +/** + * @brief Gets text alignment mode. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @return Returns text alignment mode. + * @since 12 + * @version 1.0 + */ +OH_Drawing_TextAlign OH_Drawing_TypographyStyleGetEffectiveAlignment(OH_Drawing_TypographyStyle* style); + +/** + * @brief Gets whether the hinting is enabled. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object. + * @return True, if the hinting takes effect; False, if the hinting does not take effect. + * @since 12 + * @version 1.0 + */ +bool OH_Drawing_TypographyStyleIsHintingEnabled(OH_Drawing_TypographyStyle* style); + #ifdef __cplusplus } #endif -- Gitee From b9bddcc491ad04b18ed46ac8dd918ccc8dd847b1 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Thu, 28 Mar 2024 13:54:31 +0000 Subject: [PATCH 23/26] =?UTF-8?q?update=20graphic/graphic=5F2d/native=5Fdr?= =?UTF-8?q?awing/libnative=5Fdrawing.ndk.json.=20=E5=90=88=E5=B9=B6449?= =?UTF-8?q?=E5=88=B0405?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_drawing/libnative_drawing.ndk.json | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 8039868d7..0c73f1b1c 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -953,5 +953,53 @@ { "first_introduced": "12", "name": "OH_Drawing_TextStyleGetLocale" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleIsEquals" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleIsEqualsByFonts" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleIsMatchOneAttribute" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleSetPlaceholder" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TextStyleIsPlaceholder" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyStyleGetEffectiveAlignment" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_TypographyStyleIsHintingEnabled" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontStyleSetCreateTypeface" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontStyleSetGetStyle" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontStyleSetFreeStyleName" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontStyleSetMatchStyle" + }, + { + "first_introduced": "12", + "name": "OH_Drawing_FontStyleSetCount" } ] \ No newline at end of file -- Gitee From 971991bd13f21a62fd191fe2052a9cc1ceec9d54 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Fri, 29 Mar 2024 02:15:57 +0000 Subject: [PATCH 24/26] =?UTF-8?q?=E5=87=BD=E6=95=B0=E5=90=8D=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../graphic_2d/native_drawing/drawing_text_typography.h | 8 ++++---- .../graphic_2d/native_drawing/libnative_drawing.ndk.json | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index cbf3e5158..5a814cabc 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -2068,7 +2068,7 @@ const char* OH_Drawing_TextStyleGetLocale(OH_Drawing_TextStyle*); * @since 12 * @version 1.0 */ -bool OH_Drawing_TextStyleIsEquals(const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle); +bool OH_Drawing_TextStyleIsEqual(const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle); /** * @brief Gets whether the font properties of two TextStyle objects are equal. @@ -2080,7 +2080,7 @@ bool OH_Drawing_TextStyleIsEquals(const OH_Drawing_TextStyle* style, const OH_Dr * @since 12 * @version 1.0 */ -bool OH_Drawing_TextStyleIsEqualsByFonts(const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle); +bool OH_Drawing_TextStyleIsEqualByFont(const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle); /** * @brief Gets whether two TextStyle objects match attributes @@ -2093,7 +2093,7 @@ bool OH_Drawing_TextStyleIsEqualsByFonts(const OH_Drawing_TextStyle* style, cons * @since 12 * @version 1.0 */ -bool OH_Drawing_TextStyleIsMatchOneAttribute(const OH_Drawing_TextStyle* style, +bool OH_Drawing_TextStyleIsAttributeMatched(const OH_Drawing_TextStyle* style, const OH_Drawing_TextStyle* comparedStyle, OH_Drawing_TextStyleType textStyleType); /** @@ -2137,7 +2137,7 @@ OH_Drawing_TextAlign OH_Drawing_TypographyStyleGetEffectiveAlignment(OH_Drawing_ * @since 12 * @version 1.0 */ -bool OH_Drawing_TypographyStyleIsHintingEnabled(OH_Drawing_TypographyStyle* style); +bool OH_Drawing_TypographyStyleIsHintEnabled(OH_Drawing_TypographyStyle* style); #ifdef __cplusplus } diff --git a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json index 0c73f1b1c..f8858036f 100644 --- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json +++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json @@ -956,15 +956,15 @@ }, { "first_introduced": "12", - "name": "OH_Drawing_TextStyleIsEquals" + "name": "OH_Drawing_TextStyleIsEqual" }, { "first_introduced": "12", - "name": "OH_Drawing_TextStyleIsEqualsByFonts" + "name": "OH_Drawing_TextStyleIsEqualByFont" }, { "first_introduced": "12", - "name": "OH_Drawing_TextStyleIsMatchOneAttribute" + "name": "OH_Drawing_TextStyleIsAttributeMatched" }, { "first_introduced": "12", @@ -980,7 +980,7 @@ }, { "first_introduced": "12", - "name": "OH_Drawing_TypographyStyleIsHintingEnabled" + "name": "OH_Drawing_TypographyStyleIsHintEnabled" }, { "first_introduced": "12", -- Gitee From b53ab8504dcc1399191959874a02c3ffa1bb520d Mon Sep 17 00:00:00 2001 From: changleipeng Date: Fri, 29 Mar 2024 04:59:28 +0000 Subject: [PATCH 25/26] =?UTF-8?q?=E6=9E=9A=E4=B8=BE=E5=91=BD=E5=90=8D?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: changleipeng --- .../native_drawing/drawing_text_typography.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index 5a814cabc..bf0c4f154 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -363,23 +363,23 @@ typedef struct OH_Drawing_LineMetrics { */ enum OH_Drawing_TextStyleType { /** None style */ - TextStyle_NONE, + TEXT_STYLE_NONE, /** All attributes style */ - TextStyle_ALL_ATTRIBUTES, + TEXT_STYLE_ALL_ATTRIBUTES, /** Font style */ - TextStyle_FONT, + TEXT_STYLE_FONT, /** Foreground style */ - TextStyle_FOREGROUND, + TEXT_STYLE_FOREGROUND, /** Background style */ - TextStyle_BACKGROUND, + TEXT_STYLE_BACKGROUND, /** Shadow style */ - TextStyle_SHADOW, + TEXT_STYLE_SHADOW, /** Decorations style */ - TextStyle_DECORATIONS, + TEXT_STYLE_DECORATIONS, /** Letter spacing style */ - TextStyle_LETTER_SPACING, + TEXT_STYLE_LETTER_SPACING, /** Word spacing style */ - TextStyle_WORD_SPACING + TEXT_STYLE_WORD_SPACING }; /** -- Gitee From 8fbb5b1a136291a4d1e7365e6ccb6a29491c5e94 Mon Sep 17 00:00:00 2001 From: changleipeng Date: Fri, 29 Mar 2024 07:27:16 +0000 Subject: [PATCH 26/26] update graphic/graphic_2d/native_drawing/drawing_text_typography.h. Signed-off-by: changleipeng --- graphic/graphic_2d/native_drawing/drawing_text_typography.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h index bf0c4f154..8ea9f2ce7 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_typography.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_typography.h @@ -1813,6 +1813,8 @@ void OH_Drawing_SetTypographyStyleFontStyleStruct(OH_Drawing_TypographyStyle* dr * @version 1.0 */ OH_Drawing_FontStyleStruct OH_Drawing_TypographyStyleGetFontStyleStruct(OH_Drawing_TypographyStyle* drawingStyle); + +/** * @brief Set struct of background rect and styleId of text. * * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing -- Gitee