openharmony 鸿蒙 arkts-apis-graphics-drawing-i

2026-08-25 浏览 (1)

Interfaces (Others)

NOTE

  • The initial APIs of this module are supported since API version 11. Newly added APIs will be marked with a superscript to indicate their earliest API version.

  • This module uses the physical pixel unit, px.

  • The module operates under a single-threaded model. The caller needs to manage thread safety and context state transitions.

TextBlobRunBuffer

Describes a series of consecutive glyphs with the same attributes in a text blob.

System capability: SystemCapability.Graphics.Drawing

NameTypeRead-OnlyOptionalDescription
glyphnumberNoNoIndex of the glyph. The value is an integer. If a floating point number is passed in, the value is rounded down.
positionXnumberNoNoX coordinate of the start point of the text blob. The value is a floating point number.
positionYnumberNoNoY coordinate of the start point of the text blob. The value is a floating point number.

FontMetrics

Describes the attributes that describe the font size and layout. A typeface has similar font metrics.

Atomic service API: This API can be used in atomic services since API version 22.

System capability: SystemCapability.Graphics.Drawing

NameTypeRead-OnlyOptionalDescription
flags12+FontMetricsFlagsNoYesFont measurement flags that are valid.
topnumberNoNoMaximum distance from the baseline to the highest coordinate of the text. The value is a floating point number.
ascentnumberNoNoDistance from the baseline to the highest coordinate of the text. The value is a floating point number.
descentnumberNoNoDistance from the baseline to the lowest coordinate of the text. The value is a floating point number.
bottomnumberNoNoMaximum distance from the baseline to the lowest coordinate of the text. The value is a floating point number.
leadingnumberNoNoInterline spacing, that is, the distance from the descent of one line of text to the ascent of the next line. The value is a floating point number.
avgCharWidth12+numberNoYesAverage character width.
maxCharWidth12+numberNoYesMaximum character width.
xMin12+numberNoYesHorizontal distance from the leftmost edge of any glyph bounding box to the origin. This value is usually less than 0, indicating the minimum horizontal coordinate across all glyph bounding boxes.
xMax12+numberNoYesHorizontal distance from the rightmost edge of any glyph bounding box to the origin. The value is a positive number, indicating the maximum horizontal coordinate across all glyph bounding boxes.
xHeight12+numberNoYesHeight of the lowercase letter x. The value is usually a negative value.
capHeight12+numberNoYesHeight of a capital letter. The value is usually a negative value.
underlineThickness12+numberNoYesThickness of the underline.
underlinePosition12+numberNoYesVertical distance from the baseline to the top of the underline. The value is usually a positive number.
strikethroughThickness12+numberNoYesThickness of the strikethrough.
strikethroughPosition12+numberNoYesVertical distance from the baseline to the bottom of the strikethrough. The value is usually a negative value.

FontFeature20+

Defines font features, which are typesetting rules within a font that determine how glyphs look, such as ligatures, alternates, and superscripts/subscripts.

Atomic service API: This API can be used in atomic services since API version 22.

System capability: SystemCapability.Graphics.Drawing

NameTypeRead-OnlyOptionalDescription
namestringNoNoName of a font feature. Common font feature names include liga, frac, and case. A font feature needs a TTF file to work.
valuenumberNoNoValue of a font feature, which is a floating point number. You are advised to determine the valid value range by using a font viewing tool or referring to the font document.

你可能感兴趣的鸿蒙文章

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/fqFaK7B3