CRM64Pro GDK v0.15.0
A free cross-platform game development kit built on top of SDL 3.0
Loading...
Searching...
No Matches
CRM64Pro::FontMgr

Font Manager class. More...

Detailed Description

Font Manager class.

Public Member Functions

bool info (Sint32 iMode=0) override
 Request Font Manager information.
Sint32 create (const string &sName, Uint32 iVersion=10) override
 Create a new font.
bool close (Sint32 idFont) override
 Close and destroy a font.
Sint32 getCount () const override
 Get number of loaded objects.
Sint32 setName (Sint32 idFont, const string &sName) override
 Change the object name.
Fontget (Sint32 idFont)
 Get a pointer to the font using its handler.
Sint32 child (Sint32 idFont)
 Create a child font dependant on the provided one (the parent).
Sint32 load (const string &sCDCFile, const string &sName)
 Load a font stored in a CDC file.
Sint32 load (const Sint32 idCDC, const string &sName)
 Load a font stored in a CDC file.
Sint32 loadFromBuffer (const void *pBuffer, Sint32 iSize, const string &sName)
 Load a font from an image memory buffer.
Sint32 remove (const Sint32 idCDC, const string &sName)
 Remove a font stored in a CDC file.
bool exist (const Sint32 idCDC, const string &sName)
 Check if a font is stored in a CDC file.
bool exist (const string &sCDCFile, const string &sName)
 Check if a font is stored in a CDC file.

Member Function Documentation

◆ info()

bool CRM64Pro::FontMgr::info ( Sint32 iMode = 0)
override

Request Font Manager information.

Writes information to the default log.

Parameters
iMode-1 for displaying only Manager information. 0 for displaying Manager and all Objects information. This is the default value. Greater than 0 (Font id) for displaying Manager and given Font information.
Returns
true on success, or false on failure.

◆ create()

Sint32 CRM64Pro::FontMgr::create ( const string & sName,
Uint32 iVersion = 10 )
override

Create a new font.

This method will create an empty font (no image assigned), use Font::assignImage() method for assigning the image.

Parameters
sNameThe name to give to the font e.g. 'myFont'. The object name must be unique and with a maximum size of 64 characters or will be truncated.
iVersionFont version. 10 means 1.0 which is the only version supported (as of now). v1.0 is set by default.
Returns
Greater than 0 on success (the Font id) or a negative error code on failure.
Note
If the provided name already exists, it does nothing and return an error code.

◆ close()

bool CRM64Pro::FontMgr::close ( Sint32 idFont)
override

Close and destroy a font.

Parameters
idFont0 for closing all fonts or the Font id. Stand-alone and child fonts can be closed but parent ones, can not as they have at least one dependency (a child).
Returns
true on success or false on failure.
Note
If you forget to close a Font, it will be automatically closed once the GDK is terminated.

◆ getCount()

Sint32 CRM64Pro::FontMgr::getCount ( ) const
override

Get number of loaded objects.

Returns
The number of fonts.

◆ setName()

Sint32 CRM64Pro::FontMgr::setName ( Sint32 idFont,
const string & sName )
override

Change the object name.

Parameters
idFontFont id.
sNameThe name to give to the font e.g. 'myFont'. The object name must be unique and with a maximum size of 64 characters or will be truncated.
Returns
0 on success, or a negative error code on failure.

◆ get()

Font * CRM64Pro::FontMgr::get ( Sint32 idFont)

Get a pointer to the font using its handler.

Parameters
idFontFont id.
Returns
nullptr The font was not found.
A pointer to the font object.

◆ child()

Sint32 CRM64Pro::FontMgr::child ( Sint32 idFont)

Create a child font dependant on the provided one (the parent).

A child font uses the attributes of the parent and creates also a parent child image for having different attributes.

Parameters
idFontParent Font id. If the provided font is a child, internally it will redirect this request to the parent in order to create the new child.
Returns
Greater than 0 on success (the Font id) or a negative error code on failure.
Note
The child use the parent's name.

◆ load() [1/2]

Sint32 CRM64Pro::FontMgr::load ( const string & sCDCFile,
const string & sName )

Load a font stored in a CDC file.

Parameters
sCDCFileString containing the [directory]+filename. Directory separators '\' and '/' are supported.
sNameString with the font name (maximum size of 64 characters). If the font is already created, this method will call child() for creating a child.
Returns
0 or greater on success (the Font id) or a negative error code on failure.

◆ load() [2/2]

Sint32 CRM64Pro::FontMgr::load ( const Sint32 idCDC,
const string & sName )

Load a font stored in a CDC file.

Parameters
idCDCCDC id.
sNameString with the font name (maximum size of 64 characters). If the font is already created, this method will call child() for creating a child.
Returns
Greater than 0 on success (the Font id) or a negative error code on failure.

◆ loadFromBuffer()

Sint32 CRM64Pro::FontMgr::loadFromBuffer ( const void * pBuffer,
Sint32 iSize,
const string & sName )

Load a font from an image memory buffer.

Parameters
pBufferPointer to the memory buffer containing the image (BMP or PNG) with transparency enabled.
iSizeSize of the buffer in bytes.
sNamestring with the font name (max 64 characters).
Returns
0 or greater on success (the Font id) or a negative error code on failure.

◆ remove()

Sint32 CRM64Pro::FontMgr::remove ( const Sint32 idCDC,
const string & sName )

Remove a font stored in a CDC file.

Parameters
idCDCCDC id.
sNameString with the font name (maximum size of 64 characters).
Returns
Greater than 0 on success, or a negative error code on failure.
Note
The font must be closed before trying to remove it from the CDC.

◆ exist() [1/2]

bool CRM64Pro::FontMgr::exist ( const Sint32 idCDC,
const string & sName )

Check if a font is stored in a CDC file.

Parameters
idCDCCDC id.
sNamestring with the font name (maximum size of 64 characters).
Returns
true on success (it exists) or false on failure (it does not exist).

◆ exist() [2/2]

bool CRM64Pro::FontMgr::exist ( const string & sCDCFile,
const string & sName )

Check if a font is stored in a CDC file.

Parameters
sCDCFilePath to the CDC archive file.
sNamestring with the font name (maximum size of 64 characters).
Returns
true on success (it exists) or false on failure (it does not exist).