1 /* 2 * Copyright (c) 2023 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 #ifndef C_INCLUDE_DRAWING_TYPEFACE_H 17 #define C_INCLUDE_DRAWING_TYPEFACE_H 18 19 /** 20 * @addtogroup Drawing 21 * @{ 22 * 23 * @brief Provides functions such as 2D graphics rendering, text drawing, and image display. 24 * 25 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 26 * 27 * @since 11 28 * @version 1.0 29 */ 30 31 /** 32 * @file drawing_typeface.h 33 * 34 * @brief Declares functions related to the <b>typeface</b> object in the drawing module. 35 * 36 * @since 11 37 * @version 1.0 38 */ 39 40 #include "drawing_types.h" 41 42 #ifdef __cplusplus 43 extern "C" { 44 #endif 45 46 /** 47 * @brief Creates a default <b>OH_Drawing_Typeface</b> object. 48 * 49 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 50 * @return Returns the pointer to the <b>OH_Drawing_Typeface</b> object created. 51 * @since 11 52 * @version 1.0 53 */ 54 OH_Drawing_Typeface* OH_Drawing_TypefaceCreateDefault(void); 55 56 /** 57 * @brief Creates a <b>OH_Drawing_Typeface</b> object by file. 58 * 59 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 60 * @param path file path. 61 * @param index file index. 62 * @return Returns the pointer to the <b>OH_Drawing_Typeface</b> object created. 63 * @since 12 64 * @version 1.0 65 */ 66 OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromFile(const char* path, int index); 67 68 /** 69 * @brief Creates a <b>OH_Drawing_Typeface</b> object by given a stream. If the stream is not a valid 70 * font file, returns nullptr. Ownership of the stream is transferred, so the caller must not reference 71 * it or free it again. 72 * 73 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 74 * @param OH_Drawing_MemoryStream Indicates the pointer to an <b>OH_Drawing_MemoryStream</b> object. 75 * @param index memory stream index. 76 * @return Returns the pointer to the <b>OH_Drawing_Typeface</b> object created. 77 * @since 12 78 * @version 1.0 79 */ 80 OH_Drawing_Typeface* OH_Drawing_TypefaceCreateFromStream(OH_Drawing_MemoryStream*, int32_t index); 81 82 /** 83 * @brief Destroys an <b>OH_Drawing_Typeface</b> object and reclaims the memory occupied by the object. 84 * 85 * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing 86 * @param OH_Drawing_Typeface Indicates the pointer to an <b>OH_Drawing_Typeface</b> object. 87 * @since 11 88 * @version 1.0 89 */ 90 void OH_Drawing_TypefaceDestroy(OH_Drawing_Typeface*); 91 92 #ifdef __cplusplus 93 } 94 #endif 95 /** @} */ 96 #endif 97