harmony 鸿蒙drawing_text_typography.h

  • 2025-06-12
  • 浏览 (3)

drawing_text_typography.h

Overview

The drawing_text_typography.h file declares the functions related to typography in the drawing module.

File to include: native_drawing/drawing_text_typography.h

Library: libnative_drawing.so

Since: 8

Related module: Drawing

Summary

Structs

Name Description
struct OH_Drawing_PlaceholderSpan Describes the placeholder that acts as a span.
struct OH_Drawing_FontDescriptor Describes the detailed information about a system font.
struct OH_Drawing_LineMetrics Describes the measurement information about a line of text.
struct OH_Drawing_FontFallbackInfo Describes the information about a font fallback.
struct OH_Drawing_FontFallbackGroup Describes the information about a font fallback group.
struct OH_Drawing_FontAdjustInfo Describes the information about a font weight mapping.
struct OH_Drawing_FontAliasInfo Describes the information about a font alias.
struct OH_Drawing_FontGenericInfo Describes the information about generic fonts supported by the system.
struct OH_Drawing_FontConfigInfo Describes the information about a system font configuration.
struct OH_Drawing_FontStyleStruct Describes a font style.
struct OH_Drawing_FontFeature Describes a font feature.
struct OH_Drawing_StrutStyle Describes a strut style. The strut style determines the line spacing, baseline alignment mode, and other properties related to the line height when drawing text.

Types

Name Description
typedef enum OH_Drawing_PlaceholderVerticalAlignment OH_Drawing_PlaceholderVerticalAlignment Defines an enum for the vertical alignment modes of placeholders.
typedef struct OH_Drawing_PlaceholderSpan OH_Drawing_PlaceholderSpan Defines a struct for the placeholder that acts as a span.
typedef enum OH_Drawing_TextDecorationStyle OH_Drawing_TextDecorationStyle Defines an enum for the text decoration styles.
typedef enum OH_Drawing_EllipsisModal OH_Drawing_EllipsisModal Defines an enum for the text ellipsis styles.
typedef enum OH_Drawing_BreakStrategy OH_Drawing_BreakStrategy Defines an enum for the text break strategies.
typedef enum OH_Drawing_WordBreakType OH_Drawing_WordBreakType Defines an enum for the word break types.
typedef enum OH_Drawing_RectHeightStyle OH_Drawing_RectHeightStyle Defines an enum for the rectangle height styles.
typedef enum OH_Drawing_RectWidthStyle OH_Drawing_RectWidthStyle Defines an enum for the rectangle width styles.
typedef struct OH_Drawing_FontDescriptor OH_Drawing_FontDescriptor Defines a struct for the detailed information about a system font.
typedef struct OH_Drawing_LineMetrics OH_Drawing_LineMetrics Defines a struct for the measurement information about a line of text.
typedef struct OH_Drawing_FontFallbackInfo OH_Drawing_FontFallbackInfo Defines a struct for the information about a font fallback.
typedef struct OH_Drawing_FontFallbackGroup OH_Drawing_FontFallbackGroup Defines a struct for the information about a font fallback group.
typedef struct OH_Drawing_FontAdjustInfo OH_Drawing_FontAdjustInfo Defines a struct for the information about a font weight mapping.
typedef struct OH_Drawing_FontAliasInfo OH_Drawing_FontAliasInfo Defines a struct for the information about a font alias.
typedef struct OH_Drawing_FontGenericInfo OH_Drawing_FontGenericInfo Defines a struct for the information about generic fonts supported by the system.
typedef struct OH_Drawing_FontConfigInfo OH_Drawing_FontConfigInfo Defines a struct for the information about a system font configuration.
typedef struct OH_Drawing_FontStyleStruct OH_Drawing_FontStyleStruct Defines a struct for a font style.
typedef struct OH_Drawing_StrutStyle OH_Drawing_StrutStyle Defines a struct for a strut style. The strut style determines the line spacing, baseline alignment mode, and other properties related to the line height when drawing text.

Enums

