• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup Drawing
18  * @{
19  *
20  * @brief Provides the font descriptor capability.
21  *
22  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
23  *
24  * @since 14
25  * @version 1.0
26  */
27 
28 /**
29  * @file drawing_text_font_descriptor.h
30  *
31  * @brief Provide the ability to provide <b>OH_Drawing_FontDescriptor</b>.
32  *
33  * @kit ArkGraphics2D
34  * @library libnative_drawing.so
35  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
36  * @since 14
37  * @version 1.0
38  */
39 
40 #ifndef DRAWING_TEXT_FONT_DESCRIPTOR_H
41 #define DRAWING_TEXT_FONT_DESCRIPTOR_H
42 
43 #include "drawing_text_typography.h"
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 /**
50  * @brief An enumeration of system font types.
51  *
52  * @since 14
53  */
54 typedef enum {
55     /** All font types */
56     ALL = 1 << 0,
57     /** System generic font type */
58     GENERIC = 1 << 1,
59     /** Stylish font type */
60     STYLISH = 1 << 2,
61     /** Installed font types */
62     INSTALLED = 1 << 3,
63 } OH_Drawing_SystemFontType;
64 
65 /**
66  * @brief Get the <b>OH_Drawing_FontDescriptor</b> object by the font full name and the font type, supporting generic
67  * fonts, stylish fonts, and installed fonts.
68  *
69  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
70  * @param fullName Indicates the full name object <b>OH_Drawing_String</b>.
71  * @param fontType Indicates enumerates of system font type object <b>OH_Drawing_SystemFontType</b>.
72  * @return Returns the pointer to a font descriptor object <b>OH_Drawing_FontDescriptor</b>.
73  * @since 14
74  */
75 OH_Drawing_FontDescriptor* OH_Drawing_GetFontDescriptorByFullName(const OH_Drawing_String* fullName,
76                                                                   OH_Drawing_SystemFontType fontType);
77 
78 /**
79  * @brief Obtain the corresponding font full name array by the font type.
80  *
81  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
82  * @param fontType Indicates enumerates of system font type object <b>OH_Drawing_SystemFontType</b>.
83  * @return Returns the pointer to full name array object <b>OH_Drawing_Array</b>.
84  * @since 14
85  */
86 OH_Drawing_Array* OH_Drawing_GetSystemFontFullNamesByType(OH_Drawing_SystemFontType fontType);
87 
88 /**
89  * @brief Get the specified full name object <b>OH_Drawing_String</b> by index from the
90  * <b>OH_Drawing_Array</b> object.
91  *
92  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
93  * @param fullNameArray Indicates an array of full name object <b>OH_Drawing_Array</b>.
94  * @param index The index of full name.
95  * @return Returns a full name object <b>OH_Drawing_String</b>.
96  * @since 14
97  */
98 const OH_Drawing_String* OH_Drawing_GetSystemFontFullNameByIndex(OH_Drawing_Array* fullNameArray, size_t index);
99 
100 /**
101  * @brief Releases the memory occupied by an array of font full names.
102  *
103  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
104  * @param fullNameArray Indicates an array of full name object <b>OH_Drawing_Array</b>.
105  * @since 14
106  */
107 void OH_Drawing_DestroySystemFontFullNames(OH_Drawing_Array* fullNameArray);
108 
109 #ifdef __cplusplus
110 }
111 #endif
112 /** @} */
113 #endif