C# Class XNAExtras.BitmapFont

Bitmap font class for XNA
Mostra file Open project: jackpal/Dandy-Dungeon Class Usage Examples

Public Methods

Method Description
BitmapFont ( string strFontFilename ) : System

Create a new font from the info in the specified font descriptor (XML) file

DrawString ( Color color, string format ) : int

Draw the given string using the specified color. The text drawing location is immediately after the last drawn text (default=0,0).

DrawString ( Vector2 vOrigin, Color color, string format ) : int

Draw the given string at vOrigin using the specified color

DrawString ( int x, int y, Color color, string format ) : int

Draw the given string at (x,y) using the specified color

DrawString ( int x, int y, string format ) : int

Draw the given string at (x,y). The text color is inherited from the last draw command (default=White).

DrawString ( string format ) : int

Draw the given string at (x,y). The text drawing location is immediately after the last drawn text (default=0,0). The text color is inherited from the last draw command (default=White).

MeasureString ( string format ) : int

Calculate the width of the given string.

Reset ( GraphicsDevice device ) : void

Reset the font when the device has changed

SetPen ( int x, int y ) : void

Set the current pen position

Private Methods

Method Description
CalcKern ( char chLeft, char chRight ) : int

Get the kern value for the given pair of characters

GetXMLAttribute ( XmlNode n, string strAttr ) : string

Get the XML attribute value (without throwing if the attribute doesn't exist)

LoadFontXML ( XmlNodeList xnl ) : void

Load the font data from an XML font descriptor file

LoadFontXML_bitmaps ( XmlNodeList xnl ) : void

Load the data from the "bitmaps" node

LoadFontXML_font ( XmlNodeList xnl ) : void

Load the data from the "font" node

LoadFontXML_glyphs ( XmlNodeList xnl ) : void

Load the data from the "glyphs" node

LoadFontXML_kernpairs ( XmlNodeList xnl ) : void

Load the data from the "kernpairs" node

Method Details

BitmapFont() public method

Create a new font from the info in the specified font descriptor (XML) file
public BitmapFont ( string strFontFilename ) : System
strFontFilename string font file (.xml)
return System

DrawString() public method

Draw the given string using the specified color. The text drawing location is immediately after the last drawn text (default=0,0).
public DrawString ( Color color, string format ) : int
color Color Text color
format string String format
return int

DrawString() public method

Draw the given string at vOrigin using the specified color
public DrawString ( Vector2 vOrigin, Color color, string format ) : int
vOrigin Vector2 (x,y) coord
color Color Text color
format string String format
return int

DrawString() public method

Draw the given string at (x,y) using the specified color
public DrawString ( int x, int y, Color color, string format ) : int
x int X-coord
y int Y-coord
color Color Text color
format string String format
return int

DrawString() public method

Draw the given string at (x,y). The text color is inherited from the last draw command (default=White).
public DrawString ( int x, int y, string format ) : int
x int X-coord
y int Y-coord
format string String format
return int

DrawString() public method

Draw the given string at (x,y). The text drawing location is immediately after the last drawn text (default=0,0). The text color is inherited from the last draw command (default=White).
public DrawString ( string format ) : int
format string String format
return int

MeasureString() public method

Calculate the width of the given string.
public MeasureString ( string format ) : int
format string String format
return int

Reset() public method

Reset the font when the device has changed
public Reset ( GraphicsDevice device ) : void
device GraphicsDevice The new device
return void

SetPen() public method

Set the current pen position
public SetPen ( int x, int y ) : void
x int X-coord
y int Y-coord
return void