Simple++
Powerfull and lightning fast C++ Library
Public Types | Public Member Functions | Protected Member Functions | List of all members
Graphic::FontLoadable Class Reference

#include <FontLoadable.h>

Inheritance diagram for Graphic::FontLoadable:
BasicLoadableIO Graphic::Font BasicSimpleLoadableIO BasicIO BasicSimpleIO BasicLoadable BasicSimpleIO

Public Types

enum  LoadingType { FTFILE, FILE }
 

Public Member Functions

 FontLoadable (const WString &fileName)
 constructor that take a filename of a special font file (file created by saveToFile()) More...
 
 FontLoadable (const WString &fileName, int pixSize)
 constructor that take a filename of a font file (ttf, ttc, cff...) More...
 
 ~FontLoadable ()
 
- Public Member Functions inherited from BasicLoadableIO
 BasicLoadableIO ()
 
 ~BasicLoadableIO ()
 
bool writeToFile (const WString &path)
 write this object to a file. More...
 
bool readFromFile (const WString &path)
 load this object from a file. More...
 
- Public Member Functions inherited from BasicSimpleLoadableIO
 BasicSimpleLoadableIO ()
 
 ~BasicSimpleLoadableIO ()
 
bool read (std::fstream *fileStream)
 load this object from a file stream More...
 
bool write (std::fstream *fileStream)
 write this object as binary into a file stream More...
 
- Public Member Functions inherited from BasicSimpleIO
bool read (std::fstream *fileStream)
 read from a file stream More...
 
bool write (std::fstream *fileStream) const
 write this object as binary into a file stream More...
 
- Public Member Functions inherited from BasicLoadable
 BasicLoadable ()
 Empty constructor initialized at NOT loaded and NOT loading. More...
 
 BasicLoadable (const BasicLoadable &loadable)
 copy constructor More...
 
 ~BasicLoadable ()
 
void load ()
 load the object (this function may not be overloaded) More...
 
void unload ()
 unload this object (this function may not be overloaded) More...
 
bool isLoaded () const
 get if the current object is loaded or not More...
 
void reload ()
 if the current object is loaded, unload it and then call load again, if not, this do nothing. More...
 
bool isLoading () const
 get if the current object is currently loading More...
 
void lock ()
 lock the current object to ensure no parallelization of the loading state. More...
 
void unlock ()
 unlock the current object to permit parallelization of the loading state. More...
 
BasicLoadableoperator= (const BasicLoadable &loadable)
 copy operator More...
 
- Public Member Functions inherited from Graphic::Font
 Font (const WString &fileName, int pixSize)
 constructor that take a filename of a font file (ttf, ttc, cff...) More...
 
 Font (const char *fileDump, size_t fileSize)
 Constructor using a font file dump and his size in bytes. More...
 
 ~Font ()
 
FreeTypeCharoperator[] (UCodePoint codePoint)
 
const FreeTypeCharoperator[] (UCodePoint codePoint) const
 
const OrderedMap< UCodePoint, FreeTypeChar * > & getCharMap () const
 
const FreeTypeCharloadGlyph (UCodePoint codePoint)
 load a glyph on this More...
 
void loadGlyph (const UTF8String &str)
 load all the glyph present inside the string More...
 
bool read (std::fstream *fileStream)
 read from a file stream More...
 
bool write (std::fstream *fileStream) const
 write this object as binary into a file stream More...
 
float getLineHeight () const
 get the line height of this font. More...
 
float getWordSpace () const
 get the word space of this font More...
 
Math::Rectangle< int > computeRectangle (const UTF8String &text) const
 compute the rectangle of a text using this font. More...
 

Protected Member Functions

virtual void onLoad () override
 function to be overloaded to add action during the loading process. More...
 
virtual void onUnload () override
 function to be overloaded to add action during the unloading process. More...
 
virtual bool onRead (std::fstream *fileStream) override
 function to be overloaded to set the action when reading from a stream. More...
 
virtual bool onWrite (std::fstream *fileStream) const override
 function to be overloaded to set the action when writing from a stream. More...
 
- Protected Member Functions inherited from BasicLoadable
void setLoaded (bool loaded)
 set if the current object is loaded or not. (use with caution) More...
 
void setLoading (bool isLoading)
 set if the current object is currently loading (use with caution) More...
 
- Protected Member Functions inherited from Graphic::Font
 Font (ctor)
 
bool _read (std::fstream *fileStream)
 
void _loadFreeType (const char *fileDump, size_t size)
 
void _setPixSize (unsigned int size)
 
void _unload ()
 

Additional Inherited Members

- Protected Types inherited from Graphic::Font
enum  ctor { null }
 
- Protected Attributes inherited from Graphic::Font
OrderedMap< UCodePoint, FreeTypeChar * > charsMap
 
FT_Library ftLib
 
FT_Face ftFace
 
float pixSize
 
float lineHeight
 
float wordSpace
 
char * memoryFontObject
 
size_t memorySize
 

Member Enumeration Documentation

Enumerator
FTFILE 
FILE 

Loading using a standard font file.

Loading using a special format only used by this code.

Constructor & Destructor Documentation

Graphic::FontLoadable::FontLoadable ( const WString fileName)

constructor that take a filename of a special font file (file created by saveToFile())

Parameters
fileNamePath to the file to open
pixSizeSize of the loaded font.
Graphic::FontLoadable::FontLoadable ( const WString fileName,
int  pixSize 
)

constructor that take a filename of a font file (ttf, ttc, cff...)

Parameters
fileNamePath to the file to open
pixSizeSize of the loaded font.
Graphic::FontLoadable::~FontLoadable ( )

Member Function Documentation

void Graphic::FontLoadable::onLoad ( )
overrideprotectedvirtual

function to be overloaded to add action during the loading process.

Reimplemented from BasicLoadable.

bool Graphic::FontLoadable::onRead ( std::fstream *  fileStream)
overrideprotectedvirtual

function to be overloaded to set the action when reading from a stream.

Parameters
fileStreamstream used to read load this object
Returns
boolean to know if the operation is a success of not.

Reimplemented from BasicSimpleLoadableIO.

void Graphic::FontLoadable::onUnload ( )
overrideprotectedvirtual

function to be overloaded to add action during the unloading process.

Reimplemented from BasicLoadable.

bool Graphic::FontLoadable::onWrite ( std::fstream *  fileStream) const
overrideprotectedvirtual

function to be overloaded to set the action when writing from a stream.

Parameters
fileStreamstream used to write this object
Returns
boolean to know if the operation is a success of not.

Reimplemented from BasicSimpleLoadableIO.


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