Font Library


Data Structures

struct  Glyph
struct  pgeFont

Enumerations

enum  pgeFontSizeType {
  PGE_FONT_SIZE_PIXELS = 0,
  PGE_FONT_SIZE_POINTS
}

Functions

int pgeFontInit (void)
void pgeFontShutdown (void)
pgeFontpgeFontLoad (const char *filename, unsigned int fontsize, enum pgeFontSizeType fontsizetype, enum pgeMemoryLocation location)
pgeFontpgeFontLoadMemory (unsigned char *data, int datasize, unsigned int fontsize, enum pgeFontSizeType fontsizetype, enum pgeMemoryLocation location)
void pgeFontDestroy (pgeFont *font)
void pgeFontActivate (pgeFont *font)
int pgeFontPrintf (pgeFont *font, short x, short y, unsigned int color, const char *text,...)
int pgeFontPrintfCenter (pgeFont *font, short y, unsigned int color, const char *text,...)
int pgeFontMeasureText (pgeFont *font, const char *text)
int pgeFontMeasureFormattedText (pgeFont *font, const char *text,...)
int pgeFontGetHeight (pgeFont *font)

Enumeration Type Documentation

Enumerator:
PGE_FONT_SIZE_PIXELS 
PGE_FONT_SIZE_POINTS 


Function Documentation

void pgeFontActivate ( pgeFont font  ) 

Activate the specified font.

Parameters:
font - A valid pgeFont

void pgeFontDestroy ( pgeFont font  ) 

Free the specified font.

Parameters:
font - A valid pgeFont

int pgeFontGetHeight ( pgeFont font  ) 

Get the maximum height of any glyph

Parameters:
font - A valid pgeFont
Returns:
The maximum height of any glyph in the font.

int pgeFontInit ( void   ) 

Initialise the Font library

Returns:
1 on success.

pgeFont* pgeFontLoad ( const char *  filename,
unsigned int  fontsize,
enum pgeFontSizeType  fontsizetype,
enum pgeMemoryLocation  location 
)

Load a TrueType font.

Parameters:
filename - Path to the font
fontsize - Size to set the font to
fontsizetype - One of pgeFontSizeType
location - One of pgeTextureLocation
Returns:
A pgeFont struct

pgeFont* pgeFontLoadMemory ( unsigned char *  data,
int  datasize,
unsigned int  fontsize,
enum pgeFontSizeType  fontsizetype,
enum pgeMemoryLocation  location 
)

Load a TrueType font from memory.

Parameters:
data - Pointer to the start of the memory buffer.
datasize - Size of the buffer
fontsize - Size to set the font to
fontsizetype - One of pgeFontSizeType
location - One of pgeTextureLocation
Returns:
A pgeFont struct

int pgeFontMeasureFormattedText ( pgeFont font,
const char *  text,
  ... 
)

Measure a length of formatted text if it were to be drawn

Parameters:
font - A valid pgeFont
text - Text to measure
Returns:
The total width of the text.

int pgeFontMeasureText ( pgeFont font,
const char *  text 
)

Measure a length of text if it were to be drawn

Parameters:
font - A valid pgeFont
text - Text to measure
Returns:
The total width of the text.

int pgeFontPrintf ( pgeFont font,
short  x,
short  y,
unsigned int  color,
const char *  text,
  ... 
)

Draw text along the baseline starting at x, y (with formatting).

Parameters:
font - A valid pgeFont
x - X position on screen
y - Y position on screen
color - Text color
text - Text to draw
Returns:
The total width of the text drawn.

int pgeFontPrintfCenter ( pgeFont font,
short  y,
unsigned int  color,
const char *  text,
  ... 
)

Draw centred text along the baseline (with formatting).

Parameters:
font - A valid pgeFont
x - X position on screen
y - Y position on screen
color - Text color
text - Text to draw
Returns:
The total width of the text drawn.

void pgeFontShutdown ( void   ) 

Shutdown the Font library


Generated on Mon Sep 22 16:58:14 2008 for Phoenix Game Engine by  doxygen 1.5.5