• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.. All rights reserved.
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 2D drawing capability.
21  *
22  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
23  *
24  * @since 18
25  * @version 1.0
26  */
27 
28 /**
29  * @file drawing_text_linetypography.h
30  *
31  * @brief Declares functions related to <b>lineTypography</b> in the drawing module.
32  *
33  * @kit ArkGraphics2D
34  * @library libnative_drawing.so
35  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
36  * @since 18
37  * @version 1.0
38  */
39 
40 #ifndef DRAWING_TEXT_LINETYPOGRAPHY_H
41 #define DRAWING_TEXT_LINETYPOGRAPHY_H
42 
43 #include "drawing_text_declaration.h"
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 /**
50  * @brief Creates an <b>OH_Drawing_LineTypography</b> object.
51  *
52  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
53  * @param handler Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object.
54  * @return Returns the pointer to the <b>OH_Drawing_LineTypography</b> object created.
55  * @since 18
56  */
57 OH_Drawing_LineTypography* OH_Drawing_CreateLineTypography(OH_Drawing_TypographyCreate* handler);
58 
59 /**
60  * @brief Releases the memory occupied by an <b>OH_Drawing_LineTypography</b> object.
61  *
62  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
63  * @param lineTypography Indicates the pointer to an <b>OH_Drawing_LineTypography</b> object.
64  * @since 18
65  */
66 void OH_Drawing_DestroyLineTypography(OH_Drawing_LineTypography* lineTypography);
67 
68 /**
69  * @brief Calculate the line breakpoint based on the width provided.
70  *
71  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
72  * @param lineTypography Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object.
73  * @param startIndex Indicates the starting point for the line-break calculations.
74  * @param width Indicates the requested line-break width.
75  * @return Returns the count of the characters from startIndex that would cause the line break.
76  * @since 18
77  */
78 size_t OH_Drawing_LineTypographyGetLineBreak(OH_Drawing_LineTypography* lineTypography,
79                                              size_t startIndex, double width);
80 
81 /**
82  * @brief Creates a text line object based on the text range provided.
83  *
84  * @syscap SystemCapability.Graphic.Graphic2D.NativeDrawing
85  * @param lineTypography Indicates the pointer to an <b>OH_Drawing_TypographyCreate</b> object.
86  * @param startIndex Indicates the starting index of the text range.
87  * @param count Indicates the characters count of the text range.
88  * @return Returns the pointer to the <b>OH_Drawing_TextLine</b> object created.
89  * @since 18
90  */
91 OH_Drawing_TextLine* OH_Drawing_LineTypographyCreateLine(OH_Drawing_LineTypography* lineTypography,
92                                                          size_t startIndex, size_t count);
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 /** @} */
98 #endif
99