Public Member Functions | |
SpriteFont (TextAsset def) | |
Constructor. | |
void | Load (TextAsset def) |
Loads a font from the specified font definition TextAsset and adds it to the font store. | |
SpriteChar | GetSpriteChar (char ch) |
Returns a reference to the SpriteChar that corresponds to the specified character ID (usually the numeric Unicode value). | |
bool | ContainsCharacter (char ch) |
Returns whether the specified character is part of this font definition. | |
float | GetWidth (string str) |
Gets how wide the specified string would be, in pixels. | |
float | GetWidth (string str, int start, int end) |
Gets how wide the specified string would be, in pixels. | |
float | GetWidth (StringBuilder sb, int start, int end) |
Gets how wide the specified string would be, in pixels. | |
float | GetWidth (char prevChar, char c) |
Gets how wide the specified character would be, in pixels, when displayed. | |
float | GetAdvance (char c) |
Returns the xAdvance of the specified character. 0 is returned if the character isn't supported. | |
string | RemoveUnsupportedCharacters (string str) |
Returns a version of the specified string with all characters removed which are not defined for this font. | |
Public Attributes | |
TextAsset | fontDef |
The TextAsset that defines the font. | |
Protected Attributes | |
string | face |
The name of the font face. | |
Properties | |
int | LineHeight [get, set] |
The default height, in pixels, between lines. | |
int | BaseHeight [get] |
The distance, in pixels, from the absolute top of a line to the baseline:. | |
int | PixelSize [get] |
The size (height) of the font, in pixels. This is the height, in pixels of a full-height character. | |
float | CharacterSpacing [get, set] |
An adjustable factor by which you can increase/decrease the spacing between characters. A value of 1.0 will space characters exactly as described by the font. Decreasing this value will place the characters closer together, while increasing it will place them farther apart. |
A class that holds information about a font intended for use with SpriteText.
SpriteFont.SpriteFont | ( | TextAsset | def | ) |
Constructor.
def | TextAsset that defines the font. |
bool SpriteFont.ContainsCharacter | ( | char | ch | ) |
Returns whether the specified character is part of this font definition.
ch | Character to check. |
float SpriteFont.GetAdvance | ( | char | c | ) |
Returns the xAdvance of the specified character. 0 is returned if the character isn't supported.
c | The character to look up. |
SpriteChar SpriteFont.GetSpriteChar | ( | char | ch | ) |
Returns a reference to the SpriteChar that corresponds to the specified character ID (usually the numeric Unicode value).
ch | The numeric value/code of the desired character. This value can be obtained from a char with Convert.ToInt32(). |
float SpriteFont.GetWidth | ( | char | prevChar, | |
char | c | |||
) |
Gets how wide the specified character would be, in pixels, when displayed.
prevChar | The character previous to that being measured. | |
str | The character to measure. |
float SpriteFont.GetWidth | ( | StringBuilder | sb, | |
int | start, | |||
int | end | |||
) |
Gets how wide the specified string would be, in pixels.
str | The string to measure. | |
start | The index of the first character of the substring to be measured. | |
end | The index of the last character of the substring. |
float SpriteFont.GetWidth | ( | string | str, | |
int | start, | |||
int | end | |||
) |
Gets how wide the specified string would be, in pixels.
str | The string to measure. | |
start | The index of the first character of the substring to be measured. | |
end | The index of the last character of the substring. |
float SpriteFont.GetWidth | ( | string | str | ) |
Gets how wide the specified string would be, in pixels.
str | The string to measure. |
void SpriteFont.Load | ( | TextAsset | def | ) |
Loads a font from the specified font definition TextAsset and adds it to the font store.
fontDef | The TextAsset that defines the font. |
string SpriteFont.RemoveUnsupportedCharacters | ( | string | str | ) |
Returns a version of the specified string with all characters removed which are not defined for this font.
str | The string to be stripped of unsupported characters. |
string SpriteFont.face [protected] |
The name of the font face.
TextAsset SpriteFont.fontDef |
The TextAsset that defines the font.
int SpriteFont.BaseHeight [get] |
The distance, in pixels, from the absolute top of a line to the baseline:.
float SpriteFont.CharacterSpacing [get, set] |
An adjustable factor by which you can increase/decrease the spacing between characters. A value of 1.0 will space characters exactly as described by the font. Decreasing this value will place the characters closer together, while increasing it will place them farther apart.
int SpriteFont.LineHeight [get, set] |
The default height, in pixels, between lines.
int SpriteFont.PixelSize [get] |
The size (height) of the font, in pixels. This is the height, in pixels of a full-height character.