drawing_text_typography.h

概述

定义绘制模块中排版相关的函数。

起始版本:

8

相关模块:

Drawing

汇总

枚举

枚举名称 描述
OH_Drawing_TextDirection { TEXT_DIRECTION_RTL, TEXT_DIRECTION_LTR } 文字方向
OH_Drawing_TextAlign { TEXT_ALIGN_LEFT, TEXT_ALIGN_RIGHT, TEXT_ALIGN_CENTER, TEXT_ALIGN_JUSTIFY, TEXT_ALIGN_START, TEXT_ALIGN_END } 文字对齐方式
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 } 字重
OH_Drawing_TextBaseline { TEXT_BASELINE_ALPHABETIC, TEXT_BASELINE_IDEOGRAPHIC } 基线位置
OH_Drawing_TextDecoration { TEXT_DECORATION_NONE = 0x0, TEXT_DECORATION_UNDERLINE = 0x1, TEXT_DECORATION_OVERLINE = 0x2, TEXT_DECORATION_LINE_THROUGH = 0x4 } 文本装饰
OH_Drawing_FontStyle { FONT_STYLE_NORMAL, FONT_STYLE_ITALIC } 区分字体是否为斜体
OH_Drawing_TypographyGetMaxWidth (OH_Drawing_Typography *) 获取最大宽度。
OH_Drawing_TypographyGetHeight (OH_Drawing_Typography *) 获取高度。
OH_Drawing_TypographyGetLongestLine (OH_Drawing_Typography *) 获取最长行。
OH_Drawing_TypographyGetMinIntrinsicWidth (OH_Drawing_Typography *) 获取最小固有宽度。
OH_Drawing_TypographyGetMaxIntrinsicWidth (OH_Drawing_Typography *) 获取最大固有宽度。
OH_Drawing_TypographyGetAlphabeticBaseline(OH_Drawing_Typography *) 获取字母文字基线。
OH_Drawing_TypographyGetIdeographicBaseline (OH_Drawing_Typography *) 获取表意文字基线。

函数

函数名称 描述
OH_Drawing_CreateTypographyStyle (void) 创建OH_Drawing_TypographyStyle
OH_Drawing_DestroyTypographyStyle (OH_Drawing_TypographyStyle *) 释放被OH_Drawing_TypographyStyle对象占据的内存
OH_Drawing_SetTypographyTextDirection (OH_Drawing_TypographyStyle *, int) 设置文本方向
OH_Drawing_SetTypographyTextAlign (OH_Drawing_TypographyStyle *, int) 设置文本对齐方式
OH_Drawing_SetTypographyTextMaxLines (OH_Drawing_TypographyStyle *, int) 设置文本最大行数
OH_Drawing_CreateTextStyle (void) 创建OH_Drawing_TextStyle
OH_Drawing_DestroyTextStyle (OH_Drawing_TextStyle *) 释放被OH_Drawing_TextStyle对象占据的内存
OH_Drawing_SetTextStyleColor (OH_Drawing_TextStyle *, uint32_t) 设置文本颜色
OH_Drawing_SetTextStyleFontSize (OH_Drawing_TextStyle *, double) 设置字号
OH_Drawing_SetTextStyleFontWeight (OH_Drawing_TextStyle *, int) 设置字重
OH_Drawing_SetTextStyleBaseLine (OH_Drawing_TextStyle *, int) 设置字体基线位置
OH_Drawing_SetTextStyleDecoration (OH_Drawing_TextStyle *, int) 设置装饰
OH_Drawing_SetTextStyleDecorationColor (OH_Drawing_TextStyle *, uint32_t) 设置装饰颜色
OH_Drawing_SetTextStyleFontHeight (OH_Drawing_TextStyle *, double) 设置字体高度
OH_Drawing_SetTextStyleFontFamilies (OH_Drawing_TextStyle *, int, const char *fontFamilies[]) 设置字体类型
OH_Drawing_SetTextStyleFontStyle (OH_Drawing_TextStyle *, int) 设置字体风格
OH_Drawing_SetTextStyleLocale (OH_Drawing_TextStyle *, const char *) 设置语言区域
OH_Drawing_CreateTypographyHandler (OH_Drawing_TypographyStyle *, OH_Drawing_FontCollection *) 创建指向OH_Drawing_TypographyCreate对象的指针
OH_Drawing_DestroyTypographyHandler (OH_Drawing_TypographyCreate *) 释放被OH_Drawing_TypographyCreate对象占据的内存
OH_Drawing_TypographyHandlerPushTextStyle (OH_Drawing_TypographyCreate *, OH_Drawing_TextStyle *) 设置排版风格
OH_Drawing_TypographyHandlerAddText (OH_Drawing_TypographyCreate *, const char *) 设置文本内容
OH_Drawing_TypographyHandlerPopTextStyle (OH_Drawing_TypographyCreate *) 排版弹出
OH_Drawing_CreateTypography (OH_Drawing_TypographyCreate *) 创建OH_Drawing_Typography
OH_Drawing_DestroyTypography (OH_Drawing_Typography *) 释放OH_Drawing_Typography对象占据的内存
OH_Drawing_TypographyLayout (OH_Drawing_Typography *, double) 排版布局
OH_Drawing_TypographyPaint (OH_Drawing_Typography *, OH_Drawing_Canvas *, double, double) 显示文本