tk2dTextMesh Class Reference

Text mesh. More...

Inherits tk2dRuntime.ISpriteCollectionForceBuild.

List of all members.

Public Member Functions

string FormatText (string unformattedString)
 Formats the string using the current settings, and returns the formatted string. You can use this if you need to calculate how many lines your string is going to be wrapped to.
int NumDrawnCharacters ()
 Returns the number of characters drawn for the currently active string. This may be less than string.Length - some characters are used as escape codes for switching texture gradient ^0-^9 Also, there might be more characters in the string than have been allocated for the textmesh, in which case the string will be truncated.
int NumTotalCharacters ()
 Returns the number of characters excluding texture gradient escape codes.
Bounds GetEstimatedMeshBoundsForString (string str)
 Calculates an estimated bounds for the given string if it were rendered using the current settings. This expects an unformatted string and will wrap the string if required.
void Commit ()
 Calling commit is no longer required on text meshes. You can still call commit to manually commit all changes so far in the frame.
void MakePixelPerfect ()
 Makes the text mesh pixel perfect to the active camera. Automatically detects tk2dCamera if present Otherwise uses Camera.main.

Properties

tk2dFontData font [get, set]
 Gets or sets the font. Call Commit to commit changes.
bool formatting [get, set]
 Enables or disables formatting. Call Commit to commit changes.
int wordWrapWidth [get, set]
 Change word wrap width. This only works when formatting is enabled. Call Commit to commit changes.
string text [get, set]
 Gets or sets the text. Call Commit to commit changes.
Color color [get, set]
 Gets or sets the color. Call Commit to commit changes.
Color color2 [get, set]
 Gets or sets the secondary color (used in the gradient). Call Commit to commit changes.
bool useGradient [get, set]
 Use vertex vertical gradient. Call Commit to commit changes.
TextAnchor anchor [get, set]
 Gets or sets the text anchor. Call Commit to commit changes.
Vector3 scale [get, set]
 Gets or sets the scale. Call Commit to commit changes.
bool kerning [get, set]
 Gets or sets kerning state. Call Commit to commit changes.
int maxChars [get, set]
 Gets or sets maxChars. Call Commit to commit changes. NOTE: This will free & allocate memory, avoid using at runtime.
int textureGradient [get, set]
 Gets or sets the default texture gradient. You can also change texture gradient inline by using ^1 - ^9 sequences within your text. Call Commit to commit changes.
bool inlineStyling [get, set]
 Enables or disables inline styling (texture gradient). Call Commit to commit changes.
float Spacing [get, set]
 Additional spacing between characters. This can be negative to bring characters closer together. Call Commit to commit changes.
float LineSpacing [get, set]
 Additional line spacing for multieline text. This can be negative to bring lines closer together. Call Commit to commit changes.
int SortingOrder [get, set]
 Gets or sets the sorting order The sorting order lets you override draw order for sprites which are at the same z position It is similar to offsetting in z - the sprite stays at the original position This corresponds to the renderer.sortingOrder property in Unity 4.3.

Detailed Description

Text mesh.


Member Function Documentation

Calling commit is no longer required on text meshes. You can still call commit to manually commit all changes so far in the frame.

string tk2dTextMesh.FormatText ( string  unformattedString)

Formats the string using the current settings, and returns the formatted string. You can use this if you need to calculate how many lines your string is going to be wrapped to.

Calculates an estimated bounds for the given string if it were rendered using the current settings. This expects an unformatted string and will wrap the string if required.

Makes the text mesh pixel perfect to the active camera. Automatically detects tk2dCamera if present Otherwise uses Camera.main.

Returns the number of characters drawn for the currently active string. This may be less than string.Length - some characters are used as escape codes for switching texture gradient ^0-^9 Also, there might be more characters in the string than have been allocated for the textmesh, in which case the string will be truncated.

Returns the number of characters excluding texture gradient escape codes.


Property Documentation

TextAnchor tk2dTextMesh.anchor [get, set]

Gets or sets the text anchor. Call Commit to commit changes.

Color tk2dTextMesh.color [get, set]

Gets or sets the color. Call Commit to commit changes.

Color tk2dTextMesh.color2 [get, set]

Gets or sets the secondary color (used in the gradient). Call Commit to commit changes.

Gets or sets the font. Call Commit to commit changes.

bool tk2dTextMesh.formatting [get, set]

Enables or disables formatting. Call Commit to commit changes.

bool tk2dTextMesh.inlineStyling [get, set]

Enables or disables inline styling (texture gradient). Call Commit to commit changes.

bool tk2dTextMesh.kerning [get, set]

Gets or sets kerning state. Call Commit to commit changes.

float tk2dTextMesh.LineSpacing [get, set]

Additional line spacing for multieline text. This can be negative to bring lines closer together. Call Commit to commit changes.

int tk2dTextMesh.maxChars [get, set]

Gets or sets maxChars. Call Commit to commit changes. NOTE: This will free & allocate memory, avoid using at runtime.

Vector3 tk2dTextMesh.scale [get, set]

Gets or sets the scale. Call Commit to commit changes.

int tk2dTextMesh.SortingOrder [get, set]

Gets or sets the sorting order The sorting order lets you override draw order for sprites which are at the same z position It is similar to offsetting in z - the sprite stays at the original position This corresponds to the renderer.sortingOrder property in Unity 4.3.

float tk2dTextMesh.Spacing [get, set]

Additional spacing between characters. This can be negative to bring characters closer together. Call Commit to commit changes.

string tk2dTextMesh.text [get, set]

Gets or sets the text. Call Commit to commit changes.

Gets or sets the default texture gradient. You can also change texture gradient inline by using ^1 - ^9 sequences within your text. Call Commit to commit changes.

bool tk2dTextMesh.useGradient [get, set]

Use vertex vertical gradient. Call Commit to commit changes.

Change word wrap width. This only works when formatting is enabled. Call Commit to commit changes.