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

2026-08-25 浏览 (1)

drawing_text_global.h

Overview

This file declares the functions related to global text information, for example, setting the high contrast mode for text rendering.

File to include: <native_drawing/drawing_text_global.h>

Library: libnative_drawing.so

System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing

Since: 20

Related module: Drawing

Summary

Enumerated value

Nametypedef KeywordDescription
OH_Drawing_TextHighContrastOH_Drawing_TextHighContrastEnum of the high contrast modes for text rendering.
OH_Drawing_TextUndefinedGlyphDisplayOH_Drawing_TextUndefinedGlyphDisplayEnum of the modes for displaying undefined glyphs.

Functions

NameDescription
void OH_Drawing_SetTextHighContrast(OH_Drawing_TextHighContrast action)Sets the high contrast mode for text rendering.
void OH_Drawing_SetTextUndefinedGlyphDisplay(OH_Drawing_TextUndefinedGlyphDisplay undefinedGlyphDisplay)Sets how undefined glyphs are displayed. The setting affects all subsequent text rendering.

Enum Description

OH_Drawing_TextHighContrast

enum OH_Drawing_TextHighContrast

Description

Defines an enum of the high contrast modes for text rendering.

Since: 20

ValueDescription
TEXT_FOLLOW_SYSTEM_HIGH_CONTRASTFollows the high contrast mode for text rendering in the system settings.
TEXT_APP_DISABLE_HIGH_CONTRASTDisables the high contrast mode for text rendering in the application. This mode takes precedence over the one based on system settings.
TEXT_APP_ENABLE_HIGH_CONTRASTEnables the high contrast mode for text rendering in the application. The priority of this mode is higher than the mode following the system settings.

OH_Drawing_TextUndefinedGlyphDisplay

enum OH_Drawing_TextUndefinedGlyphDisplay

Description

Defines an enum of the modes for displaying undefined glyphs.

System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing

Since: 20

ValueDescription
TEXT_NO_GLYPH_USE_DEFAULT = 0Uses the default glyph (which may be a blank box, space, or custom symbol) defined in the font file.
TEXT_NO_GLYPH_USE_TOFU = 1Always uses tofu blocks to represent absent glyphs.

Function Description

OH_Drawing_SetTextHighContrast()

void OH_Drawing_SetTextHighContrast(OH_Drawing_TextHighContrast action)

Description

Sets the high contrast mode for text rendering.

The setting of this API takes effect for the entire process, and all pages in the process share the same mode.

You can call this API to set the high contrast mode, or enable or disable the high contrast mode by toggling the switch on the system settings screen. This API is used to set the high contrast mode for text rendering. The setting of this API takes precedence over the one based on system settings.

This API does not take effect for the text drawing scenario.

System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing

Since: 20

Parameters

NameDescription
OH_Drawing_TextHighContrast actionHigh contrast mode for text rendering. The value is an enumerated value of the OH_Drawing_TextHighContrast type.

OH_Drawing_SetTextUndefinedGlyphDisplay()

void OH_Drawing_SetTextUndefinedGlyphDisplay(OH_Drawing_TextUndefinedGlyphDisplay undefinedGlyphDisplay)

Description

Sets how undefined glyphs are displayed. The setting affects all subsequent text rendering.

System capability: SystemCapability.Graphic.Graphic2D.NativeDrawing

Since: 20

Parameters

NameDescription
OH_Drawing_TextUndefinedGlyphDisplay undefinedGlyphDisplayMode of displaying undefined glyphs. The value is an enumerated value of the OH_Drawing_TextUndefinedGlyphDisplay type.

你可能感兴趣的鸿蒙文章

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-drawing-text-linetypography-h

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

openharmony 鸿蒙 capi-drawing-typeface-h

openharmony 鸿蒙 capi-drawing-brush-h

openharmony 鸿蒙 capi-nativewindow

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