NGUI: Next-Gen UI kit
3.7.2
|
Helper class containing functionality related to using dynamic fonts. More...
Classes | |
class | GlyphInfo |
Public Types | |
enum | Alignment { Alignment.Automatic, Alignment.Left, Alignment.Center, Alignment.Right, Alignment.Justified } |
enum | SymbolStyle { SymbolStyle.None, SymbolStyle.Normal, SymbolStyle.Colored } |
Static Public Member Functions | |
static void | Update () |
Recalculate the 'final' values. More... | |
static void | Update (bool request) |
Recalculate the 'final' values. More... | |
static void | Prepare (string text) |
Prepare to use the specified text. More... | |
static BMSymbol | GetSymbol (string text, int index, int textLength) |
Get the specified symbol. More... | |
static float | GetGlyphWidth (int ch, int prev) |
Get the width of the specified glyph. Returns zero if the glyph could not be retrieved. More... | |
static GlyphInfo | GetGlyph (int ch, int prev) |
Get the specified glyph. More... | |
static float | ParseAlpha (string text, int index) |
Parse Aa syntax alpha encoded in the string. More... | |
static Color | ParseColor (string text, int offset) |
Parse a RrGgBb color encoded in the string. More... | |
static Color | ParseColor24 (string text, int offset) |
Parse a RrGgBb color encoded in the string. More... | |
static Color | ParseColor32 (string text, int offset) |
Parse a RrGgBbAa color encoded in the string. More... | |
static string | EncodeColor (Color c) |
The reverse of ParseColor – encodes a color in RrGgBb format. More... | |
static string | EncodeAlpha (float a) |
The reverse of ParseAlpha – encodes a color in Aa format. More... | |
static string | EncodeColor24 (Color c) |
The reverse of ParseColor24 – encodes a color in RrGgBb format. More... | |
static string | EncodeColor32 (Color c) |
The reverse of ParseColor32 – encodes a color in RrGgBb format. More... | |
static bool | ParseSymbol (string text, ref int index) |
Parse an embedded symbol, such as [FFAA00] (set color) or [-] (undo color change). Returns whether the index was adjusted. More... | |
static bool | ParseSymbol (string text, ref int index, BetterList< Color > colors, bool premultiply, ref int sub, ref bool bold, ref bool italic, ref bool underline, ref bool strike) |
Parse the symbol, if possible. Returns 'true' if the 'index' was adjusted. Advanced symbol support contributed by Rudy Pangestu. More... | |
static string | StripSymbols (string text) |
Runs through the specified string and removes all color-encoding symbols. More... | |
static void | Align (BetterList< Vector3 > verts, int indexOffset, float printedWidth) |
Align the vertices to be right or center-aligned given the line width specified by NGUIText.lineWidth. More... | |
static int | GetExactCharacterIndex (BetterList< Vector3 > verts, BetterList< int > indices, Vector2 pos) |
Get the index of the closest character within the provided list of values. Meant to be used with the arrays created by PrintExactCharacterPositions(). More... | |
static int | GetApproximateCharacterIndex (BetterList< Vector3 > verts, BetterList< int > indices, Vector2 pos) |
Get the index of the closest vertex within the provided list of values. This function first sorts by Y, and only then by X. Meant to be used with the arrays created by PrintApproximateCharacterPositions(). More... | |
static void | EndLine (ref StringBuilder s) |
Convenience function that ends the line by either appending a new line character or replacing a space with one. More... | |
static Vector2 | CalculatePrintedSize (string text) |
Get the printed size of the specified string. The returned value is in pixels. More... | |
static int | CalculateOffsetToFit (string text) |
Calculate the character index offset required to print the end of the specified text. More... | |
static string | GetEndOfLineThatFits (string text) |
Get the end of line that would fit into a field of given width. More... | |
static bool | WrapText (string text, out string finalText) |
Text wrapping functionality. The 'width' and 'height' should be in pixels. More... | |
static bool | WrapText (string text, out string finalText, bool keepCharCount) |
Text wrapping functionality. The 'width' and 'height' should be in pixels. More... | |
static void | Print (string text, BetterList< Vector3 > verts, BetterList< Vector2 > uvs, BetterList< Color32 > cols) |
Print the specified text into the buffers. More... | |
static void | PrintApproximateCharacterPositions (string text, BetterList< Vector3 > verts, BetterList< int > indices) |
Print character positions and indices into the specified buffer. Meant to be used with the "find closest vertex" calculations. More... | |
static void | PrintExactCharacterPositions (string text, BetterList< Vector3 > verts, BetterList< int > indices) |
Print character positions and indices into the specified buffer. This function's data is meant to be used for precise character selection, such as clicking on a link. There are 2 vertices for every index: Bottom Left + Top Right. More... | |
static void | PrintCaretAndSelection (string text, int start, int end, BetterList< Vector3 > caret, BetterList< Vector3 > highlight) |
Print the caret and selection vertices. Note that it's expected that 'text' has been stripped clean of symbols. More... | |
Static Public Attributes | |
static UIFont | bitmapFont |
When printing text, a lot of additional data must be passed in. In order to save allocations, this data is not passed at all, but is rather set in a single place before calling the functions that use it. More... | |
static Font | dynamicFont |
static GlyphInfo | glyph = new GlyphInfo() |
static int | fontSize = 16 |
static float | fontScale = 1f |
static float | pixelDensity = 1f |
static FontStyle | fontStyle = FontStyle.Normal |
static Alignment | alignment = Alignment.Left |
static Color | tint = Color.white |
static int | rectWidth = 1000000 |
static int | rectHeight = 1000000 |
static int | regionWidth = 1000000 |
static int | regionHeight = 1000000 |
static int | maxLines = 0 |
static bool | gradient = false |
static Color | gradientBottom = Color.white |
static Color | gradientTop = Color.white |
static bool | encoding = false |
static float | spacingX = 0f |
static float | spacingY = 0f |
static bool | premultiply = false |
static SymbolStyle | symbolStyle |
static int | finalSize = 0 |
static float | finalSpacingX = 0f |
static float | finalLineHeight = 0f |
static float | baseline = 0f |
static bool | useSymbols = false |
Helper class containing functionality related to using dynamic fonts.
enum NGUIText.Alignment |
enum NGUIText.SymbolStyle |
|
static |
Align the vertices to be right or center-aligned given the line width specified by NGUIText.lineWidth.
|
static |
Calculate the character index offset required to print the end of the specified text.
|
static |
Get the printed size of the specified string. The returned value is in pixels.
|
static |
The reverse of ParseAlpha – encodes a color in Aa format.
|
static |
The reverse of ParseColor – encodes a color in RrGgBb format.
|
static |
The reverse of ParseColor24 – encodes a color in RrGgBb format.
|
static |
The reverse of ParseColor32 – encodes a color in RrGgBb format.
|
static |
Convenience function that ends the line by either appending a new line character or replacing a space with one.
|
static |
Get the index of the closest vertex within the provided list of values. This function first sorts by Y, and only then by X. Meant to be used with the arrays created by PrintApproximateCharacterPositions().
|
static |
Get the end of line that would fit into a field of given width.
|
static |
Get the index of the closest character within the provided list of values. Meant to be used with the arrays created by PrintExactCharacterPositions().
|
static |
Get the specified glyph.
|
static |
Get the width of the specified glyph. Returns zero if the glyph could not be retrieved.
|
static |
Get the specified symbol.
|
static |
Parse Aa syntax alpha encoded in the string.
|
static |
Parse a RrGgBb color encoded in the string.
|
static |
Parse a RrGgBb color encoded in the string.
|
static |
Parse a RrGgBbAa color encoded in the string.
|
static |
Parse an embedded symbol, such as [FFAA00] (set color) or [-] (undo color change). Returns whether the index was adjusted.
|
static |
Parse the symbol, if possible. Returns 'true' if the 'index' was adjusted. Advanced symbol support contributed by Rudy Pangestu.
|
static |
Prepare to use the specified text.
|
static |
Print the specified text into the buffers.
|
static |
Print character positions and indices into the specified buffer. Meant to be used with the "find closest vertex" calculations.
|
static |
Print the caret and selection vertices. Note that it's expected that 'text' has been stripped clean of symbols.
|
static |
Print character positions and indices into the specified buffer. This function's data is meant to be used for precise character selection, such as clicking on a link. There are 2 vertices for every index: Bottom Left + Top Right.
|
static |
Runs through the specified string and removes all color-encoding symbols.
|
static |
Recalculate the 'final' values.
|
static |
Recalculate the 'final' values.
|
static |
Text wrapping functionality. The 'width' and 'height' should be in pixels.
|
static |
Text wrapping functionality. The 'width' and 'height' should be in pixels.
|
static |
|
static |
|
static |
When printing text, a lot of additional data must be passed in. In order to save allocations, this data is not passed at all, but is rather set in a single place before calling the functions that use it.
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |