GFont Class Reference

#include <gFont.h>

List of all members.

Public Types

 TabWidthInSpaces = 3
 TextureSheetSize = 256
enum  Constants {
  TabWidthInSpaces = 3,
  TextureSheetSize = 256
}

Public Member Functions

 GFont ()
virtual ~GFont ()
GFXTexHandle getTextureHandle (S32 index) const
const PlatformFont::CharInfogetCharInfo (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.
U32 getStrNWidthPrecise (const UTF16 *, U32 n)
U32 getStrWidth (const UTF8 *)
 These UTF8 versions of the width functions will be deprecated, please avoid them.
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 () const
 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!
void setPlatformFont (PlatformFont *inPlatformFont)
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).
String getFontFaceName () const
 Get the face name of the font.
U32 getFontSize () const
U32 getFontCharSet () const
bool read (Stream &io_rStream)
bool write (Stream &io_rStream)

Static Public Member Functions

static Resource< GFontcreate (const String &faceName, U32 size, const char *cacheDirectory, U32 charset=TGE_ANSI_CHARSET)
static const PlatformFont::CharInfogetDefaultCharInfo ()
static String getFontCacheFilename (const String &faceName, U32 faceSize)
 Get the filename for a cached font.
static GFontload (const Torque::Path &path)

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< GFXTexHandlemTextureSheets
S32 mCurX
S32 mCurY
S32 mCurSheet
bool mNeedSave
Torque::Path mGFTFile
String mFaceName
U32 mSize
U32 mCharSet
U32 mHeight
U32 mBaseline
U32 mAscent
U32 mDescent
Vector< PlatformFont::CharInfomCharInfoList
 List of character info structures, must be accessed through the getCharInfo(U32) function to account for remapping.
S32 mRemapTable [65536]
 Index remapping.

Static Private Attributes

static const U32 csm_fileVersion


Member Enumeration Documentation

Enumerator:
TabWidthInSpaces 
TextureSheetSize 


Constructor & Destructor Documentation

GFont::GFont (  ) 

virtual GFont::~GFont (  )  [virtual]


Member Function Documentation

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

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

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

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

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

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

U32 GFont::getCharXIncrement ( const UTF16  in_charIndex  )  [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 string,
U32  strlen,
U32  width,
bool  breakOnWhitespace 
)

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

These are the preferred width functions.

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

U32 GFont::getStrWidth ( const UTF8  ) 

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

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

U32 GFont::getStrWidthPrecise ( const UTF8  ) 

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

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

void GFont::dumpInfo (  )  const

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!

void GFont::setPlatformFont ( PlatformFont inPlatformFont  ) 

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 String GFont::getFontCacheFilename ( const String faceName,
U32  faceSize 
) [static]

Get the filename for a cached font.

String GFont::getFontFaceName (  )  const [inline]

Get the face name of the font.

U32 GFont::getFontSize (  )  const [inline]

U32 GFont::getFontCharSet (  )  const [inline]

bool GFont::read ( Stream io_rStream  ) 

bool GFont::write ( Stream io_rStream  ) 

static GFont* GFont::load ( const Torque::Path path  )  [static]

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]


Member Data Documentation

void* GFont::mMutex [protected]

const U32 GFont::csm_fileVersion [static, private]

S32 GFont::mCurX [private]

S32 GFont::mCurY [private]

S32 GFont::mCurSheet [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]

List of character info structures, must be accessed through the getCharInfo(U32) function to account for remapping.

S32 GFont::mRemapTable[65536] [private]

Index remapping.