torque Torque Game Engine Documentation
TGE Version 1.5.2

GFont Class Reference

#include <gFont.h>

Inheritance diagram for GFont:

Inheritance graph
[legend]

Public Types

enum  Constants {
  TabWidthInSpaces = 3,
  TextureSheetSize = 256
}

Public Member Functions

 GFont ()
virtual ~GFont ()
TextureHandle getTextureHandle (S32 index) const
const PlatformFont::CharInfogetCharInfo (const UTF16 in_charIndex) const
 While this is const to the outside world, it calls loadCharInfo() to load char info as it is used.
U32 getCharHeight (const UTF16 in_charIndex) const
U32 getCharWidth (const UTF16 in_charIndex) const
U32 getCharXIncrement (const UTF16 in_charIndex) const
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 *str16, U32 slen, U32 width, bool breakOnWhitespace) const
U32 getStrNWidth (const UTF16 *, U32 n) const
 These are the preferred width functions.
U32 getStrNWidthPrecise (const UTF16 *, U32 n) const
U32 getStrWidth (const UTF8 *) const
 These UTF8 versions of the width functions will be deprecated, please avoid them.
U32 getStrNWidth (const UTF8 *, U32 n) const
U32 getStrWidthPrecise (const UTF8 *) const
U32 getStrNWidthPrecise (const UTF8 *, U32 n) const
void wrapString (const UTF8 *string, U32 width, Vector< U32 > &startLineOffset, Vector< U32 > &lineLen)
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 importStrip (const char *fileName, U32 padding, U32 kerning)
 Import an image strip generated with exportStrip, make sure parameters match!
const bool hasPlatformFont () const
 Query as to presence of platform font.
bool isAlphaOnly () const
 Query to determine if we should use add or modulate (as A8 textures are treated as having 0 for RGB).
bool read (Stream &io_rStream)
bool write (Stream &io_rStream)
void forcePlatformFont (PlatformFont *pf)
 Override existing platform font if any with a new one from an external source.

Static Public Member Functions

static Resource< GFontcreate (const char *faceName, U32 size, const char *cacheDirectory, U32 charset=TGE_ANSI_CHARSET)
static const PlatformFont::CharInfogetDefaultCharInfo ()
static void getFontCacheFilename (const char *faceName, U32 faceSize, U32 buffLen, char *outBuff)
 Get the filename for a cached font.

Protected Member Functions

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

Protected Attributes

voidmMutex

Private Attributes

PlatformFontmPlatformFont
Vector< TextureHandle > mTextureSheets
S32 mCurX
S32 mCurY
S32 mCurSheet
bool mNeedSave
StringTableEntry mGFTFile
StringTableEntry mFaceName
U32 mSize
U32 mCharSet
U32 mHeight
U32 mBaseline
U32 mAscent
U32 mDescent
Vector< PlatformFont::CharInfomCharInfoList
S32 mRemapTable [65536]

Static Private Attributes

static const U32 csm_fileVersion
static S32 smSheetIdCount

Friends

ResourceInstanceconstructFont (Stream &stream)

Member Enumeration Documentation

Enumerator:
TabWidthInSpaces 
TextureSheetSize 


Constructor & Destructor Documentation

GFont::GFont (  ) 

virtual GFont::~GFont (  )  [virtual]


Member Function Documentation

bool GFont::loadCharInfo ( const UTF16  ch  )  [protected]

void GFont::addBitmap ( PlatformFont::CharInfo charInfo  )  [protected]

void GFont::addSheet ( void   )  [protected]

void GFont::assignSheet ( S32  sheetNum,
GBitmap bmp 
) [protected]

static Resource<GFont> GFont::create ( const char *  faceName,
U32  size,
const char *  cacheDirectory,
U32  charset = TGE_ANSI_CHARSET 
) [static]

TextureHandle GFont::getTextureHandle ( S32  index  )  const [inline]

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

While this is const to the outside world, it calls loadCharInfo() to load char info as it is used.

static const PlatformFont::CharInfo& GFont::getDefaultCharInfo (  )  [static]

U32 GFont::getCharHeight ( const UTF16  in_charIndex  )  const [inline]

U32 GFont::getCharWidth ( const UTF16  in_charIndex  )  const [inline]

U32 GFont::getCharXIncrement ( const UTF16  in_charIndex  )  const [inline]

bool GFont::isValidChar ( const UTF16  in_charIndex  )  const [inline]

const U32 GFont::getHeight (  )  const [inline]

const U32 GFont::getBaseline (  )  const [inline]

const U32 GFont::getAscent (  )  const [inline]

const U32 GFont::getDescent (  )  const [inline]

U32 GFont::getBreakPos ( const UTF16 str16,
U32  slen,
U32  width,
bool  breakOnWhitespace 
) const

U32 GFont::getStrNWidth ( const UTF16 ,
U32  n 
) const

These are the preferred width functions.

U32 GFont::getStrNWidthPrecise ( const UTF16 ,
U32  n 
) const

U32 GFont::getStrWidth ( const UTF8  )  const

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

U32 GFont::getStrNWidth ( const UTF8 ,
U32  n 
) const

U32 GFont::getStrWidthPrecise ( const UTF8  )  const

U32 GFont::getStrNWidthPrecise ( const UTF8 ,
U32  n 
) const

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

void GFont::dumpInfo (  ) 

Dump information about this font to the console.

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

Export to an image strip for image processing.

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

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

const bool GFont::hasPlatformFont (  )  const [inline]

Query as to presence of platform font.

If absent, we cannot generate more chars!

bool GFont::isAlphaOnly (  )  const [inline]

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

static void GFont::getFontCacheFilename ( const char *  faceName,
U32  faceSize,
U32  buffLen,
char *  outBuff 
) [static]

Get the filename for a cached font.

bool GFont::read ( Stream io_rStream  ) 

bool GFont::write ( Stream io_rStream  ) 

void GFont::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!


Friends And Related Function Documentation

ResourceInstance* constructFont ( Stream stream  )  [friend]


Field Documentation

const U32 GFont::csm_fileVersion [static, private]

S32 GFont::smSheetIdCount [static, private]

Vector<TextureHandle> GFont::mTextureSheets [private]

S32 GFont::mCurX [private]

S32 GFont::mCurY [private]

S32 GFont::mCurSheet [private]

bool GFont::mNeedSave [private]

U32 GFont::mSize [private]

U32 GFont::mCharSet [private]

U32 GFont::mHeight [private]

U32 GFont::mBaseline [private]

U32 GFont::mAscent [private]

U32 GFont::mDescent [private]

S32 GFont::mRemapTable[65536] [private]

void* GFont::mMutex [protected]




All Rights Reserved GarageGames.com, Inc. 1999-2005
Auto-magically Generated with Doxygen