共用方式為


Paint.GetTextRunAdvances Method

Definition

Retrieve the character advances of the text.

[Android.Runtime.Register("getTextRunAdvances", "([CIIIIZ[FI)F", "GetGetTextRunAdvances_arrayCIIIIZarrayFIHandler", ApiSince=29)]
public virtual float GetTextRunAdvances (char[] chars, int index, int count, int contextIndex, int contextCount, bool isRtl, float[]? advances, int advancesIndex);
[<Android.Runtime.Register("getTextRunAdvances", "([CIIIIZ[FI)F", "GetGetTextRunAdvances_arrayCIIIIZarrayFIHandler", ApiSince=29)>]
abstract member GetTextRunAdvances : char[] * int * int * int * int * bool * single[] * int -> single
override this.GetTextRunAdvances : char[] * int * int * int * int * bool * single[] * int -> single

Parameters

chars
Char[]

the text to measure.

index
Int32

the index of the first character to measure

count
Int32

the number of characters to measure

contextIndex
Int32

the index of the first character to use for shaping context. Context must cover the measureing target.

contextCount
Int32

the number of character to use for shaping context. Context must cover the measureing target.

isRtl
Boolean

whether the run is in RTL direction

advances
Single[]

array to receive the advances, must have room for all advances. This can be null if only total advance is needed

advancesIndex
Int32

the position in advances at which to put the advance corresponding to the character at start

Returns

the total advance in pixels

Attributes

Remarks

Retrieve the character advances of the text.

Returns the total advance width for the characters in the run from index for count of chars, and if advances is not null, the advance assigned to each of these characters (java chars).

The trailing surrogate in a valid surrogate pair is assigned an advance of 0. Thus the number of returned advances is always equal to count, not to the number of unicode codepoints represented by the run.

In the case of conjuncts or combining marks, the total advance is assigned to the first logical character, and the following characters are assigned an advance of 0.

This generates the sum of the advances of glyphs for characters in a reordered cluster as the width of the first logical character in the cluster, and 0 for the widths of all other characters in the cluster. In effect, such clusters are treated like conjuncts.

The shaping bounds limit the amount of context available outside start and end that can be used for shaping analysis. These bounds typically reflect changes in bidi level or font metrics across which shaping does not occur.

Java documentation for android.graphics.Paint.getTextRunAdvances(char[], int, int, int, int, boolean, float[], int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to