drawing_text_lineTypography.h
Overview
This file declares the functions related to line typography, including functions to determine the number of characters that can be formatted from a given position within the text.
File to include: <native_drawing/drawing_text_lineTypography.h>
Library: libnative_drawing.so
System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing
Since: 18
Related module: Drawing
Summary
Functions
| Name | Description |
|---|---|
| OH_Drawing_LineTypography* OH_Drawing_CreateLineTypography(OH_Drawing_TypographyCreate* handler) | Creates a pointer to an OH_Drawing_LineTypography object, which stores the text content and style and can be used to compute typography details for individual lines of text. |
| void OH_Drawing_DestroyLineTypography(OH_Drawing_LineTypography* lineTypography) | Releases the memory occupied by an OH_Drawing_LineTypography object. |
| size_t OH_Drawing_LineTypographyGetLineBreak(OH_Drawing_LineTypography* lineTypography,size_t startIndex, double width) | Obtains the number of characters that can fit in the layout from the specified position within a limited layout width. |
| OH_Drawing_TextLine* OH_Drawing_LineTypographyCreateLine(OH_Drawing_LineTypography* lineTypography,size_t startIndex, size_t count) | Creates a pointer to an OH_Drawing_TextLine object based on the text content in a specified range. |
Function Description
OH_Drawing_CreateLineTypography()
OH_Drawing_LineTypography* OH_Drawing_CreateLineTypography(OH_Drawing_TypographyCreate* handler)
Description
Creates a pointer to an OH_Drawing_LineTypography object, which stores the text content and style and can be used to compute typography details for individual lines of text.
System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing
Since: 18
Parameters
| Name | Description |
|---|---|
| OH_Drawing_TypographyCreate* handler | Pointer to the OH_Drawing_TypographyCreate object, which is obtained from OH_Drawing_CreateTypographyHandler. |
Returns
| Type | Description |
|---|---|
| OH_Drawing_LineTypography* | Returns the pointer to the OH_Drawing_LineTypography object created. |
OH_Drawing_DestroyLineTypography()
void OH_Drawing_DestroyLineTypography(OH_Drawing_LineTypography* lineTypography)
Description
Releases the memory occupied by an OH_Drawing_LineTypography object.
System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing
Since: 18
Parameters
| Name | Description |
|---|---|
| OH_Drawing_LineTypography* lineTypography | Pointer to the OH_Drawing_LineTypography object, which is obtained from OH_Drawing_CreateLineTypography. |
OH_Drawing_LineTypographyGetLineBreak()
size_t OH_Drawing_LineTypographyGetLineBreak(OH_Drawing_LineTypography* lineTypography,size_t startIndex, double width)
Description
Obtains the number of characters that can fit in the layout from the specified position within a limited layout width.
System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing
Since: 18
Parameters
| Name | Description |
|---|---|
| OH_Drawing_LineTypography* lineTypography | Pointer to the OH_Drawing_LineTypography object, which is obtained from OH_Drawing_CreateLineTypography. |
| size_t startIndex | Start position (inclusive) for layout calculation. The value must be an integer in the range [0, total number of text characters]. |
| double width | Layout width. The value is a floating point number greater than 0, in px. |
Returns
| Type | Description |
|---|---|
| size_t | Returns the number of characters. |
OH_Drawing_LineTypographyCreateLine()
OH_Drawing_TextLine* OH_Drawing_LineTypographyCreateLine(OH_Drawing_LineTypography* lineTypography,size_t startIndex, size_t count)
Description
Creates a pointer to an OH_Drawing_TextLine object based on the text content in a specified range.
System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing
Since: 18
Parameters
| Name | Description |
|---|---|
| OH_Drawing_LineTypography* lineTypography | Pointer to the OH_Drawing_LineTypography object, which is obtained from OH_Drawing_CreateLineTypography. |
| size_t startIndex | Start position for layout calculation. The value is an integer in the range [0, total number of text characters). |
| size_t count | Number of characters from the specified start position. The value is an integer in the range [0, total number of text characters). The sum of startIndex and count cannot be greater than the total number of text characters. You can use OH_Drawing_LineTypographyGetLineBreak to obtain the number of characters that can fit in the layout. If the value is set to 0, a null pointer is returned. |
Returns
| Type | Description |
|---|---|
| OH_Drawing_TextLine* | Pointer to the OH_Drawing_TextLine object. |