diff --git a/graphic/graphic_2d/native_drawing/BUILD.gn b/graphic/graphic_2d/native_drawing/BUILD.gn
index 493714389d583170be15b669eb4cfd18f066c806..89df5755086698d1f8175411af6930b78bf9c126 100644
--- a/graphic/graphic_2d/native_drawing/BUILD.gn
+++ b/graphic/graphic_2d/native_drawing/BUILD.gn
@@ -26,6 +26,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",
@@ -64,6 +65,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 100644
index 0000000000000000000000000000000000000000..a64992dff42358913be4da724611b433fa618557
--- /dev/null
+++ b/graphic/graphic_2d/native_drawing/drawing_font_mgr.h
@@ -0,0 +1,170 @@
+/*
+ * 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
+ *
+ * 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 "drawing_text_typography.h"
+#include
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @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_FontMgrGetFamilyCount(OH_Drawing_FontMgr*);
+
+/**
+ * @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.
+ * @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);
+
+/**
+ * @brief Releases the memory occupied by font family name.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param familyName Indicates the font family name.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_FontMgrDestroyFamilyName(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 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
+ */
+OH_Drawing_FontStyleSet* OH_Drawing_FontMgrCreateFontStyleSet(OH_Drawing_FontMgr*, int index);
+
+/**
+ * @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_FontMgrDestroyFontStyleSet(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 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
+ */
+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 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.
+ * @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*);
+
+/**
+ * @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 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 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
+ */
+OH_Drawing_Typeface* OH_Drawing_FontMgrMatchFamilyStyleCharacter(OH_Drawing_FontMgr*, const char* familyName,
+ OH_Drawing_FontStyleStruct*, const char* bcp47[], int bcp47Count, int32_t character);
+
+#ifdef __cplusplus
+}
+#endif
+/** @} */
+#endif
\ No newline at end of file
diff --git a/graphic/graphic_2d/native_drawing/drawing_text_typography.h b/graphic/graphic_2d/native_drawing/drawing_text_typography.h
index 90c0ebb964acfeefceb261dc2d170995ffbbd781..652d07ff29be7dbeeda2ee158ca95a3c2ef4aa75 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,
};
/**
@@ -366,6 +368,186 @@ typedef struct {
int value;
} OH_Drawing_FontFeature;
+/**
+ * @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 Enumerates of heightmode of text.
+ *
+ * @since 12
+ * @version 1.0
+ */
+enum OH_Drawing_TextHeightBehavior {
+ /** both ascend of first row and last row style */
+ TEXT_HEIGHT_ALL = 0x0,
+ /** forbidding ascend of first row style*/
+ TEXT_HEIGHT_DISABLE_FIRST_ASCENT = 0x1,
+ /** forbidding ascend of last row style */
+ TEXT_HEIGHT_DISABLE_LAST_ASCENT = 0x2,
+ /** neither ascend of first row nor last row style */
+ TEXT_HEIGHT_DISABLE_ALL = 0x1 | 0x2,
+};
+
+/**
+ * @brief Gets system font configuration information list result enum.
+ *
+ * @since 12
+ * @version 1.0
+ */
+enum OH_Drawing_FontConfigInfoErrorCode {
+ /** The list of system font configuration information was successfully obtained */
+ OK = 0,
+ /** Unknown error */
+ UNKNOWN_ERROR = 1,
+ /** Parse system config file error */
+ PARSE_FILE_ERROR = 2,
+ /** Alloc memory error */
+ ALLOC_MEMORY_ERROR = 3,
+ /** Copy string data error */
+ COPY_STRING_DATA_ERROR = 4,
+};
+
+/**
+ * @brief Fallback font information.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontFallbackInfo {
+ /** The type of language supported by the font set. The language format is bcp47 */
+ char* language;
+ /** Font family name */
+ char* familyName;
+} OH_Drawing_FontFallbackInfo;
+
+/**
+ * @brief Fallback font group.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontFallbackGroup {
+ /**
+ * The name of the font set corresponding to the fallback font set. If the value is null,
+ * all fonts can be set using the fallback font set list.
+ */
+ char* groupName;
+ /** Fallback font Info Size */
+ size_t fallbackInfoSize;
+ /** A list of font sets for fallback fonts */
+ OH_Drawing_FontFallbackInfo* fallbackInfoSet;
+} OH_Drawing_FontFallbackGroup;
+
+/**
+ * @brief Font weight mapping information.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontAdjustInfo {
+ /** The font's original weight value */
+ int weight;
+ /** The font weight displayed in the application */
+ int to;
+} OH_Drawing_FontAdjustInfo;
+
+/**
+ * @brief Alias font information.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontAliasInfo {
+ /** Font family name */
+ char* familyName;
+ /**
+ * Font weight value. When the weight value is greater than 0,
+ * the font set contains only fonts with the specified weight.
+ * When the weight value is equal to 0, the font set contains all fonts.
+ */
+ int weight;
+} OH_Drawing_FontAliasInfo;
+
+/**
+ * @brief General font set information supported by the system.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontGenericInfo {
+ /** Font family name */
+ char* familyName;
+ /** The size of alias font lists */
+ size_t aliasInfoSize;
+ /** The size of font weight mapping information lists */
+ size_t adjustInfoSize;
+ /** List of alias fonts */
+ OH_Drawing_FontAliasInfo* aliasInfoSet;
+ /** Font weight mapping information lists */
+ OH_Drawing_FontAdjustInfo* adjustInfoSet;
+} OH_Drawing_FontGenericInfo;
+
+/**
+ * @brief System font configuration information.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct OH_Drawing_FontConfigInfo {
+ /** Count of system font file paths */
+ size_t fontDirSize;
+ /** List size of generic font sets */
+ size_t fontGenericInfoSize;
+ /** Count of fallback font set lists */
+ size_t fallbackGroupSize;
+ /** List of system font file paths */
+ char** fontDirSet;
+ /** List of generic font sets */
+ OH_Drawing_FontGenericInfo* fontGenericInfoSet;
+ /** List of fallback font sets */
+ OH_Drawing_FontFallbackGroup* fallbackGroupSet;
+} OH_Drawing_FontConfigInfo;
+
/**
* @brief Creates an OH_Drawing_TypographyStyle object.
*
@@ -1943,6 +2125,450 @@ bool OH_Drawing_TextStyleGetHalfLeading(OH_Drawing_TextStyle*);
*/
const char* OH_Drawing_TextStyleGetLocale(OH_Drawing_TextStyle*);
+/**
+ * @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);
+
+/**
+ * @brief Mark the Typography as dirty, and initially state the Typography.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Indicates the pointer to the text OH_Drawing_Typography object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyMarkDirty(OH_Drawing_Typography*);
+
+/**
+ * @brief Get the unresolved Glyphs count of lines in a text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Indicates the pointer to the text OH_Drawing_Typography object.
+ * @return Returns unresolved Glyphs count.
+ * @since 12
+ * @version 1.0
+ */
+int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount(OH_Drawing_Typography*);
+
+/**
+ * @brief Update the font size of lines in a text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Indicates the pointer to the text OH_Drawing_Typography object.
+ * @param from Indicates the source of the original font size.
+ * @param to Indicates the destination of the updated font size.
+ * @param fontSize Indicates the size of the font.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyUpdateFontSize(OH_Drawing_Typography*, size_t from, size_t to, float fontSize);
+
+/**
+ * @brief Get whether the text layout enables line styles.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to the text OH_Drawing_TypographyStyle object.
+ * @return Whether or not to enable line styles in text layout only, true means enable, false means disable.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyTextGetLineStyle(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Get the font weight of line style for text typography.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle.
+ * @return Return the font weight of line style for text typography.
+ * For details, see the enum OH_Drawing_FontWeight.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontWeight OH_Drawing_TypographyTextlineStyleGetFontWeight(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Get the font style of line style for text typography.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle.
+ * @return Return the font style of line style for text typography.
+ * For details, see the enum OH_Drawing_FontStyle.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontStyle OH_Drawing_TypographyTextlineStyleGetFontStyle(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Get the font families of line style for text typography.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle.
+ * @param num The number of obtained font names.
+ * @return Return the font families of line style for text typography.
+ * @since 12
+ * @version 1.0
+ */
+char** OH_Drawing_TypographyTextlineStyleGetFontFamilies(OH_Drawing_TypographyStyle*, size_t* num);
+
+/**
+ * @brief Releases the memory occupied by a list of font families names.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param fontFamilies Indicates the pointer to a list of font families names.
+ * @param fontFamiliesNum Indicates the number of obtained font names.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyTextlineStyleDestroyFontFamilies(char** fontFamilies, size_t fontFamiliesNum);
+
+/**
+ * @brief Get the font size of font size for text typography.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle.
+ * @return Return the font size of font size for text typography.
+ * @since 12
+ * @version 1.0
+ */
+double OH_Drawing_TypographyTextlineStyleGetFontSize(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Get the font height scale in text layout.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle.
+ * @return Retrun the font height scale in text layout.
+ * @since 12
+ * @version 1.0
+ */
+double OH_Drawing_TypographyTextlineStyleGetHeightScale(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Get whether to enable font height for line styles in text layout only.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle.
+ * @return Whether or not to enable the font height for line styles in text layout only,
+ * true means enable, false means disable.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyTextlineStyleGetHeightOnly(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Get the half leading of line style for text typography.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle.
+ * @return Whether to enable the text line half leading style, true means enable, false means disable.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyTextlineStyleGetHalfLeading(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Get the spacing scale of line style for text typography.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle.
+ * @return Return the spacing scale of line style for text typography.
+ * @since 12
+ * @version 1.0
+ */
+double OH_Drawing_TypographyTextlineStyleGetSpacingScale(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Get whether only line style is enabled for text typography.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle.
+ * @return Returns whether only line style is enabled for text layout, true means it is enabled, false means it is not.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyTextlineGetStyleOnly(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Get the text alignment mode.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle.
+ * @return Return the text alignment mode. For details, see the enum OH_Drawing_TextAlign.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextAlign OH_Drawing_TypographyGetTextAlign(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Get the text direction.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle.
+ * @return Return the text direction. For details, see the enum OH_Drawing_TextDirection.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextDirection OH_Drawing_TypographyGetTextDirection(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Sets the maximum number of lines in a text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle.
+ * @return Return the maximum number of lines in a text.
+ * @since 12
+ * @version 1.0
+ */
+size_t OH_Drawing_TypographyGetTextMaxLines(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Get the ellipsis of lines in a text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to a typography style object OH_Drawing_TypographyStyle.
+ * @return Return the ellipsis of lines in a text.
+ * @since 12
+ * @version 1.0
+ */
+char* OH_Drawing_TypographyGetTextEllipsis(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Releases the memory occupied by a list of Ellipsis names.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param ellipsis Indicates the pointer to a list of Ellipsis names.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyDestroyEllipsis(char* ellipsis);
+
+/**
+ * @brief Overriding the class ParagraphStyle equals operator.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param from Indicates source of comparison object.
+ * @param to Indicates comparison object.
+ * @return Compare result.
+ * @since 12
+ * @version 1.0
+ */
+bool OH_Drawing_TypographyStyleEquals(OH_Drawing_TypographyStyle* from, OH_Drawing_TypographyStyle* to);
+
+/**
+ * @brief Set struct of background rect and styleId of text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @param OH_Drawing_RectStyle_Info Indicates the pointer to an OH_Drawing_RectStyle_Info object.
+ * @param styleId Indicates the styleId of text to set.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleSetBackgroundRect(OH_Drawing_TextStyle*, const OH_Drawing_RectStyle_Info*, int styleId);
+
+/**
+ * @brief Add symbols in creating typography.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyCreate Indicates the pointer to an OH_Drawing_TypographyCreate object.
+ * @param symbol Indicates the symbol to set.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyHandlerAddSymbol(OH_Drawing_TypographyCreate*, uint32_t symbol);
+
+/**
+ * @brief Add font feature.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @param tag Indicates the pointer to the tag to set.
+ * @param value Indicates the value to set.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleAddFontFeature(OH_Drawing_TextStyle*, const char* tag, int value);
+
+/**
+ * @brief Get all font features.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @return OH_Drawing_FontFeature Indicates the pointer to an array of structures of OH_Drawing_FontFeature.
+ * Get size of font feature by OH_Drawing_TextStyleGetFontFeatureSize.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontFeature* OH_Drawing_TextStyleGetFontFeatures(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Release the memory occupied by array of structures of font features.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontFeature Indicates the pointer to an array of structures of OH_Drawing_FontFeature.
+ * @param fontFeatureSize Indicates the size of array of structures of OH_Drawing_FontFeature.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleDestroyFontFeatures(OH_Drawing_FontFeature*, size_t fontFeatureSize);
+
+/**
+ * @brief Get size of font features.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @return Returns the size of fontfeatures map.
+ * @since 12
+ * @version 1.0
+ */
+size_t OH_Drawing_TextStyleGetFontFeatureSize(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Clear font features.
+ *
+ * @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_TextStyleClearFontFeature(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Set baseline shift of text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @param lineShift Indicates the baseline shift to set.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TextStyleSetBaselineShift(OH_Drawing_TextStyle*, double lineShift);
+
+/**
+ * @brief Get baseline shift of text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TextStyle Indicates the pointer to an OH_Drawing_TextStyle object.
+ * @return Returns the baseline shift.
+ * @since 12
+ * @version 1.0
+ */
+double OH_Drawing_TextStyleGetBaselineShift(OH_Drawing_TextStyle*);
+
+/**
+ * @brief Gets system font configuration information.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontConfigInfoErrorCode Indicates error code returned, based on the error code to
+ * release the memory of system font configuration information.
+ * For details, see the enum OH_Drawing_FontConfigInfoErrorCode.
+ * @return Returns a pointer to system font configuration information.
+ * Indicates the pointer to an OH_Drawing_FontConfigInfo object.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_FontConfigInfo* OH_Drawing_GetSystemFontConfigInfo(OH_Drawing_FontConfigInfoErrorCode*);
+
+/**
+ * @brief Releases the memory occupied by system font configuration information.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_FontConfigInfo Indicates the pointer to an OH_Drawing_FontConfigInfo object.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_DestroySystemFontConfigInfo(OH_Drawing_FontConfigInfo*);
+
+/**
+ * @brief Set mode of applying the leading over and under text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object.
+ * @param heightMode Indicates the mode to set.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyTextSetHeightBehavior(OH_Drawing_TypographyStyle*, OH_Drawing_TextHeightBehavior heightMode);
+
+/**
+ * @brief Get mode of applying the leading over and under text.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_TypographyStyle Indicates the pointer to an OH_Drawing_TypographyStyle object.
+ * @return Returns the mode.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_TextHeightBehavior OH_Drawing_TypographyTextGetHeightBehavior(OH_Drawing_TypographyStyle*);
+
+/**
+ * @brief Getting all font metrics from target row.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Typography Indicates a pointer to a typesetting object.
+ * @param lineNumber Indicates specifies the number of rows.
+ * @param fontMetricsSize Indicates the return size of font metrics struct from current line.
+ * @return Returns all character measures for the current row.
+ * @since 12
+ * @version 1.0
+ */
+OH_Drawing_Font_Metrics* OH_Drawing_TypographyGetLineFontMetrics(OH_Drawing_Typography*,
+ size_t lineNumber, size_t* fontMetricsSize);
+
+/**
+ * @brief Free up all the space taken up by the lineFontMetric.
+ *
+ * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
+ * @param OH_Drawing_Font_Metrics Indicates the first address of the lineFontMetric gather to be destroyed.
+ * @since 12
+ * @version 1.0
+ */
+void OH_Drawing_TypographyDestroyLineFontMetrics(OH_Drawing_Font_Metrics*);
+
#ifdef __cplusplus
}
#endif
diff --git a/graphic/graphic_2d/native_drawing/drawing_types.h b/graphic/graphic_2d/native_drawing/drawing_types.h
index a07fa55fc98d36bf8b27d1fb802961ca5066cdad..4016a50df67df7ca5fa009efd8ef2a00b40481db 100644
--- a/graphic/graphic_2d/native_drawing/drawing_types.h
+++ b/graphic/graphic_2d/native_drawing/drawing_types.h
@@ -443,6 +443,41 @@ typedef enum {
TEXT_ENCODING_GLYPH_ID,
} OH_Drawing_TextEncoding;
+/**
+ * @brief Defines rectstyle info struct.
+ *
+ * @since 12
+ * @version 1.0
+ */
+typedef struct {
+ /** color of rectstyle */
+ uint32_t color;
+ /** radius in left top of rectstyle */
+ double leftTopRadius;
+ /** radius in right top of rectstyle */
+ double rightTopRadius;
+ /** radius in right bottom of rectstyle */
+ double rightBottomRadius;
+ /** radius in left bottom of rectstyle */
+ double leftBottomRadius;
+} OH_Drawing_RectStyle_Info;
+
+/**
+ * @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 b0ed71fce71647195f16c80b7b7b71d7bbb9ffe2..6859980dd8bfa969e88ae73658d31302421b0240 100644
--- a/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
+++ b/graphic/graphic_2d/native_drawing/libnative_drawing.ndk.json
@@ -897,5 +897,209 @@
{
"first_introduced": "12",
"name": "OH_Drawing_TextStyleGetLocale"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_FontMgrCreate"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_FontMgrDestroy"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_FontMgrGetFamilyCount"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_FontMgrGetFamilyName"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_FontMgrDestroyFamilyName"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_FontMgrCreateFontStyleSet"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_FontMgrDestroyFontStyleSet"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_FontMgrMatchFamily"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_FontMgrMatchFamilyStyle"
+ },
+ {
+ "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"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TypographyMarkDirty"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TypographyGetUnresolvedGlyphsCount"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TypographyUpdateFontSize"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_RegisterThemeFontBuffer"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_RegisterThemeFont"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TypographyTextGetLineStyle"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyTextlineStyleGetFontStyle"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyTextlineStyleGetFontWeight"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyTextlineStyleGetFontFamilies"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyTextlineStyleDestroyFontFamilies"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyTextlineStyleGetFontSize"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyTextlineStyleGetHeightOnly"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyTextlineStyleGetHeightScale"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyTextlineStyleGetHalfLeading"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyTextlineStyleGetSpacingScale"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyTextlineGetStyleOnly"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyGetTextAlign"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyGetTextDirection"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyGetTextMaxLines"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyGetTextEllipsis"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyDestroyEllipsis"
+ },
+ {
+ "first_introduced": "12",
+ "name":"OH_Drawing_TypographyStyleEquals"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TextStyleSetBackgroundRect"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TypographyHandlerAddSymbol"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TextStyleAddFontFeature"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TextStyleGetFontFeatures"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TextStyleDestroyFontFeatures"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TextStyleGetFontFeatureSize"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TextStyleClearFontFeature"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TextStyleGetBaselineShift"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TextStyleSetBaselineShift"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_GetSystemFontConfigInfo"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_DestroySystemFontConfigInfo"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TypographyTextSetHeightBehavior"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TypographyTextGetHeightBehavior"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TypographyGetLineFontMetrics"
+ },
+ {
+ "first_introduced": "12",
+ "name": "OH_Drawing_TypographyDestroyLineFontMetrics"
}
]
\ No newline at end of file