openharmony 鸿蒙 capi-drawing-text-linetypography-h

2026-08-25 浏览 (1)

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

NameDescription
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

NameDescription
OH_Drawing_TypographyCreate* handlerPointer to the OH_Drawing_TypographyCreate object, which is obtained from OH_Drawing_CreateTypographyHandler.

Returns

TypeDescription
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

NameDescription
OH_Drawing_LineTypography* lineTypographyPointer 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

NameDescription
OH_Drawing_LineTypography* lineTypographyPointer to the OH_Drawing_LineTypography object, which is obtained from OH_Drawing_CreateLineTypography.
size_t startIndexStart position (inclusive) for layout calculation. The value must be an integer in the range [0, total number of text characters].
double widthLayout width. The value is a floating point number greater than 0, in px.

Returns

TypeDescription
size_tReturns 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

NameDescription
OH_Drawing_LineTypography* lineTypographyPointer to the OH_Drawing_LineTypography object, which is obtained from OH_Drawing_CreateLineTypography.
size_t startIndexStart position for layout calculation. The value is an integer in the range [0, total number of text characters).
size_t countNumber 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

TypeDescription
OH_Drawing_TextLine*Pointer to the OH_Drawing_TextLine object.

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 capi-drawing-gpu-context-h

openharmony 鸿蒙 capi-drawing-nativepixelmap-

openharmony 鸿蒙 capi-nativevsync-oh-nativevsync-expectedraterange

openharmony 鸿蒙 capi-drawing-oh-drawing-brush

openharmony 鸿蒙 capi-drawing-oh-drawing-image-info

openharmony 鸿蒙 capi-oh-nativeimage-oh-nativeimage

openharmony 鸿蒙 capi-drawing-typeface-h

openharmony 鸿蒙 capi-drawing-brush-h

openharmony 鸿蒙 capi-nativewindow

openharmony 鸿蒙 js-apis-uiEffect

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/VaSsr7uE