FontMap Class Reference

Given a Font object and a text containing all the characters you intend to use, FontMap creates a Texture2D object containg the characters and its corresponding table of UVs. More...

List of all members.

Classes

struct  CharData
 The UV data for a single character. More...

Public Member Functions

 FontMap (Font font, int fontmap_width=512)
 Create a FontMap for the ASCII char set.
 FontMap (Font font, string charset, int fontmap_width=512)
void Dispose ()
 Dispose implementation.
void Initialize (Font font, string charset, int fontmap_width=512)
bool TryGetCharData (char c, out CharData cdata)
 Try to get the CharData needed to draw the character 'c'.

Public Attributes

Texture2D Texture
 The font texture containing all the characters.
Dictionary< char, CharDataCharSet
 Map characters to their corresponding CharData (UV and size data).
float CharPixelHeight
 Character height in pixels - all characters have the same pixel height.

Static Public Attributes

static string AsciiCharSet = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
 The ascii character set as a string.

Properties

bool Disposed [get]
 Return true if this object been disposed.

Detailed Description

Given a Font object and a text containing all the characters you intend to use, FontMap creates a Texture2D object containg the characters and its corresponding table of UVs.

This data is used by GameEngine2D in various text rendering functions.

Examples:

new FontMap( new Font( "D:\\Blah\\YourFont.TTF", 32, FontStyle.Bold ), 512 );

new FontMap( new Font( FontAlias.System, 32, FontStyle.Bold ), 512 );


Constructor & Destructor Documentation

FontMap ( Font  font,
int  fontmap_width = 512 
)

Create a FontMap for the ASCII char set.

Parameters:
fontThe font to use to render characters. Note that FontMap disposes of this Font object.
fontmap_widthThe internal width used by the texture. Height is adjusted automatically so that all characters fit.
FontMap ( Font  font,
string  charset,
int  fontmap_width = 512 
)
Parameters:
fontThe font to use to render characters. Note that FontMap disposes of this Font object.
charsetA string containing all the characters you will ever need when drawing text with this FontMap.
fontmap_widthThe internal with used by the texture (height is adjusted automatically).

Member Function Documentation

void Initialize ( Font  font,
string  charset,
int  fontmap_width = 512 
)
Parameters:
fontThe font to use to render characters. Note that FontMap disposes of this Font object.
charsetA string containing all the characters you will ever need when drawing text with this FontMap.
fontmap_widthThe internal with used by the texture (height is adjusted automatically).