Udostępnij za pośrednictwem


Canvas.DrawTextRun Method

Definition

Overloads

DrawTextRun(String, Int32, Int32, Int32, Int32, Single, Single, Boolean, Paint)

Draw a run of text, all in a single direction, with optional context for complex text shaping.

DrawTextRun(Char[], Int32, Int32, Int32, Int32, Single, Single, Boolean, Paint)

Draw a run of text, all in a single direction, with optional context for complex text shaping.

DrawTextRun(ICharSequence, Int32, Int32, Int32, Int32, Single, Single, Boolean, Paint)

Draw a run of text, all in a single direction, with optional context for complex text shaping.

DrawTextRun(MeasuredText, Int32, Int32, Int32, Int32, Single, Single, Boolean, Paint)

Draw a run of text, all in a single direction, with optional context for complex text shaping.

DrawTextRun(String, Int32, Int32, Int32, Int32, Single, Single, Boolean, Paint)

Draw a run of text, all in a single direction, with optional context for complex text shaping.

public void DrawTextRun (string text, int start, int end, int contextStart, int contextEnd, float x, float y, bool isRtl, Android.Graphics.Paint paint);
member this.DrawTextRun : string * int * int * int * int * single * single * bool * Android.Graphics.Paint -> unit

Parameters

text
String

the text to render

start
Int32

the start of the text to render. Data before this position can be used for shaping context.

end
Int32

the end of the text to render. Data at or after this position can be used for shaping context.

contextStart
Int32

the index of the start of the shaping context

contextEnd
Int32

the index of the end of the shaping context

x
Single

the x position at which to draw the text

y
Single

the y position at which to draw the text

isRtl
Boolean

whether the run is in RTL direction

paint
Paint

the paint

Remarks

Draw a run of text, all in a single direction, with optional context for complex text shaping.

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 and drawn. The context range is useful for contextual shaping, e.g. Kerning, Arabic contextural form.

The direction of the run is explicitly specified by isRtl. Thus, this method is suitable only for runs of a single direction. Alignment of the text is as determined by the Paint's TextAlign value. Further, 0 <= contextStart <= start <= end <= contextEnd <= text.length must hold on entry.

Also see android.graphics.Paint#getRunAdvance for a corresponding method to measure the text; the advance width of the text drawn matches the value obtained from that method.

Java documentation for android.graphics.Canvas.drawTextRun(java.lang.CharSequence, int, int, int, int, float, float, boolean, android.graphics.Paint).

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

DrawTextRun(Char[], Int32, Int32, Int32, Int32, Single, Single, Boolean, Paint)

Draw a run of text, all in a single direction, with optional context for complex text shaping.

[Android.Runtime.Register("drawTextRun", "([CIIIIFFZLandroid/graphics/Paint;)V", "GetDrawTextRun_arrayCIIIIFFZLandroid_graphics_Paint_Handler", ApiSince=23)]
public virtual void DrawTextRun (char[] text, int index, int count, int contextIndex, int contextCount, float x, float y, bool isRtl, Android.Graphics.Paint paint);
[<Android.Runtime.Register("drawTextRun", "([CIIIIFFZLandroid/graphics/Paint;)V", "GetDrawTextRun_arrayCIIIIFFZLandroid_graphics_Paint_Handler", ApiSince=23)>]
abstract member DrawTextRun : char[] * int * int * int * int * single * single * bool * Android.Graphics.Paint -> unit
override this.DrawTextRun : char[] * int * int * int * int * single * single * bool * Android.Graphics.Paint -> unit

Parameters

text
Char[]

the text to render

index
Int32

the start of the text to render

count
Int32

the count of chars to render

contextIndex
Int32

the start of the context for shaping. Must be no greater than index.

contextCount
Int32

the number of characters in the context for shaping. contexIndex + contextCount must be no less than index + count.

x
Single

the x position at which to draw the text

y
Single

the y position at which to draw the text

isRtl
Boolean

whether the run is in RTL direction

paint
Paint

the paint

Attributes

Remarks

Draw a run of text, all in a single direction, with optional context for complex text shaping.

See #drawTextRun(CharSequence, int, int, int, int, float, float, boolean, Paint) for more details. This method uses a character array rather than CharSequence to represent the string. Also, to be consistent with the pattern established in #drawText, in this method count and contextCount are used rather than offsets of the end position; count = end - start, contextCount = contextEnd - contextStart.

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

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

DrawTextRun(ICharSequence, Int32, Int32, Int32, Int32, Single, Single, Boolean, Paint)

