共用方式為


Paint.GetRunAdvance Method

Definition

Overloads

GetRunAdvance(ICharSequence, Int32, Int32, Int32, Int32, Boolean, Int32)
GetRunAdvance(Char[], Int32, Int32, Int32, Int32, Boolean, Int32)

Measure cursor position within a run of text.

GetRunAdvance(String, Int32, Int32, Int32, Int32, Boolean, Int32)

GetRunAdvance(ICharSequence, Int32, Int32, Int32, Int32, Boolean, Int32)

[Android.Runtime.Register("getRunAdvance", "(Ljava/lang/CharSequence;IIIIZI)F", "GetGetRunAdvance_Ljava_lang_CharSequence_IIIIZIHandler", ApiSince=23)]
public virtual float GetRunAdvance (Java.Lang.ICharSequence? text, int start, int end, int contextStart, int contextEnd, bool isRtl, int offset);
[<Android.Runtime.Register("getRunAdvance", "(Ljava/lang/CharSequence;IIIIZI)F", "GetGetRunAdvance_Ljava_lang_CharSequence_IIIIZIHandler", ApiSince=23)>]
abstract member GetRunAdvance : Java.Lang.ICharSequence * int * int * int * int * bool * int -> single
override this.GetRunAdvance : Java.Lang.ICharSequence * int * int * int * int * bool * int -> single

Parameters

text
ICharSequence

the text to measure. Cannot be null.

start
Int32

the index of the start of the range to measure

end
Int32

the index + 1 of the end of the range to measure

contextStart
Int32

the index of the start of the shaping context

contextEnd
Int32

the index + 1 of the end of the shaping context

isRtl
Boolean

whether the run is in RTL direction

offset
Int32

index of caret position

Returns

width measurement between start and offset

Attributes

Remarks

Java documentation for android.graphics.Paint.getRunAdvance(java.lang.CharSequence, int, int, int, int, boolean, 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

GetRunAdvance(Char[], Int32, Int32, Int32, Int32, Boolean, Int32)

Measure cursor position within a run of text.

[Android.Runtime.Register("getRunAdvance", "([CIIIIZI)F", "GetGetRunAdvance_arrayCIIIIZIHandler", ApiSince=23)]
public virtual float GetRunAdvance (char[]? text, int start, int end, int contextStart, int contextEnd, bool isRtl, int offset);
[<Android.Runtime.Register("getRunAdvance", "([CIIIIZI)F", "GetGetRunAdvance_arrayCIIIIZIHandler", ApiSince=23)>]
abstract member GetRunAdvance : char[] * int * int * int * int * bool * int -> single
override this.GetRunAdvance : char[] * int * int * int * int * bool * int -> single

Parameters

text
Char[]

the text to measure. Cannot be null.

start
Int32

the index of the start of the range to measure

end
Int32

the index + 1 of the end of the range to measure

contextStart
Int32

the index of the start of the shaping context

contextEnd
Int32

the index + 1 of the end of the shaping context

isRtl
Boolean

whether the run is in RTL direction

offset
Int32

index of caret position

Returns

width measurement between start and offset

Attributes

Remarks

Measure cursor position within a run of text.

The run of text includes the characters from start to end in the text. In addition, the range contextStart to contextEnd is used as context for the purpose of complex text shaping, such as Arabic text potentially shaped differently based on the text next to it.

All text outside the range contextStart..contextEnd is ignored. The text between start and end will be laid out to be measured.

The returned width measurement is the advance from start to offset. It is generally a positive value, no matter the direction of the run. If offset == end, the return value is simply the width of the whole run from start to end.

Ligatures are formed for characters in the range start..end (but not for start..contextStart or end..contextEnd). If offset points to a character in the middle of such a formed ligature, but at a grapheme cluster boundary, the return value will also reflect an advance in the middle of the ligature. See #getOffsetForAdvance for more discussion of grapheme cluster boundaries.

The direction of the run is explicitly specified by isRtl. Thus, this method is suitable only for runs of a single direction.

All indices are relative to the start of text. Further, 0 <= contextStart <= start <= offset <= end <= contextEnd <= text.length must hold on entry.

Java documentation for android.graphics.Paint.getRunAdvance(char[], int, int, int, int, boolean, 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

GetRunAdvance(String, Int32, Int32, Int32, Int32, Boolean, Int32)

public float GetRunAdvance (string? text, int start, int end, int contextStart, int contextEnd, bool isRtl, int offset);
member this.GetRunAdvance : string * int * int * int * int * bool * int -> single

Parameters

text
String

the text to measure. Cannot be null.

start
Int32

the index of the start of the range to measure

end
Int32

the index + 1 of the end of the range to measure

contextStart
Int32

the index of the start of the shaping context

contextEnd
Int32

the index + 1 of the end of the shaping context

isRtl
Boolean

whether the run is in RTL direction

offset
Int32

index of caret position

Returns

width measurement between start and offset

Remarks

Java documentation for android.graphics.Paint.getRunAdvance(java.lang.CharSequence, int, int, int, int, boolean, 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