C# Класс UIFont, DsynBio

Наследование: MonoBehaviour
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
AddSymbol ( string sequence, string spriteName ) : void

Add a new symbol to the font.

CalculatePrintedSize ( string text, bool encoding, SymbolStyle symbolStyle ) : Vector2

Get the printed size of the specified string. The returned value is in local coordinates. Multiply by transform's scale to get pixels.

CheckIfRelated ( UIFont, a, UIFont, b ) : bool

Helper function that determines whether the two atlases are related.

GetEndOfLineThatFits ( string text, float maxWidth, bool encoding, SymbolStyle symbolStyle ) : string

Different line wrapping functionality -- contributed by MightyM. http://www.tasharen.com/forum/index.php?topic=1049.0

MarkAsDirty ( ) : void

Refresh all labels that use this font.

Print ( string text, Color32 color, BetterList verts, BetterList uvs, BetterList cols, bool encoding, SymbolStyle symbolStyle, Alignment, alignment, int lineWidth, bool premultiply ) : void

Print the specified text into the buffers. Note: 'lineWidth' parameter should be in pixels.

RemoveSymbol ( string sequence ) : void

Remove the specified symbol from the font.

RenameSymbol ( string before, string after ) : void

Change an existing symbol's sequence to the specified value.

UsesSprite ( string s ) : bool

Whether the specified sprite is being used by the font.

WrapText ( string text, float maxWidth, int maxLineCount ) : string

Text wrapping functionality. Legacy compatibility function.

WrapText ( string text, float maxWidth, int maxLineCount, bool encoding ) : string

Text wrapping functionality. Legacy compatibility function.

WrapText ( string text, float maxWidth, int maxLineCount, bool encoding, SymbolStyle symbolStyle ) : string

Text wrapping functionality. The 'maxWidth' should be in local coordinates (take pixels and divide them by transform's scale).

Приватные методы

Метод Описание
Align ( BetterList verts, int indexOffset, Alignment, alignment, int x, int lineWidth ) : void

Align the vertices to be right or center-aligned given the specified line width.

EndLine ( StringBuilder &s ) : void

Convenience function that ends the line by either appending a new line character or replacing a space with one.

GetSymbol ( string sequence, bool createIfMissing ) : BMSymbol,

Retrieve the specified symbol, optionally creating it if it's missing.

MatchSymbol ( string text, int offset, int textLength ) : BMSymbol,

Retrieve the symbol at the beginning of the specified sequence, if a match is found.

References ( UIFont, font ) : bool

Helper function that determines whether the font uses the specified one, taking replacements into account.

Trim ( ) : void

Trim the glyphs, making sure they never go past the trimmed texture bounds.

Описание методов

AddSymbol() публичный Метод

Add a new symbol to the font.
public AddSymbol ( string sequence, string spriteName ) : void
sequence string
spriteName string
Результат void

CalculatePrintedSize() публичный Метод

Get the printed size of the specified string. The returned value is in local coordinates. Multiply by transform's scale to get pixels.
public CalculatePrintedSize ( string text, bool encoding, SymbolStyle symbolStyle ) : Vector2
text string
encoding bool
symbolStyle SymbolStyle
Результат Vector2

CheckIfRelated() публичный статический Метод

Helper function that determines whether the two atlases are related.
public static CheckIfRelated ( UIFont, a, UIFont, b ) : bool
a UIFont,
b UIFont,
Результат bool

GetEndOfLineThatFits() публичный Метод

Different line wrapping functionality -- contributed by MightyM. http://www.tasharen.com/forum/index.php?topic=1049.0
public GetEndOfLineThatFits ( string text, float maxWidth, bool encoding, SymbolStyle symbolStyle ) : string
text string
maxWidth float
encoding bool
symbolStyle SymbolStyle
Результат string

MarkAsDirty() публичный Метод

Refresh all labels that use this font.
public MarkAsDirty ( ) : void
Результат void

Print() публичный Метод

Print the specified text into the buffers. Note: 'lineWidth' parameter should be in pixels.
public Print ( string text, Color32 color, BetterList verts, BetterList uvs, BetterList cols, bool encoding, SymbolStyle symbolStyle, Alignment, alignment, int lineWidth, bool premultiply ) : void
text string
color UnityEngine.Color32
verts BetterList
uvs BetterList
cols BetterList
encoding bool
symbolStyle SymbolStyle
alignment Alignment,
lineWidth int
premultiply bool
Результат void

RemoveSymbol() публичный Метод

Remove the specified symbol from the font.
public RemoveSymbol ( string sequence ) : void
sequence string
Результат void

RenameSymbol() публичный Метод

Change an existing symbol's sequence to the specified value.
public RenameSymbol ( string before, string after ) : void
before string
after string
Результат void

UsesSprite() публичный Метод

Whether the specified sprite is being used by the font.
public UsesSprite ( string s ) : bool
s string
Результат bool

WrapText() публичный Метод

Text wrapping functionality. Legacy compatibility function.
public WrapText ( string text, float maxWidth, int maxLineCount ) : string
text string
maxWidth float
maxLineCount int
Результат string

WrapText() публичный Метод

Text wrapping functionality. Legacy compatibility function.
public WrapText ( string text, float maxWidth, int maxLineCount, bool encoding ) : string
text string
maxWidth float
maxLineCount int
encoding bool
Результат string

WrapText() публичный Метод

Text wrapping functionality. The 'maxWidth' should be in local coordinates (take pixels and divide them by transform's scale).
public WrapText ( string text, float maxWidth, int maxLineCount, bool encoding, SymbolStyle symbolStyle ) : string
text string
maxWidth float
maxLineCount int
encoding bool
symbolStyle SymbolStyle
Результат string