Name Description
OH_Drawing_TextDirection { TEXT_DIRECTION_RTL, TEXT_DIRECTION_LTR } Enumerates the text directions.
OH_Drawing_TextAlign {
TEXT_ALIGN_LEFT, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER, TEXT_ALIGN_JUSTIFY,
TEXT_ALIGN_START, TEXT_ALIGN_END
}
Enumerates the text alignment modes.
OH_Drawing_FontWeight {
FONT_WEIGHT_100, FONT_WEIGHT_200, FONT_WEIGHT_300, FONT_WEIGHT_400,
FONT_WEIGHT_500, FONT_WEIGHT_600, FONT_WEIGHT_700, FONT_WEIGHT_800,
FONT_WEIGHT_900
}
Enumerates the font weights.
OH_Drawing_TextBaseline { TEXT_BASELINE_ALPHABETIC, TEXT_BASELINE_IDEOGRAPHIC } Enumerates the text baselines.
OH_Drawing_TextDecoration { TEXT_DECORATION_NONE = 0x0, TEXT_DECORATION_UNDERLINE = 0x1, TEXT_DECORATION_OVERLINE = 0x2, TEXT_DECORATION_LINE_THROUGH = 0x4 } Enumerates the text decorations.
OH_Drawing_FontStyle { FONT_STYLE_NORMAL, FONT_STYLE_ITALIC, FONT_STYLE_OBLIQUE } Enumerates the font styles.
OH_Drawing_PlaceholderVerticalAlignment {
ALIGNMENT_OFFSET_AT_BASELINE, ALIGNMENT_ABOVE_BASELINE, ALIGNMENT_BELOW_BASELINE, ALIGNMENT_TOP_OF_ROW_BOX,
ALIGNMENT_BOTTOM_OF_ROW_BOX, ALIGNMENT_CENTER_OF_ROW_BOX
}
Enumerates the vertical alignment modes of placeholders.
OH_Drawing_TextDecorationStyle {
TEXT_DECORATION_STYLE_SOLID, TEXT_DECORATION_STYLE_DOUBLE, TEXT_DECORATION_STYLE_DOTTED, TEXT_DECORATION_STYLE_DASHED,
TEXT_DECORATION_STYLE_WAVY
}
Enumerates the text decoration styles.
OH_Drawing_EllipsisModal { ELLIPSIS_MODAL_HEAD = 0, ELLIPSIS_MODAL_MIDDLE = 1, ELLIPSIS_MODAL_TAIL = 2 } Enumerates the text ellipsis styles.
OH_Drawing_BreakStrategy { BREAK_STRATEGY_GREEDY = 0, BREAK_STRATEGY_HIGH_QUALITY = 1, BREAK_STRATEGY_BALANCED = 2 } Enumerates the text break strategies.
OH_Drawing_WordBreakType { WORD_BREAK_TYPE_NORMAL = 0, WORD_BREAK_TYPE_BREAK_ALL = 1, WORD_BREAK_TYPE_BREAK_WORD = 2, WORD_BREAK_TYPE_BREAK_HYPHEN = 3 } Enumerates the word break types.
OH_Drawing_RectHeightStyle {
RECT_HEIGHT_STYLE_TIGHT, [RECT_HEIGHT_STYLE_MAX, RECT_HEIGHT_STYLE_INCLUDELINESPACEMIDDLE, RECT_HEIGHT_STYLE_INCLUDELINESPACETOP,
RECT_HEIGHT_STYLE_INCLUDELINESPACEBOTTOM, RECT_HEIGHT_STYLE_STRUCT
}
Enumerates the rectangle height styles.
OH_Drawing_RectWidthStyle { RECT_WIDTH_STYLE_TIGHT, RECT_WIDTH_STYLE_MAX } Enumerates the rectangle width styles.
OH_Drawing_FontConfigInfoErrorCode {
SUCCESS_FONT_CONFIG_INFO = 0, ERROR_FONT_CONFIG_INFO_UNKNOWN = 1, ERROR_FONT_CONFIG_INFO_PARSE_FILE = 2, ERROR_FONT_CONFIG_INFO_ALLOC_MEMORY = 3,
ERROR_FONT_CONFIG_INFO_COPY_STRING_DATA = 4
}
Enumerates the error codes that may be used during the obtaining of system font configurations.
OH_Drawing_FontWidth {
FONT_WIDTH_ULTRA_CONDENSED = 1, FONT_WIDTH_EXTRA_CONDENSED = 2, FONT_WIDTH_CONDENSED = 3, FONT_WIDTH_SEMI_CONDENSED = 4,
FONT_WIDTH_NORMAL = 5, FONT_WIDTH_SEMI_EXPANDED = 6, FONT_WIDTH_EXPANDED = 7, FONT_WIDTH_EXTRA_EXPANDED = 8,
FONT_WIDTH_ULTRA_EXPANDED = 9
}
Enumerates the font widths.
OH_Drawing_TextHeightBehavior { TEXT_HEIGHT_ALL = 0x0, TEXT_HEIGHT_DISABLE_FIRST_ASCENT = 0x1, TEXT_HEIGHT_DISABLE_LAST_ASCENT = 0x2, TEXT_HEIGHT_DISABLE_ALL = 0x1 |0x2 } Enumerates the text height modifier patterns.
OH_Drawing_TextStyleType {
TEXT_STYLE_NONE, TEXT_STYLE_ALL_ATTRIBUTES, TEXT_STYLE_FONT, TEXT_STYLE_FOREGROUND,
TEXT_STYLE_BACKGROUND, TEXT_STYLE_SHADOW, TEXT_STYLE_DECORATIONS, TEXT_STYLE_LETTER_SPACING,
TEXT_STYLE_WORD_SPACING
}
Enumerates the text style types.

Functions

Name Description
OH_Drawing_TypographyStyle * OH_Drawing_CreateTypographyStyle (void) Creates an OH_Drawing_TypographyStyle object. When OH_Drawing_TypographyStyle is no longer required, call OH_Drawing_DestroyTypographyStyle to release the pointer to the object.
void OH_Drawing_DestroyTypographyStyle (OH_Drawing_TypographyStyle *) Destroys an OH_Drawing_TypographyStyle object and reclaims the memory occupied by the object.
void OH_Drawing_SetTypographyTextDirection (OH_Drawing_TypographyStyle *, int) Sets the text direction in a typography style.
void OH_Drawing_SetTypographyTextAlign (OH_Drawing_TypographyStyle *, int) Sets the text alignment mode.
int OH_Drawing_TypographyGetEffectiveAlignment (OH_Drawing_TypographyStyle *style) Obtains the text alignment mode.
void OH_Drawing_SetTypographyTextMaxLines (OH_Drawing_TypographyStyle *, int) Sets the maximum number of lines in the text.
OH_Drawing_TextStyle * OH_Drawing_CreateTextStyle (void) Creates an OH_Drawing_TextStyle object.
OH_Drawing_TextStyle * OH_Drawing_TypographyGetTextStyle (OH_Drawing_TypographyStyle *style) Obtains the default text style of a typography style.
void OH_Drawing_DestroyTextStyle (OH_Drawing_TextStyle *) Destroys an OH_Drawing_TextStyle object and reclaims the memory occupied by the object.
void OH_Drawing_SetTextStyleColor (OH_Drawing_TextStyle *, uint32_t) Sets the color for a text style.
void OH_Drawing_SetTextStyleFontSize (OH_Drawing_TextStyle *, double) Sets the font size for a text style.
void OH_Drawing_SetTextStyleFontWeight (OH_Drawing_TextStyle *, int) Sets the font weight for a text style. Currently, only the default system font supports font weight adjustment. For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness. If the weight is greater than or equal to semi-bold, it might result in a fake bold effect.
void OH_Drawing_SetTextStyleBaseLine (OH_Drawing_TextStyle *, int) Sets the baseline for a text style.
void OH_Drawing_SetTextStyleDecoration (OH_Drawing_TextStyle *, int) Sets the decoration for a text style. Only one decoration can be set. To add multiple decorations, use OH_Drawing_AddTextStyleDecoration.
void OH_Drawing_AddTextStyleDecoration (OH_Drawing_TextStyle *, int) Adds the decoration for a text style. Multiple decoration lines can be displayed.
void OH_Drawing_RemoveTextStyleDecoration (OH_Drawing_TextStyle *, int) Removes the decoration for a text style.
void OH_Drawing_SetTextStyleDecorationColor (OH_Drawing_TextStyle *, uint32_t) Sets the decoration color for a text style.
void OH_Drawing_SetTextStyleFontHeight (OH_Drawing_TextStyle *, double) Sets the line height based on the multiple of the font size.
void OH_Drawing_SetTextStyleFontFamilies (OH_Drawing_TextStyle *, int, const char *fontFamilies[]) Sets the font families for a text style.
void OH_Drawing_SetTextStyleFontStyle (OH_Drawing_TextStyle *, int) Sets the font style for a text style.
void OH_Drawing_SetTextStyleLocale (OH_Drawing_TextStyle *, const char *) Sets the locale for a text style.
void OH_Drawing_SetTextStyleForegroundBrush (OH_Drawing_TextStyle *, OH_Drawing_Brush *) Sets the foreground brush for a text style.
void OH_Drawing_TextStyleGetForegroundBrush (OH_Drawing_TextStyle *, OH_Drawing_Brush *) Obtains the foreground brush of a text style.
void OH_Drawing_SetTextStyleForegroundPen (OH_Drawing_TextStyle *, OH_Drawing_Pen *) Sets the foreground pen for a text style.
void OH_Drawing_TextStyleGetForegroundPen (OH_Drawing_TextStyle *, OH_Drawing_Pen *) Obtains the foreground pen of a text style.
void OH_Drawing_SetTextStyleBackgroundBrush (OH_Drawing_TextStyle *, OH_Drawing_Brush *) Sets the background brush for a text style.
void OH_Drawing_TextStyleGetBackgroundBrush (OH_Drawing_TextStyle *, OH_Drawing_Brush *) Obtains the background brush of a text style.
void OH_Drawing_SetTextStyleBackgroundPen (OH_Drawing_TextStyle *, OH_Drawing_Pen *) Sets the background pen for a text style.
void OH_Drawing_TextStyleGetBackgroundPen (OH_Drawing_TextStyle *, OH_Drawing_Pen *) Obtains the background pen of a text style.
OH_Drawing_TypographyCreate * OH_Drawing_CreateTypographyHandler (OH_Drawing_TypographyStyle *, OH_Drawing_FontCollection *) Creates a handler to an OH_Drawing_TypographyCreate object. When OH_Drawing_TypographyCreate is no longer required, call OH_Drawing_DestroyTypographyHandler to release the pointer to the object.
void OH_Drawing_DestroyTypographyHandler (OH_Drawing_TypographyCreate *) Reclaims the memory occupied by an OH_Drawing_TypographyCreate object.
void OH_Drawing_TypographyHandlerPushTextStyle (OH_Drawing_TypographyCreate *, OH_Drawing_TextStyle *) Pushes a text style into the text style stack. Any text added afterward will use the style currently on top of the stack.
void OH_Drawing_TypographyHandlerAddText (OH_Drawing_TypographyCreate *, const char *) Adds text.
void OH_Drawing_TypographyHandlerPopTextStyle (OH_Drawing_TypographyCreate *) Pops the top text style out of the text style stack.
OH_Drawing_Typography * OH_Drawing_CreateTypography (OH_Drawing_TypographyCreate *) Creates an OH_Drawing_Typography object. When OH_Drawing_Typography is no longer required, call OH_Drawing_DestroyTypography to release the pointer to the object.
void OH_Drawing_DestroyTypography (OH_Drawing_Typography *) Destroys an OH_Drawing_Typography object and reclaims the memory occupied by the object.
void OH_Drawing_TypographyLayout (OH_Drawing_Typography *, double) Lays out the typography.
void OH_Drawing_TypographyPaint (OH_Drawing_Typography *, OH_Drawing_Canvas *, double, double) Draws text from the upper left corner at a specified position. This function must be called after OH_Drawing_TypographyLayout is called and applied.
void OH_Drawing_TypographyPaintOnPath (OH_Drawing_Typography * typography, OH_Drawing_Canvas * canvas, OH_Drawing_Path * path, double hOffset, double vOffset) Draws text along a path. To prevent text overlap caused by the text width exceeding the layout width, you are advised to use OH_Drawing_SetTypographyTextMaxLines to limit the text to a single line.
double OH_Drawing_TypographyGetMaxWidth (OH_Drawing_Typography *) Obtains the typography width set by the user. This function must be called after OH_Drawing_TypographyLayout is called.
double OH_Drawing_TypographyGetHeight (OH_Drawing_Typography *) Obtains the overall height of a typography object. This function must be called after OH_Drawing_TypographyLayout is called.
double OH_Drawing_TypographyGetLongestLine (OH_Drawing_Typography *) Obtains the width of the longest line in a typography object. This function must be called after OH_Drawing_TypographyLayout is called. You are advised to round up the return value. If the text content is empty, 0.0 is returned.
double OH_Drawing_TypographyGetLongestLineWithIndent (OH_Drawing_Typography *) Obtains the width of the longest line of a typography object, including its indentation. This function must be called after OH_Drawing_TypographyLayout is called. You are advised to round up the return value. If the text content is empty, 0.0 is returned.
double OH_Drawing_TypographyGetMinIntrinsicWidth (OH_Drawing_Typography *) Obtains the minimum intrinsic width in a typography object. This function must be called after OH_Drawing_TypographyLayout is called.
double OH_Drawing_TypographyGetMaxIntrinsicWidth (OH_Drawing_Typography *) Obtains the maximum intrinsic width in a typography object. This function must be called after OH_Drawing_TypographyLayout is called.
double OH_Drawing_TypographyGetAlphabeticBaseline (OH_Drawing_Typography *) Obtains the alphabetic baseline in a typography object.
double OH_Drawing_TypographyGetIdeographicBaseline (OH_Drawing_Typography *) Obtains the ideographic baseline in a typography object.
void OH_Drawing_TypographyHandlerAddPlaceholder (OH_Drawing_TypographyCreate *, OH_Drawing_PlaceholderSpan *) Adds a placeholder.
bool OH_Drawing_TypographyDidExceedMaxLines (OH_Drawing_Typography *) Checks whether the maximum number of lines of a typography object is exceeded. This function must be called after OH_Drawing_TypographyLayout is called. If the maximum number of lines is not set by calling OH_Drawing_SetTypographyTextMaxLines, false is returned.
OH_Drawing_TextBox * OH_Drawing_TypographyGetRectsForRange (OH_Drawing_Typography *, size_t, size_t, OH_Drawing_RectHeightStyle, OH_Drawing_RectWidthStyle) Obtains text boxes in a given range of a typography object. This function must be called after OH_Drawing_TypographyLayout is called. When OH_Drawing_TextBox is no longer required, call OH_Drawing_TypographyDestroyTextBox to release the pointer to the object.
OH_Drawing_TextBox * OH_Drawing_TypographyGetRectsForPlaceholders (OH_Drawing_Typography *) Obtains text boxes for placeholders in a typography object. This function must be called after OH_Drawing_TypographyLayout is called. When OH_Drawing_TextBox is no longer required, call OH_Drawing_TypographyDestroyTextBox to release the pointer to the object.
float OH_Drawing_GetLeftFromTextBox (OH_Drawing_TextBox *, int) Obtains the left position of a text box.
float OH_Drawing_GetRightFromTextBox (OH_Drawing_TextBox *, int) Obtains the right position of a text box.
float OH_Drawing_GetTopFromTextBox (OH_Drawing_TextBox *, int) Obtains the top position of a text box.
float OH_Drawing_GetBottomFromTextBox (OH_Drawing_TextBox *, int) Obtains the bottom position of a text box.
int OH_Drawing_GetTextDirectionFromTextBox (OH_Drawing_TextBox *, int) Obtains the text direction of a text box.
size_t OH_Drawing_GetSizeOfTextBox (OH_Drawing_TextBox *) Obtains the number of text boxes.
OH_Drawing_PositionAndAffinity * OH_Drawing_TypographyGetGlyphPositionAtCoordinate (OH_Drawing_Typography *, double, double) Obtains the position and affinity of the glyph at the given coordinates.
OH_Drawing_PositionAndAffinity * OH_Drawing_TypographyGetGlyphPositionAtCoordinateWithCluster (OH_Drawing_Typography *, double, double) Obtains the position and affinity of the glyph cluster to which the glyph at the given coordinates belongs. The glyph cluster is a container that holds one or more glyphs.
size_t OH_Drawing_GetPositionFromPositionAndAffinity (OH_Drawing_PositionAndAffinity *) Obtains the position attribute of an OH_Drawing_PositionAndAffinity object.
int OH_Drawing_GetAffinityFromPositionAndAffinity (OH_Drawing_PositionAndAffinity *) Obtains the affinity attribute of an OH_Drawing_PositionAndAffinity object. The affinity determines whether the font is close to the front text or rear text.
OH_Drawing_Range * OH_Drawing_TypographyGetWordBoundary (OH_Drawing_Typography *, size_t) Obtains the word boundary in a typography object.
size_t OH_Drawing_GetStartFromRange (OH_Drawing_Range *) Obtains the start position of an OH_Drawing_Range object.
size_t OH_Drawing_GetEndFromRange (OH_Drawing_Range *) Obtains the end position of an OH_Drawing_Range object.
size_t OH_Drawing_TypographyGetLineCount (OH_Drawing_Typography *) Obtains the number of lines in a typography object. This function must be called after OH_Drawing_TypographyLayout is called.
void OH_Drawing_SetTextStyleDecorationStyle (OH_Drawing_TextStyle *, int) Sets the decoration style for a text style.
void OH_Drawing_SetTextStyleDecorationThicknessScale (OH_Drawing_TextStyle *, double) Sets the thickness scale factor for the decoration style of a text style.
void OH_Drawing_SetTextStyleLetterSpacing (OH_Drawing_TextStyle *, double) Sets the letter spacing for a text style.
void OH_Drawing_SetTextStyleWordSpacing (OH_Drawing_TextStyle *, double) Sets the word spacing for a text style.
void OH_Drawing_SetTextStyleHalfLeading (OH_Drawing_TextStyle *, bool) Sets whether to enable half leading for a text style.
void OH_Drawing_SetTextStyleEllipsis (OH_Drawing_TextStyle *, const char *) Sets the ellipsis content for a text style.
void OH_Drawing_SetTextStyleEllipsisModal (OH_Drawing_TextStyle *, int) Sets the ellipsis style for a text style.
void OH_Drawing_SetTypographyTextBreakStrategy (OH_Drawing_TypographyStyle *, int) Sets the text break strategy.
void OH_Drawing_SetTypographyTextWordBreakType (OH_Drawing_TypographyStyle *, int) Sets the word break type.
void OH_Drawing_SetTypographyTextEllipsisModal (OH_Drawing_TypographyStyle *, int) Sets the text ellipsis style for a typography style.
void OH_Drawing_SetTypographyTextEllipsis (OH_Drawing_TypographyStyle *style, const char *ellipsis) Sets the text ellipsis content.
double OH_Drawing_TypographyGetLineHeight (OH_Drawing_Typography *, int) Obtains the line height in a typography object. This function must be called after OH_Drawing_TypographyLayout is called.
double OH_Drawing_TypographyGetLineWidth (OH_Drawing_Typography *, int) Obtains the line width in a typography object. This function must be called after OH_Drawing_TypographyLayout is called.
void OH_Drawing_SetTypographyTextSplitRatio (OH_Drawing_TypographyStyle *style, float textSplitRatio) Sets the text split ratio.
bool OH_Drawing_TypographyIsLineUnlimited (OH_Drawing_TypographyStyle *style) Checks whether the maximum number of lines is limited.
bool OH_Drawing_TypographyIsEllipsized (OH_Drawing_TypographyStyle *style) Checks whether an ellipsis is configured for a typography style.
void OH_Drawing_SetTypographyTextLocale (OH_Drawing_TypographyStyle *style, const char *locale) Sets the locale for a typography style.
bool OH_Drawing_TextStyleGetFontMetrics (OH_Drawing_Typography *, OH_Drawing_TextStyle *, OH_Drawing_Font_Metrics *) Obtains the font metrics of a text style.
void OH_Drawing_SetTypographyTextStyle (OH_Drawing_TypographyStyle *, OH_Drawing_TextStyle *) Sets a text style.
OH_Drawing_FontDescriptor * OH_Drawing_CreateFontDescriptor (void) Creates an OH_Drawing_FontDescriptor object to describe the detailed information about a system font.
void OH_Drawing_DestroyFontDescriptor (OH_Drawing_FontDescriptor *) Destroys an OH_Drawing_FontDescriptor object and reclaims the memory occupied by the object.
OH_Drawing_FontParser * OH_Drawing_CreateFontParser (void) Creates an OH_Drawing_FontParser object to parse a system font.
void OH_Drawing_DestroyFontParser (OH_Drawing_FontParser *) Destroys an OH_Drawing_FontParser object and reclaims the memory occupied by the object.
char ** OH_Drawing_FontParserGetSystemFontList (OH_Drawing_FontParser *, size_t *) Obtains the list of system fonts. This function can be used only on 2-in-1 devices and phones.
void OH_Drawing_DestroySystemFontList (char **, size_t) Reclaims the memory occupied by the system font list.
OH_Drawing_FontDescriptor * OH_Drawing_FontParserGetFontByName (OH_Drawing_FontParser *, const char *) Obtains the descriptor of a system font based on the font name.
OH_Drawing_LineMetrics * OH_Drawing_TypographyGetLineMetrics (OH_Drawing_Typography *) Obtains the line metrics in a typography object. This function must be called after OH_Drawing_TypographyLayout is called. When OH_Drawing_LineMetrics is no longer required, call OH_Drawing_DestroyLineMetrics to release the pointer to the object.
size_t OH_Drawing_LineMetricsGetSize (OH_Drawing_LineMetrics *) Obtains the number of lines.
void OH_Drawing_DestroyLineMetrics (OH_Drawing_LineMetrics *) Destroys an OH_Drawing_LineMetrics object and reclaims the memory occupied by the object.
bool OH_Drawing_TypographyGetLineMetricsAt (OH_Drawing_Typography *, int, OH_Drawing_LineMetrics *) Obtains the metrics of a given line in a typography object. For details, see OH_Drawing_LineMetrics. This function must be called after OH_Drawing_TypographyLayout is called.
bool OH_Drawing_TypographyGetLineInfo (OH_Drawing_Typography *, int, bool, bool, OH_Drawing_LineMetrics *) Obtains the metrics of a given line or the metrics of the first character in a given line in a typography object. This function must be called after OH_Drawing_TypographyLayout is called.
void OH_Drawing_SetTypographyTextFontWeight (OH_Drawing_TypographyStyle *, int) Sets the default font weight for a typography style. Currently, only the default system font supports font weight adjustment. For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness. If the weight is greater than or equal to semi-bold, it might result in a fake bold effect.
void OH_Drawing_SetTypographyTextFontStyle (OH_Drawing_TypographyStyle *, int) Sets the default font style for a typography style.
void OH_Drawing_SetTypographyTextFontFamily (OH_Drawing_TypographyStyle *, const char *) Sets the font family name for text.
void OH_Drawing_SetTypographyTextFontSize (OH_Drawing_TypographyStyle *, double) Sets the font size for text.
void OH_Drawing_SetTypographyTextFontHeight (OH_Drawing_TypographyStyle *, double) Sets the font height for text.
void OH_Drawing_SetTypographyTextHalfLeading (OH_Drawing_TypographyStyle *, bool) Sets whether to enable half leading for text.
void OH_Drawing_SetTypographyTextUseLineStyle (OH_Drawing_TypographyStyle *, bool) Sets whether to enable the text line style.
void OH_Drawing_SetTypographyTextLineStyleFontWeight (OH_Drawing_TypographyStyle *, int) Sets the text font weight of the strut style in a typography style. Currently, only the default system font supports font weight adjustment. For other fonts, if the weight is less than semi-bold, there is no variation in stroke thickness. If the weight is greater than or equal to semi-bold, it might result in a fake bold effect.
void OH_Drawing_SetTypographyTextLineStyleFontStyle (OH_Drawing_TypographyStyle *, int) Sets the font style of the strut style in a typography style.
void OH_Drawing_SetTypographyTextLineStyleFontFamilies (OH_Drawing_TypographyStyle *, int, const char *fontFamilies[]) Sets the font families for a text line style.
void OH_Drawing_SetTypographyTextLineStyleFontSize (OH_Drawing_TypographyStyle *, double) Sets the font size for a text line style.
void OH_Drawing_SetTypographyTextLineStyleFontHeight (OH_Drawing_TypographyStyle *, double) Sets the font height for a text line style.
void OH_Drawing_SetTypographyTextLineStyleHalfLeading (OH_Drawing_TypographyStyle *, bool) Sets whether to enable half leading for the strut style in a typography style.
void OH_Drawing_SetTypographyTextLineStyleSpacingScale (OH_Drawing_TypographyStyle *, double) Sets the spacing scale factor for a text line style.
void OH_Drawing_SetTypographyTextLineStyleOnly (OH_Drawing_TypographyStyle *, bool) Sets whether to enable the text line style only.
OH_Drawing_TextShadow * OH_Drawing_CreateTextShadow (void) Creates a pointer to an OH_Drawing_TextShadow object. When OH_Drawing_TextShadow is no longer required, call OH_Drawing_DestroyTextShadow to release the pointer to the object.
void OH_Drawing_DestroyTextShadow (OH_Drawing_TextShadow *) Destroys an OH_Drawing_TextShadow object and reclaims the memory occupied by the object.
OH_Drawing_TextShadow * OH_Drawing_TextStyleGetShadows (OH_Drawing_TextStyle *) Obtains a text shadow container. When OH_Drawing_TextShadow is no longer required, call OH_Drawing_DestroyTextShadows to release the pointer to the object.
int OH_Drawing_TextStyleGetShadowCount (OH_Drawing_TextStyle *) Obtains the size of a text shadow container.
void OH_Drawing_TextStyleAddShadow (OH_Drawing_TextStyle *, const OH_Drawing_TextShadow *) Adds a shadow to a text shadow container.
void OH_Drawing_TextStyleClearShadows (OH_Drawing_TextStyle *) Clears all shadows in a text shadow container.
OH_Drawing_TextShadow * OH_Drawing_TextStyleGetShadowWithIndex (OH_Drawing_TextStyle *, int) Obtains a shadow with a given index in a text shadow container.
void OH_Drawing_TypographySetIndents (OH_Drawing_Typography *, int, const float indents[]) Sets indents for typography. If this function is not called, texts will have no indentation applied.
float OH_Drawing_TypographyGetIndentsWithIndex (OH_Drawing_Typography *, int) Obtains indents with a given index in a typography object. The line index starts from 0.
OH_Drawing_Range * OH_Drawing_TypographyGetLineTextRange (OH_Drawing_Typography *, int, bool) Obtains the line bounds in a typography object. This function must be called after OH_Drawing_TypographyLayout is called. This function can only be used to obtain the bounds of existing lines. That is, the line index must start from 0, and the maximum index is OH_Drawing_TypographyGetLineCount - 1.
void OH_Drawing_DestroyTextShadows (OH_Drawing_TextShadow *) Reclaims the memory occupied by the vector consisting of the OH_Drawing_TextShadow objects.
OH_Drawing_FontConfigInfo * OH_Drawing_GetSystemFontConfigInfo (OH_Drawing_FontConfigInfoErrorCode *) Obtains the system font configuration.
void OH_Drawing_DestroySystemFontConfigInfo (OH_Drawing_FontConfigInfo *) Reclaims the memory occupied by the system font configuration.
void OH_Drawing_SetTextStyleFontStyleStruct (OH_Drawing_TextStyle *drawingTextStyle, OH_Drawing_FontStyleStruct fontStyle) Sets the font style, including the font weight, width, and slant, for a text style.
OH_Drawing_FontStyleStruct OH_Drawing_TextStyleGetFontStyleStruct (OH_Drawing_TextStyle *drawingTextStyle) Obtains the font style, including the font weight, width, and slant, of a text style.
void OH_Drawing_SetTypographyStyleFontStyleStruct (OH_Drawing_TypographyStyle *drawingStyle, OH_Drawing_FontStyleStruct fontStyle) Sets the font style, including the font weight, width, and slant, for the default text style in a typography style.
OH_Drawing_FontStyleStruct OH_Drawing_TypographyStyleGetFontStyleStruct (OH_Drawing_TypographyStyle *drawingStyle) Obtains the font style, including the font weight, width, and slant, of the default text style in a typography style.
void OH_Drawing_TextStyleSetBackgroundRect (OH_Drawing_TextStyle *, const OH_Drawing_RectStyle_Info *, int styleId) Sets a background rectangle and style ID for a text style. The style ID is valid only when the background box is a rounded rectangle.
void OH_Drawing_TypographyHandlerAddSymbol (OH_Drawing_TypographyCreate *, uint32_t symbol) Adds the symbol to use in the typography creation process.
void OH_Drawing_TextStyleAddFontFeature (OH_Drawing_TextStyle *, const char *tag, int value) Adds a font feature for a text style.
void OH_Drawing_TextStyleAddFontVariation (OH_Drawing_TextStyle *, const char *, const float) Adds a font variation. This function takes effect only when the corresponding font file (.ttf file) supports variable adjustment. Otherwise, calling this function does not take effect.
OH_Drawing_FontFeature * OH_Drawing_TextStyleGetFontFeatures (OH_Drawing_TextStyle *) Obtains all the contents in a font feature map container of a text style.
void OH_Drawing_TextStyleDestroyFontFeatures (OH_Drawing_FontFeature *, size_t fontFeatureSize) Reclaims the memory occupied by the struct array that holds all the font features.
size_t OH_Drawing_TextStyleGetFontFeatureSize (OH_Drawing_TextStyle *) Obtains the size of a font feature map container in a text style.
void OH_Drawing_TextStyleClearFontFeature (OH_Drawing_TextStyle *) Clears all the contents in a font feature map container of a text style.
double OH_Drawing_TextStyleGetBaselineShift (OH_Drawing_TextStyle *) Obtains the baseline drift of a text style.
void OH_Drawing_TextStyleSetBaselineShift (OH_Drawing_TextStyle *, double lineShift) Sets a baseline drift for a text style.
void OH_Drawing_TypographyTextSetHeightBehavior (OH_Drawing_TypographyStyle *, OH_Drawing_TextHeightBehavior heightMode) Sets a text height modifier pattern.
OH_Drawing_TextHeightBehavior OH_Drawing_TypographyTextGetHeightBehavior (OH_Drawing_TypographyStyle *) Obtains the text height modifier pattern.
OH_Drawing_Font_Metrics * OH_Drawing_TypographyGetLineFontMetrics (OH_Drawing_Typography *, size_t lineNumber, size_t *fontMetricsSize) Obtains all font metrics from a given line in a typography object. This function must be called after OH_Drawing_TypographyLayout is called. Otherwise, a null pointer is returned. When OH_Drawing_Font_Metrics is no longer required, call OH_Drawing_TypographyDestroyLineFontMetrics to release the pointer to the object.
void OH_Drawing_TypographyDestroyLineFontMetrics (OH_Drawing_Font_Metrics *) Reclaims the memory occupied by the struct array that holds all the font metrics of a given line.
bool OH_Drawing_TextStyleIsEqual (const OH_Drawing_TextStyle *style, const OH_Drawing_TextStyle *comparedStyle) Checks whether two text styles are equal. The word width property is not involved in the comparison.
bool OH_Drawing_TextStyleIsEqualByFont (const OH_Drawing_TextStyle *style, const OH_Drawing_TextStyle *comparedStyle) Checks whether the font style properties of two text styles are equal.
bool OH_Drawing_TextStyleIsAttributeMatched (const OH_Drawing_TextStyle *style, const OH_Drawing_TextStyle *comparedStyle, OH_Drawing_TextStyleType textStyleType) Checks whether two text styles have the same text style type.
void OH_Drawing_TextStyleSetPlaceholder (OH_Drawing_TextStyle *style) Sets a placeholder for a text style.
bool OH_Drawing_TextStyleIsPlaceholder (OH_Drawing_TextStyle *style) Checks whether a placeholder is set for a text style.
OH_Drawing_TextAlign OH_Drawing_TypographyStyleGetEffectiveAlignment (OH_Drawing_TypographyStyle *style) Obtains the text alignment mode.
bool OH_Drawing_TypographyStyleIsHintEnabled (OH_Drawing_TypographyStyle *style) Checks whether font hinting is enabled for a typography style. Font hinting is used to improve the readability and appearance of small-sized text when rendering it.
void OH_Drawing_SetTypographyStyleTextStrutStyle (OH_Drawing_TypographyStyle *, OH_Drawing_StrutStyle *) Sets the strut style for a typography style.
OH_Drawing_StrutStyle * OH_Drawing_TypographyStyleGetStrutStyle (OH_Drawing_TypographyStyle *) Obtains the strut style of a typography style.
void OH_Drawing_TypographyStyleDestroyStrutStyle (OH_Drawing_StrutStyle *) Reclaims the memory occupied by a strut style.
bool OH_Drawing_TypographyStyleStrutStyleEquals (OH_Drawing_StrutStyle *from, OH_Drawing_StrutStyle *to) Checks whether two strut styles are equal.
void OH_Drawing_TypographyStyleSetHintsEnabled (OH_Drawing_TypographyStyle *style, bool hintsEnabled) Sets whether to enable font hinting for a typography style. Font hinting is used to improve the readability and appearance of small-sized text when rendering it.
void OH_Drawing_TypographyMarkDirty (OH_Drawing_Typography *) Marks a typography object as dirty data. This function is used to initialize the typography state.
int32_t OH_Drawing_TypographyGetUnresolvedGlyphsCount (OH_Drawing_Typography *) Obtains the number of unresolved glyphs in a typography object. This function can be called only after OH_Drawing_TypographyLayout is called and applied.
void OH_Drawing_TypographyUpdateFontSize (OH_Drawing_Typography *, size_t from, size_t to, float fontSize) Updates the font size in a typography object.
bool OH_Drawing_TypographyTextGetLineStyle (OH_Drawing_TypographyStyle *) Checks whether the text line style is enabled for a typography style.
OH_Drawing_FontWeight OH_Drawing_TypographyTextlineStyleGetFontWeight (OH_Drawing_TypographyStyle *) Obtains the font weight of the strut style in a typography style.
OH_Drawing_FontStyle OH_Drawing_TypographyTextlineStyleGetFontStyle (OH_Drawing_TypographyStyle *) Obtains the font style of the strut style in the typography style.
char ** OH_Drawing_TypographyTextlineStyleGetFontFamilies (OH_Drawing_TypographyStyle *, size_t *num) Obtains the font families of a text line style.
void OH_Drawing_TypographyTextlineStyleDestroyFontFamilies (char **fontFamilies, size_t fontFamiliesNum) Reclaims the memory occupied by the font families.
double OH_Drawing_TypographyTextlineStyleGetFontSize (OH_Drawing_TypographyStyle *) Obtains the font size of a text line style.
double OH_Drawing_TypographyTextlineStyleGetHeightScale (OH_Drawing_TypographyStyle *) Obtains the height scale factor of a text line style.
bool OH_Drawing_TypographyTextlineStyleGetHeightOnly (OH_Drawing_TypographyStyle *) Checks whether only the font height is used for a text line style.
bool OH_Drawing_TypographyTextlineStyleGetHalfLeading (OH_Drawing_TypographyStyle *) Checks whether half leading is enabled for a text line style.
double OH_Drawing_TypographyTextlineStyleGetSpacingScale (OH_Drawing_TypographyStyle *) Obtains the spacing factor scale of a text line style.
bool OH_Drawing_TypographyTextlineGetStyleOnly (OH_Drawing_TypographyStyle *) Checks whether only the text line style is enabled for a typography style.
OH_Drawing_TextAlign OH_Drawing_TypographyGetTextAlign (OH_Drawing_TypographyStyle *) Obtains the text alignment mode.
OH_Drawing_TextDirection OH_Drawing_TypographyGetTextDirection (OH_Drawing_TypographyStyle *) Obtains the text direction of a typography style.
size_t OH_Drawing_TypographyGetTextMaxLines (OH_Drawing_TypographyStyle *) Obtains the maximum number of lines.
char * OH_Drawing_TypographyGetTextEllipsis (OH_Drawing_TypographyStyle *) Obtains the text ellipsis content of a typography style.
void OH_Drawing_TypographyDestroyEllipsis (char *ellipsis) Reclaims the memory occupied by the text ellipsis names.
bool OH_Drawing_TypographyStyleEquals (OH_Drawing_TypographyStyle *from, OH_Drawing_TypographyStyle *to) Checks whether two typography styles are the same. The text height modifier mode OH_Drawing_TextHeightBehavior is not involved in the comparison.
uint32_t OH_Drawing_TextStyleGetColor (OH_Drawing_TextStyle *) Obtains the color of a text style.
OH_Drawing_TextDecorationStyle OH_Drawing_TextStyleGetDecorationStyle (OH_Drawing_TextStyle *) Obtains the decoration style of a text style.
OH_Drawing_FontWeight OH_Drawing_TextStyleGetFontWeight (OH_Drawing_TextStyle *) Obtains the font weight of a text style.
OH_Drawing_FontStyle OH_Drawing_TextStyleGetFontStyle (OH_Drawing_TextStyle *) Obtains the font style of a text style.
OH_Drawing_TextBaseline OH_Drawing_TextStyleGetBaseline (OH_Drawing_TextStyle *) Obtains the baseline of a text style.
char ** OH_Drawing_TextStyleGetFontFamilies (OH_Drawing_TextStyle *, size_t *num) Obtains the font families of a text style.
void OH_Drawing_TextStyleDestroyFontFamilies (char **fontFamilies, size_t num) Reclaims the memory occupied by the font families, where num specifies the number of font families.
double OH_Drawing_TextStyleGetFontSize (OH_Drawing_TextStyle *) Obtains the font size of a text style.
double OH_Drawing_TextStyleGetLetterSpacing (OH_Drawing_TextStyle *) Obtains the letter spacing of a text style.
double OH_Drawing_TextStyleGetWordSpacing (OH_Drawing_TextStyle *) Obtains the word spacing of a text style.
double OH_Drawing_TextStyleGetFontHeight (OH_Drawing_TextStyle *) Obtains the font height of a text style.
bool OH_Drawing_TextStyleGetHalfLeading (OH_Drawing_TextStyle *) Checks whether half leading is enabled for a text style.
const char * OH_Drawing_TextStyleGetLocale (OH_Drawing_TextStyle *) Obtains the locale of a text style.
void OH_Drawing_TypographyDestroyTextBox (OH_Drawing_TextBox *) Releases the memory occupied by a text box.
void OH_Drawing_SetTextShadow (OH_Drawing_TextShadow *shadow, uint32_t color, OH_Drawing_Point *offset, double blurRadius) Sets a text shadow.
OH_Drawing_TextTab * OH_Drawing_CreateTextTab (OH_Drawing_TextAlign alignment, float location) Creates a text tab object.
void OH_Drawing_DestroyTextTab (OH_Drawing_TextTab *) Releases the memory occupied by a text tab object.
OH_Drawing_TextAlign OH_Drawing_GetTextTabAlignment (OH_Drawing_TextTab *) Obtains the alignment mode of a text tab.
float OH_Drawing_GetTextTabLocation (OH_Drawing_TextTab *) Obtains the location of a text tab.
void OH_Drawing_SetTypographyTextTab (OH_Drawing_TypographyStyle *, OH_Drawing_TextTab *TextTab) Sets the alignment mode and location of a text tab. When the text alignment mode or ellipsis style is set, the tab does not take effect. When the tab location is less than 1.0, the tab is replaced with a space.
size_t OH_Drawing_GetDrawingArraySize (OH_Drawing_Array *drawingArray) Obtains the number of objects in an OH_Drawing_Array.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙ArkGraphics 2D

harmony 鸿蒙BufferHandle

harmony 鸿蒙ColorSpacePrimaries

harmony 鸿蒙DisplaySoloist_ExpectedRateRange

harmony 鸿蒙_drawing

harmony 鸿蒙NativeColorSpaceManager

harmony 鸿蒙NativeDisplaySoloist

harmony 鸿蒙NativeVsync

harmony 鸿蒙NativeWindow

harmony 鸿蒙OH_Drawing_BitmapFormat

0  赞