![]() |
Cornell Cocos
Cornell Extensions to Cocos2d
|
#include <CUTTFont.h>
Public Member Functions | |
const std::string & | getName () const |
const std::string & | getSource () const |
float | getSize () const |
const TTFConfig & | getTTF () const |
const FontAtlas * | getAtlas () const |
CC_CONSTRUCTOR_ACCESS | _ident ("") |
CC_CONSTRUCTOR_ACCESS | _source ("") |
CC_CONSTRUCTOR_ACCESS | _atlas (nullptr) |
~TTFont () | |
bool | init (std::string source, float size) |
Static Public Member Functions | |
static TTFont * | create (std::string source, float size) |
Public Attributes | |
CC_CONSTRUCTOR_ACCESS | __pad0__: TTFont() : Ref() |
Protected Attributes | |
std::string | _ident |
std::string | _source |
TTFConfig | _config |
FontAtlas * | _atlas |
Friends | |
class | FontLoader |
Class provides a reference to a loaded font asset.
This class contains both the TTFConfig information and the associated FontAtlas, providing a uniform interface for all applications. Note that a True Type font asset is both the source file AND the font size. Because the font is converted to a texture for usage, different sizes are different fonts.
This class uses Cocos2d reference counting for memory management. The constructors are protected because only the FontLoader should construct fonts.
|
inline |
Deletes this font object
The font should be unloaded before deletion.
|
static |
Creates a new font object for the given source file and size.
The font object must have a size in addition to its source file
source | the source file for the font |
size | the font size |
|
inline |
Returns the font atlas for this font.
The font atlas is the texture generated by FreeType for this font file and size. You generally do not need direct access to this.
|
inline |
Returns the unique identifier for this font.
Because of how font textures are created, each size is considered a separate font. The identifier combines the source file and size.
|
inline |
Returns the size of this font.
Because of how font textures are created, each size is considered a separate font.
|
inline |
Returns the source file for this font.
|
inline |
Returns the font atlas for this font.
The font atlas is the texture generated by FreeType for this font file and size. You generally do not need direct access to this.
bool TTFont::init | ( | std::string | source, |
float | size | ||
) |
Initializes a new sound object for the given source file.
The font object must have a size in addition to its source file
source | the source file for the font |
size | the font size |
|
friend |
Allow the font loader access to the constructors
|
protected |
The font texture information
|
protected |
The font information for constructing the atlas
|
protected |
A unique identifier for this font (filre+size)
|
protected |
The source file for the font