Torque2D Reference
Loading...
Searching...
No Matches
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::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 ()
 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
bool isAlphaOnly ()
StringTableEntry getFontFaceName () const
 Get the face name of the font.
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< 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

void * mMutex

Friends

ResourceInstanceconstructNewFont (Stream &stream)
ResourceInstanceconstructBMFont (Stream &stream)

Additional Inherited Members

Public Attributes inherited from ResourceInstance
ResourceObjectmSourceResource
 Pointer to the ResourceObject that stores all our book-keeping data.

Member Enumeration Documentation

◆ Constants

enum Constants
Enumerator
TabWidthInSpaces 
TextureSheetSize 

Constructor & Destructor Documentation

◆ GFont()

GFont ( )

◆ ~GFont()

~GFont ( )
virtual

Member Function Documentation

◆ addBitmap()

void addBitmap ( PlatformFont::CharInfo & charInfo)
protected

◆ addSheet()

void addSheet ( void )
protected

◆ assignSheet()

void assignSheet ( S32 sheetNum,
GBitmap * bmp )
protected

◆ create()

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

◆ dumpInfo()

void dumpInfo ( )

Dump information about this font to the console.

◆ exportStrip()

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

Export to an image strip for image processing.

◆ forcePlatformFont()

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!

◆ getAscent()

const U32 getAscent ( ) const
inline

◆ getBaseline()

const U32 getBaseline ( ) const
inline

◆ getBreakPos()

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

◆ getCharHeight()

U32 getCharHeight ( const UTF16 in_charIndex)
inline

◆ getCharInfo()

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

◆ getCharWidth()

U32 getCharWidth ( const UTF16 in_charIndex)
inline

◆ getCharXIncrement()

U32 getCharXIncrement ( const UTF16 in_charIndex)
inline

◆ getDefaultCharInfo()

const PlatformFont::CharInfo & getDefaultCharInfo ( )
static

◆ getDescent()

const U32 getDescent ( ) const
inline

◆ getFontCacheFilename()

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

Get the filename for a cached font.

◆ getFontFaceName()

StringTableEntry getFontFaceName ( ) const
inline

Get the face name of the font.

◆ getHeight()

const U32 getHeight ( ) const
inline

◆ getStrNWidth() [1/2]

U32 getStrNWidth ( const UTF16 * str,
U32 n )

These are the preferred width functions.

◆ getStrNWidth() [2/2]

U32 getStrNWidth ( const UTF8 * str,
U32 n )

◆ getStrNWidthPrecise() [1/2]

U32 getStrNWidthPrecise ( const UTF16 * str,
U32 n )

◆ getStrNWidthPrecise() [2/2]

U32 getStrNWidthPrecise ( const UTF8 * str,
U32 n )

◆ getStrWidth()

U32 getStrWidth ( const UTF8 * in_pString)

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

◆ getStrWidthPrecise()

U32 getStrWidthPrecise ( const UTF8 * in_pString)

◆ getTextureHandle()

TextureHandle getTextureHandle ( S32 index)
inline

◆ hasPlatformFont()

const bool hasPlatformFont ( ) const
inline

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

◆ importStrip()

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

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

◆ isAlphaOnly()

bool isAlphaOnly ( )
inline

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

◆ isValidChar()

bool isValidChar ( const UTF16 in_charIndex) const
inline

◆ loadCharInfo()

bool loadCharInfo ( const UTF16 ch)
protected

◆ read()

bool read ( Stream & io_rStream)

◆ readBMFont()

bool readBMFont ( Stream & io_rStream)

◆ wrapString()

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

◆ write()

bool write ( Stream & io_rStream)

◆ constructBMFont

ResourceInstance * constructBMFont ( Stream & stream)
friend

◆ constructNewFont

ResourceInstance * constructNewFont ( Stream & stream)
friend

Member Data Documentation

◆ mMutex

void* mMutex
protected

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