Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
GFont Class Reference

`#include <gFont.h>`

Inheritance diagram for GFont:

## Public Types
enum | Constants { TabWidthInSpaces = 3, TextureSheetSize = 256 }

## Public Member Functions
| GFont ()
virtual | ~GFont ()
TextureHandle | getTextureHandle (S32 index)
const PlatformFont::CharInfo & | getCharInfo (const UTF16 in_charIndex)
U32 | getCharHeight (const UTF16 in_charIndex)
U32 | getCharWidth (const UTF16 in_charIndex)
U32 | getCharXIncrement (const UTF16 in_charIndex)
bool | isValidChar (const UTF16 in_charIndex) const
const U32 | getHeight () const
const U32 | getBaseline () const
const U32 | getAscent () const
const U32 | getDescent () const
U32 | getBreakPos (const UTF16 *string, U32 strlen, U32 width, bool breakOnWhitespace)
U32 | getStrNWidth (const UTF16 *, U32 n)
| These are the preferred width functions. More...
U32 | getStrNWidthPrecise (const UTF16 *, U32 n)
U32 | getStrWidth (const UTF8 *)
| These UTF8 versions of the width functions will be deprecated, please avoid them. More...
U32 | getStrNWidth (const UTF8 *, U32 n)
U32 | getStrWidthPrecise (const UTF8 *)
U32 | getStrNWidthPrecise (const UTF8 *, U32 n)
void | wrapString (const UTF8 *string, U32 width, Vector< U32 > &startLineOffset, Vector< U32 > &lineLen)
void | dumpInfo ()
| Dump information about this font to the console. More...
void | exportStrip (const char *fileName, U32 padding, U32 kerning)
| Export to an image strip for image processing. More...
void | importStrip (const char *fileName, U32 padding, U32 kerning)
| Import an image strip generated with exportStrip, make sure parameters match! More...
const bool | hasPlatformFont () const
bool | isAlphaOnly ()
StringTableEntry | getFontFaceName () const
| Get the face name of the font. More...
bool | readBMFont (Stream &io_rStream)
bool | read (Stream &io_rStream)
bool | write (Stream &io_rStream)
void | forcePlatformFont (PlatformFont *pf)
Public Member Functions inherited from ResourceInstance
| ResourceInstance ()
virtual | ~ResourceInstance ()

## Static Public Member Functions
static Resource< GFont > | create (const char *faceName, U32 size, const char *cacheDirectory, U32 charset=TGE_ANSI_CHARSET)
static const PlatformFont::CharInfo & | getDefaultCharInfo ()
static void | getFontCacheFilename (const char *faceName, U32 faceSize, U32 buffLen, char *outBuff)
| Get the filename for a cached font. More...

## Protected Member Functions
bool | loadCharInfo (const UTF16 ch)
void | addBitmap (PlatformFont::CharInfo &charInfo)
void | addSheet (void)
void | assignSheet (S32 sheetNum, GBitmap *bmp)

## Protected Attributes
void * | mMutex

## Friends
ResourceInstance * | constructNewFont (Stream &stream)
ResourceInstance * | constructBMFont (Stream &stream)

## Additional Inherited Members
Public Attributes inherited from ResourceInstance
ResourceObject * | mSourceResource
| Pointer to the ResourceObject that stores all our book-keeping data. More...

## Member Enumeration Documentation

enum Constants

Enumerator
TabWidthInSpaces |
TextureSheetSize |

## Constructor & Destructor Documentation

GFont | ( |  | ) |

~GFont | ( |  | ) |
| virtual

## Member Function Documentation

void addBitmap | ( | PlatformFont::CharInfo & | charInfo | ) |
| protected

void addSheet | ( | void |  | ) |
| protected

void assignSheet | ( | S32 | sheetNum,
|  | GBitmap * | bmp
| ) |  |
| protected

