diff --git a/graphic/graphic_2d/native_drawing/drawing_text_font_descriptor.h b/graphic/graphic_2d/native_drawing/drawing_text_font_descriptor.h index e89a96b06dcf0679b729f05f3879325e3c2fc971..38fd67611b5215452c53d449687433e949971afd 100644 --- a/graphic/graphic_2d/native_drawing/drawing_text_font_descriptor.h +++ b/graphic/graphic_2d/native_drawing/drawing_text_font_descriptor.h @@ -67,6 +67,34 @@ typedef enum { CUSTOMIZED = 1 << 4, } OH_Drawing_SystemFontType; +/** + * @brief An enumeration of font full descriptor attribute. + * + * @since 22 + */ +typedef enum { + /** The file path of the font */ + FULL_DESCRIPTOR_ATTR_S_PATH = 0, + /** A name that uniquely identifies the font */ + FULL_DESCRIPTOR_ATTR_S_POSTSRIPT_NAME = 1, + /** The full name of the font */ + FULL_DESCRIPTOR_ATTR_S_FULL_NAME = 2, + /** The family name of the font */ + FULL_DESCRIPTOR_ATTR_S_FAMILY_NAME = 3, + /** The subfont family of the font */ + FULL_DESCRIPTOR_ATTR_S_SUB_FAMILY_NAME = 4, + /** The weight of the font */ + FULL_DESCRIPTOR_ATTR_I_WEIGHT = 5, + /** The width of the font */ + FULL_DESCRIPTOR_ATTR_I_WIDTH = 6, + /** Whether the font is tilted */ + FULL_DESCRIPTOR_ATTR_I_ITALIC = 7, + /** Whether the font is monospaced */ + FULL_DESCRIPTOR_ATTR_B_MONO = 8, + /** whether symbolic fonts are supported */ + FULL_DESCRIPTOR_ATTR_B_SYMBOLIC = 9, +} OH_Drawing_FontFullDescriptorAtrributeId; + /** * @brief Obtain all system font descriptive symbols that match the specified font descriptor. Where the 'path' * fields are not considered as valid matching values, It takes effect when the remaining fields are not @@ -139,6 +167,17 @@ const OH_Drawing_String* OH_Drawing_GetSystemFontFullNameByIndex(OH_Drawing_Arra */ void OH_Drawing_DestroySystemFontFullNames(OH_Drawing_Array* fullNameArray); +/** + * @brief Obtains an array of font full descriptors from font file path. + * + * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing + * @param path Indicates the pointer to the path to set. + * @return Returns a pointer to OH_Drawing_Array structure containing font full descriptors. + * An empty array will be returned if no fonts are found, invalid path, no permission, or non-font file. + * @since 22 + */ +OH_Drawing_Array* OH_Drawing_GetFontFullDescriptorssFromPath(char* path); + #ifdef __cplusplus } #endif