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

#include <Font.h>

Inheritance diagram for Graphic::Font:
BasicIO BasicSimpleIO Graphic::FontLoadable

Classes

class  Template
 

Public Member Functions

 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...
 
- 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...
 

Protected Types

enum  ctor { null }
 

Protected Member Functions

 Font (ctor)
 
bool _read (std::fstream *fileStream)
 
void _loadFreeType (const char *fileDump, size_t size)
 
void _setPixSize (unsigned int size)
 
void _unload ()
 

Protected Attributes

OrderedMap< UCodePoint, FreeTypeChar * > charsMap
 
FT_Library ftLib
 
FT_Face ftFace
 
float pixSize
 
float lineHeight
 
float wordSpace
 
char * memoryFontObject
 
size_t memorySize
 

Member Enumeration Documentation

enum Graphic::Font::ctor
protected
Enumerator
null 

Constructor & Destructor Documentation

Graphic::Font::Font ( 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::Font::Font ( const char *  fileDump,
size_t  fileSize 
)

Constructor using a font file dump and his size in bytes.

Parameters
fileDumpmemory copy of a font file.
fileSizesize in bytes of the data buffer.
Graphic::Font::~Font ( )
Graphic::Font::Font ( ctor  )
protected

Member Function Documentation

void Graphic::Font::_loadFreeType ( const char *  fileDump,
size_t  size 
)
protected
bool Graphic::Font::_read ( std::fstream *  fileStream)
protected
void Graphic::Font::_setPixSize ( unsigned int  size)
protected
void Graphic::Font::_unload ( )
protected
Math::Rectangle< int > Graphic::Font::computeRectangle ( const UTF8String text) const

compute the rectangle of a text using this font.

Parameters
const OrderedMap< UCodePoint, FreeTypeChar * > & Graphic::Font::getCharMap ( ) const
float Graphic::Font::getLineHeight ( ) const

get the line height of this font.

Returns
line height
float Graphic::Font::getWordSpace ( ) const

get the word space of this font

Returns
word space
const FreeTypeChar * Graphic::Font::loadGlyph ( UCodePoint  codePoint)

load a glyph on this

Returns
const pointer of the character just created (NULL if nothing was loaded)
void Graphic::Font::loadGlyph ( const UTF8String str)

load all the glyph present inside the string

FreeTypeChar * Graphic::Font::operator[] ( UCodePoint  codePoint)
const FreeTypeChar * Graphic::Font::operator[] ( UCodePoint  codePoint) const
bool Graphic::Font::read ( std::fstream *  fileStream)

read from a file stream

Parameters
fileStreamstream used to read load this object
Returns
boolean to know if the operation is a success of not.
bool Graphic::Font::write ( std::fstream *  fileStream) const

write this object as binary into a file stream

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

Member Data Documentation

OrderedMap<UCodePoint, FreeTypeChar *> Graphic::Font::charsMap
protected
FT_Face Graphic::Font::ftFace
protected
FT_Library Graphic::Font::ftLib
protected
float Graphic::Font::lineHeight
protected
char* Graphic::Font::memoryFontObject
protected
size_t Graphic::Font::memorySize
protected
float Graphic::Font::pixSize
protected
float Graphic::Font::wordSpace
protected

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