Resource< GFont > create | ( | const char * | faceName,
|  | U32 | size,
|  | const char * | cacheDirectory,
|  | U32 | charset = `TGE_ANSI_CHARSET`
| ) |  |
| static

void dumpInfo | ( |  | ) |

Dump information about this font to the console.

void exportStrip | ( | const char * | fileName,
|  | U32 | padding,
|  | U32 | kerning
| ) |  |

Export to an image strip for image processing.

void forcePlatformFont | ( | PlatformFont * | pf | ) |
| inline

Override existing platform font if any with a new one from an external source. This is primarily used in font processing tools to enable trickery (ie, putting characters from multiple fonts in a single GFT) and should be used with caution!

const U32 getAscent | ( |  | ) | const
| inline

const U32 getBaseline | ( |  | ) | const
| inline

U32 getBreakPos | ( | const UTF16 * | string,
|  | U32 | strlen,
|  | U32 | width,
|  | bool | breakOnWhitespace
| ) |  |

U32 getCharHeight | ( | const UTF16 | in_charIndex | ) |
| inline

const PlatformFont::CharInfo & getCharInfo | ( | const UTF16 | in_charIndex | ) |

U32 getCharWidth | ( | const UTF16 | in_charIndex | ) |
| inline

U32 getCharXIncrement | ( | const UTF16 | in_charIndex | ) |
| inline

const PlatformFont::CharInfo & getDefaultCharInfo | ( |  | ) |
| static

const U32 getDescent | ( |  | ) | const
| inline

void getFontCacheFilename | ( | const char * | faceName,
|  | U32 | faceSize,
|  | U32 | buffLen,
|  | char * | outBuff
| ) |  |
| static

Get the filename for a cached font.

StringTableEntry getFontFaceName | ( |  | ) | const
| inline

Get the face name of the font.

const U32 getHeight | ( |  | ) | const
| inline

U32 getStrNWidth | ( | const UTF16 * | str,
|  | U32 | n
| ) |  |

These are the preferred width functions.

U32 getStrNWidth | ( | const UTF8 * | str,
|  | U32 | n
| ) |  |

U32 getStrNWidthPrecise | ( | const UTF16 * | str,
|  | U32 | n
| ) |  |

U32 getStrNWidthPrecise | ( | const UTF8 * | str,
|  | U32 | n
| ) |  |

U32 getStrWidth | ( | const UTF8 * | in_pString | ) |

These UTF8 versions of the width functions will be deprecated, please avoid them.

U32 getStrWidthPrecise | ( | const UTF8 * | in_pString | ) |

TextureHandle getTextureHandle | ( | S32 | index | ) |
| inline

const bool hasPlatformFont | ( |  | ) | const
| inline

Query as to presence of platform font. If absent, we cannot generate more chars!

void importStrip | ( | const char * | fileName,
|  | U32 | padding,
|  | U32 | kerning
| ) |  |

Import an image strip generated with exportStrip, make sure parameters match!

bool isAlphaOnly | ( |  | ) |
| inline

Query to determine if we should use add or modulate (as A8 textures are treated as having 0 for RGB).

bool isValidChar | ( | const UTF16 | in_charIndex | ) | const
| inline

bool loadCharInfo | ( | const UTF16 | ch | ) |
| protected

bool read | ( | Stream & | io_rStream | ) |

bool readBMFont | ( | Stream & | io_rStream | ) |

void wrapString | ( | const UTF8 * | string,
|  | U32 | width,
|  | Vector< U32 > & | startLineOffset,
|  | Vector< U32 > & | lineLen
| ) |  |

bool write | ( | Stream & | io_rStream | ) |

## Friends And Related Function Documentation

ResourceInstance* constructBMFont | ( | Stream & | stream | ) |
| friend

ResourceInstance* constructNewFont | ( | Stream & | stream | ) |
| friend

## Member Data Documentation

void* mMutex
| protected

The documentation for this class was generated from the following files:

- graphics/gFont.h
- graphics/gFont.cc