Visualization Library 2.1.0

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes | Friends | List of all members
vl::Font Class Reference

A font to be used with a Text renderable. More...

#include <Font.hpp>

+ Inheritance diagram for vl::Font:

Public Member Functions

 ~Font ()
 Destructor. More...
 
bool operator< (const Font &other) const
 Less-than operator. More...
 
const StringfilePath () const
 The font's file path. More...
 
void loadFont (const String &path)
 Loads a font using fileSystem()locateFile(). More...
 
int size () const
 The size of the font. More...
 
void setSize (int size)
 The size of the font. More...
 
Glyphglyph (int character)
 Returns (and eventually creates) the Glyph* associated to the given character. More...
 
void setSmooth (bool smooth)
 Whether the font rendering should use linear filtering or not. More...
 
bool smooth () const
 Whether the font rendering should use linear filtering or not. More...
 
void releaseFreeTypeData ()
 Releases the FreeType's FT_Face used by a Font. More...
 
void setFontManager (FontManager *fm)
 The FontManager associated to this Font used to acquire/release FreeType resources. More...
 
const FontManagerfontManager () const
 The FontManager associated to this Font used to acquire/release FreeType resources. More...
 
FontManagerfontManager ()
 The FontManager associated to this Font used to acquire/release FreeType resources. More...
 
bool freeTypeLoadForceAutoHint () const
 Whether FT_Load_Char() should be called with FT_LOAD_FORCE_AUTOHINT (default) or FT_LOAD_DEFAULT. More...
 
void setFreeTypLoadForceAutoHint (bool enable)
 Whether FT_Load_Char() should be called with FT_LOAD_FORCE_AUTOHINT (default) or FT_LOAD_DEFAULT. 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...
 
Objectoperator= (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...
 
IMutexrefCountMutex ()
 The mutex used to protect the reference counting of an Object across multiple threads. More...
 
const IMutexrefCountMutex () 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

FontManagermFontManager
 
String mFilePath
 
std::map< int, ref< Glyph > > mGlyphMap
 
FT_Face mFT_Face
 
std::vector< char > mMemoryFile
 
int mSize
 
float mHeight
 
bool mSmooth
 
bool mFreeTypeLoadForceAutoHint
 
- Protected Attributes inherited from vl::Object
std::string mObjectName
 
IMutexmRefCountMutex
 
int mReferenceCount
 
bool mAutomaticDelete
 

Friends

class CoreText
 
class Text
 
class FontManager
 

Additional Inherited Members

- Protected Member Functions inherited from vl::Object
virtual ~Object ()
 

Detailed Description

A font to be used with a Text renderable.

Definition at line 127 of file Font.hpp.

Constructor & Destructor Documentation

◆ ~Font()

vl::Font::~Font ( )

Destructor.

Member Function Documentation

◆ filePath()

const String& vl::Font::filePath ( ) const
inline

The font's file path.

Definition at line 161 of file Font.hpp.

Referenced by operator<(), and vl::VectorGraphics::setFont().

◆ fontManager() [1/2]

const FontManager* vl::Font::fontManager ( ) const
inline

The FontManager associated to this Font used to acquire/release FreeType resources.

Definition at line 188 of file Font.hpp.

◆ fontManager() [2/2]

FontManager* vl::Font::fontManager ( )
inline

The FontManager associated to this Font used to acquire/release FreeType resources.

Definition at line 191 of file Font.hpp.

◆ freeTypeLoadForceAutoHint()

bool vl::Font::freeTypeLoadForceAutoHint ( ) const
inline

Whether FT_Load_Char() should be called with FT_LOAD_FORCE_AUTOHINT (default) or FT_LOAD_DEFAULT.

There isn't a "best" option for all the fonts, the results can be better or worse depending on the particular font loaded.

Definition at line 195 of file Font.hpp.

◆ glyph()

Glyph* vl::Font::glyph ( int  character)

Returns (and eventually creates) the Glyph* associated to the given character.

◆ loadFont()

void vl::Font::loadFont ( const String path)

Loads a font using fileSystem()locateFile().

Referenced by vl::FontManager::acquireFont().

◆ operator<()

bool vl::Font::operator< ( const Font other) const
inline

Less-than operator.

Definition at line 152 of file Font.hpp.

References filePath(), and size().

◆ releaseFreeTypeData()

void vl::Font::releaseFreeTypeData ( )

Releases the FreeType's FT_Face used by a Font.

◆ setFontManager()

void vl::Font::setFontManager ( FontManager fm)
inline

The FontManager associated to this Font used to acquire/release FreeType resources.

Definition at line 185 of file Font.hpp.

◆ setFreeTypLoadForceAutoHint()

void vl::Font::setFreeTypLoadForceAutoHint ( bool  enable)
inline

Whether FT_Load_Char() should be called with FT_LOAD_FORCE_AUTOHINT (default) or FT_LOAD_DEFAULT.

There isn't a "best" option for all the fonts, the results can be better or worse depending on the particular font loaded.

Definition at line 199 of file Font.hpp.

◆ setSize()

void vl::Font::setSize ( int  size)

The size of the font.

Referenced by vl::FontManager::acquireFont().

◆ setSmooth()

void vl::Font::setSmooth ( bool  smooth)

Whether the font rendering should use linear filtering or not.

Referenced by vl::FontManager::acquireFont().

◆ size()

int vl::Font::size ( ) const
inline

The size of the font.

Definition at line 167 of file Font.hpp.

Referenced by operator<(), and vl::VectorGraphics::setFont().

◆ smooth()

bool vl::Font::smooth ( ) const
inline

Whether the font rendering should use linear filtering or not.

Definition at line 179 of file Font.hpp.

Referenced by vl::VectorGraphics::setFont().

Friends And Related Function Documentation

◆ CoreText

friend class CoreText
friend

Definition at line 131 of file Font.hpp.

◆ FontManager

friend class FontManager
friend

Definition at line 133 of file Font.hpp.

◆ Text

friend class Text
friend

Definition at line 132 of file Font.hpp.

Member Data Documentation

◆ mFilePath

String vl::Font::mFilePath
protected

Definition at line 203 of file Font.hpp.

◆ mFontManager

FontManager* vl::Font::mFontManager
protected

Definition at line 202 of file Font.hpp.

◆ mFreeTypeLoadForceAutoHint

bool vl::Font::mFreeTypeLoadForceAutoHint
protected

Definition at line 210 of file Font.hpp.

◆ mFT_Face

FT_Face vl::Font::mFT_Face
protected

Definition at line 205 of file Font.hpp.

◆ mGlyphMap

std::map< int, ref<Glyph> > vl::Font::mGlyphMap
protected

Definition at line 204 of file Font.hpp.

◆ mHeight

float vl::Font::mHeight
protected

Definition at line 208 of file Font.hpp.

◆ mMemoryFile

std::vector<char> vl::Font::mMemoryFile
protected

Definition at line 206 of file Font.hpp.

◆ mSize

int vl::Font::mSize
protected

Definition at line 207 of file Font.hpp.

◆ mSmooth

bool vl::Font::mSmooth
protected

Definition at line 209 of file Font.hpp.


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