37 #include FT_FREETYPE_H 45 if (!free_type_library)
47 FT_Library freetype =
NULL;
48 FT_Error error = FT_Init_FreeType( &freetype );
52 Log::error(
"FontManager::FontManager(): an error occurred during FreeType library initialization!\n");
64 mFreeTypeLibrary =
NULL;
71 for(
unsigned i=0; !font && i<
mFonts.size(); ++i)
72 if (
fonts()[i]->filePath() == path &&
fonts()[i]->size() == size &&
fonts()[i]->smooth() == smooth)
77 font =
new Font(
this);
89 std::vector< ref<Font> >::iterator it = std::find(
mFonts.begin(),
mFonts.end(), font);
96 for(
unsigned i=0; i<
mFonts.size(); ++i)
97 mFonts[i]->releaseFreeTypeData();
const std::vector< ref< Font > > & fonts() const
Returns the list of Fonts created till now.
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
A font to be used with a Text renderable.
void loadFont(const String &path)
Loads a font using fileSystem()locateFile().
Font * acquireFont(const String &font, int size, bool smooth=false)
Creates or returns an already created Font.
static void error(const String &message)
Use this function to provide information about run-time errors: file not found, out of memory...
void setSize(int size)
The size of the font.
Visualization Library main namespace.
FontManager(void *free_type_library=NULL)
Constructor: uses the given FT_Library handle otherwise will initialize and use its own FT_Library...
void releaseAllFonts()
Releases all Fonts and associated resources and memory.
void releaseFont(Font *font)
Releases a given Font and its associated resources and memory.
void setSmooth(bool smooth)
Whether the font rendering should use linear filtering or not.
std::vector< ref< Font > > mFonts
The ref<> class is used to reference-count an Object.
~FontManager()
Destructor: releases all fonts and disposes the FT_Library if not NULL.