Draw a run of text, all in a single direction, with optional context for complex text shaping.

[Android.Runtime.Register("drawTextRun", "(Ljava/lang/CharSequence;IIIIFFZLandroid/graphics/Paint;)V", "GetDrawTextRun_Ljava_lang_CharSequence_IIIIFFZLandroid_graphics_Paint_Handler", ApiSince=23)]
public virtual void DrawTextRun (Java.Lang.ICharSequence text, int start, int end, int contextStart, int contextEnd, float x, float y, bool isRtl, Android.Graphics.Paint paint);
[<Android.Runtime.Register("drawTextRun", "(Ljava/lang/CharSequence;IIIIFFZLandroid/graphics/Paint;)V", "GetDrawTextRun_Ljava_lang_CharSequence_IIIIFFZLandroid_graphics_Paint_Handler", ApiSince=23)>]
abstract member DrawTextRun : Java.Lang.ICharSequence * int * int * int * int * single * single * bool * Android.Graphics.Paint -> unit
override this.DrawTextRun : Java.Lang.ICharSequence * int * int * int * int * single * single * bool * Android.Graphics.Paint -> unit

Parameters

text
ICharSequence

the text to render

start
Int32

the start of the text to render. Data before this position can be used for shaping context.

end
Int32

the end of the text to render. Data at or after this position can be used for shaping context.

contextStart
Int32

the index of the start of the shaping context

contextEnd
Int32

the index of the end of the shaping context

x
Single

the x position at which to draw the text

y
Single

the y position at which to draw the text

isRtl
Boolean

whether the run is in RTL direction

paint
Paint

the paint

Attributes

Remarks

Draw a run of text, all in a single direction, with optional context for complex text shaping.

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 and drawn. The context range is useful for contextual shaping, e.g. Kerning, Arabic contextural form.

The direction of the run is explicitly specified by isRtl. Thus, this method is suitable only for runs of a single direction. Alignment of the text is as determined by the Paint's TextAlign value. Further, 0 <= contextStart <= start <= end <= contextEnd <= text.length must hold on entry.

Also see android.graphics.Paint#getRunAdvance for a corresponding method to measure the text; the advance width of the text drawn matches the value obtained from that method.

Java documentation for android.graphics.Canvas.drawTextRun(java.lang.CharSequence, int, int, int, int, float, float, boolean, android.graphics.Paint).

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

DrawTextRun(MeasuredText, Int32, Int32, Int32, Int32, Single, Single, Boolean, Paint)

Draw a run of text, all in a single direction, with optional context for complex text shaping.

[Android.Runtime.Register("drawTextRun", "(Landroid/graphics/text/MeasuredText;IIIIFFZLandroid/graphics/Paint;)V", "GetDrawTextRun_Landroid_graphics_text_MeasuredText_IIIIFFZLandroid_graphics_Paint_Handler", ApiSince=29)]
public virtual void DrawTextRun (Android.Graphics.Text.MeasuredText text, int start, int end, int contextStart, int contextEnd, float x, float y, bool isRtl, Android.Graphics.Paint paint);
[<Android.Runtime.Register("drawTextRun", "(Landroid/graphics/text/MeasuredText;IIIIFFZLandroid/graphics/Paint;)V", "GetDrawTextRun_Landroid_graphics_text_MeasuredText_IIIIFFZLandroid_graphics_Paint_Handler", ApiSince=29)>]
abstract member DrawTextRun : Android.Graphics.Text.MeasuredText * int * int * int * int * single * single * bool * Android.Graphics.Paint -> unit
override this.DrawTextRun : Android.Graphics.Text.MeasuredText * int * int * int * int * single * single * bool * Android.Graphics.Paint -> unit

Parameters

text
MeasuredText

the text to render

start
Int32

the start of the text to render. Data before this position can be used for shaping context.

end
Int32

the end of the text to render. Data at or after this position can be used for shaping context.

contextStart
Int32

the index of the start of the shaping context

contextEnd
Int32

the index of the end of the shaping context

x
Single

the x position at which to draw the text

y
Single

the y position at which to draw the text

isRtl
Boolean

whether the run is in RTL direction

paint
Paint

the paint

Attributes

Remarks

Draw a run of text, all in a single direction, with optional context for complex text shaping.

See #drawTextRun(CharSequence, int, int, int, int, float, float, boolean, Paint) for more details. This method uses a MeasuredText rather than CharSequence to represent the string.

Java documentation for android.graphics.Canvas.drawTextRun(android.graphics.text.MeasuredText, int, int, int, int, float, float, boolean, android.graphics.Paint).

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