Visualization Library 2.0.0
A lightweight C++ OpenGL middleware for 2D/3D graphics
|
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The FontManager class keeps a map associating a font path, size and smoothing flag to a Font object. More...
#include <FontManager.hpp>
Public Member Functions | |
FontManager (void *free_type_library=NULL) | |
Constructor: uses the given FT_Library handle otherwise will initialize and use its own FT_Library. More... | |
~FontManager () | |
Destructor: releases all fonts and disposes the FT_Library if not NULL. More... | |
Font * | acquireFont (const String &font, int size, bool smooth=false) |
Creates or returns an already created Font. More... | |
const std::vector< ref< Font > > & | fonts () const |
Returns the list of Fonts created till now. More... | |
void | releaseFont (Font *font) |
Releases a given Font and its associated resources and memory. More... | |
void | releaseAllFonts () |
Releases all Fonts and associated resources and memory. More... | |
const void * | freeTypeLibrary () const |
Returns the FT_Library handle. More... | |
void * | freeTypeLibrary () |
Returns the FT_Library handle. More... | |
void * | setFreeTypeLibrary (void *ftlib) |
Sets the FT_Library to the given one and returns the former one. More... | |
Public Member Functions inherited from vl::Object | |
Object () | |
Constructor. More... | |
Object (const Object &other) | |
Copy constructor: copies the name, ref count mutex and user data. More... | |
Object & | operator= (const Object &other) |
Copy operator: copies the object's name, ref count mutex and user data. More... | |
const std::string & | objectName () const |
The name of the object, by default set to the object's class name. More... | |
void | setObjectName (const char *name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setObjectName (const std::string &name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setRefCountMutex (IMutex *mutex) |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
IMutex * | refCountMutex () |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
const IMutex * | refCountMutex () const |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
int | referenceCount () const |
Returns the number of references of an object. More... | |
void | incReference () const |
Increments the reference count of an object. More... | |
void | decReference () |
Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More... | |
void | setAutomaticDelete (bool autodel_on) |
If set to true the Object is deleted when its reference count reaches 0. More... | |
bool | automaticDelete () const |
If set to true the Object is deleted when its reference count reaches 0. More... | |
template<class T > | |
T * | as () |
Casts an Object to the specified class. More... | |
template<class T > | |
const T * | as () const |
Casts an Object to the specified class. More... | |
Protected Attributes | |
std::vector< ref< Font > > | mFonts |
void * | mFreeTypeLibrary |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
Additional Inherited Members | |
Protected Member Functions inherited from vl::Object | |
virtual | ~Object () |
The FontManager class keeps a map associating a font path, size and smoothing flag to a Font object.
Definition at line 45 of file FontManager.hpp.
FontManager::FontManager | ( | void * | free_type_library = NULL | ) |
Constructor: uses the given FT_Library handle otherwise will initialize and use its own FT_Library.
Definition at line 42 of file FontManager.cpp.
References vl::Log::error(), mFreeTypeLibrary, NULL, and VL_TRAP.
FontManager::~FontManager | ( | ) |
Destructor: releases all fonts and disposes the FT_Library if not NULL.
If you don't want the FontManager to dispose the associated FT_Library then call setFreeTypeLibrary(NULL) before the FontManager is destroyed.
Definition at line 58 of file FontManager.cpp.
References mFreeTypeLibrary, NULL, and releaseAllFonts().
Creates or returns an already created Font.
Definition at line 68 of file FontManager.cpp.
References fonts(), vl::ref< T >::get(), vl::Font::loadFont(), mFonts, vl::Font::setSize(), and vl::Font::setSmooth().
Referenced by vl::VectorGraphics::setFont(), and vl::VolumePlot::VolumePlot().
Returns the list of Fonts created till now.
Definition at line 62 of file FontManager.hpp.
Referenced by acquireFont().
|
inline |
Returns the FT_Library handle.
Definition at line 71 of file FontManager.hpp.
|
inline |
Returns the FT_Library handle.
Definition at line 74 of file FontManager.hpp.
void FontManager::releaseAllFonts | ( | ) |
Releases all Fonts and associated resources and memory.
Definition at line 94 of file FontManager.cpp.
References mFonts.
Referenced by ~FontManager().
void FontManager::releaseFont | ( | Font * | font | ) |
Releases a given Font and its associated resources and memory.
Definition at line 87 of file FontManager.cpp.
References mFonts.
|
inline |
Sets the FT_Library to the given one and returns the former one.
It is the user responsibility to dispose the returned one (if non-NULL).
Definition at line 78 of file FontManager.hpp.
Definition at line 81 of file FontManager.hpp.
Referenced by acquireFont(), releaseAllFonts(), and releaseFont().
|
protected |
Definition at line 82 of file FontManager.hpp.
Referenced by FontManager(), and ~FontManager().
Visualization Library 2.0.0 Reference Documentation
Updated on Wed Dec 23 2020 12:44:08.
© Copyright Michele Bosi. All rights reserved.