Ocean
Loading...
Searching...
No Matches
Ocean::CV::Fonts::FTFontManager::Face Class Reference

This class wrapps a FreeType face. More...

#include <FTFontManager.h>

Public Member Functions

 Face (Face &&face)
 Move constructor.
 
 Face (FTFontManager &fontManager, const FT_Face &ftFace, const std::string &filename)
 Creates a new face object for a given FreeType face and keeps ownership of this face object.
 
 ~Face ()
 Destructs a Face object.
 
SharedFont font (const unsigned int size, const unsigned int dpi)
 Returns the font associated with this Face object for a specified size.
 
const std::string & filename () const
 Returns the filename of this face object.
 
Faceoperator= (Face &&face)
 Move operator.
 

Protected Types

using FontMap = std::unordered_map< uint64_t, SharedFont >
 Definition of a map mapping size and dpi to font objects.
 

Protected Member Functions

 Face (const Face &face)=delete
 Disabled copy constructor.
 
Faceoperator= (const Face &face)=delete
 Disabled copy operator.
 

Protected Attributes

FTFontManagerfontManager_
 The owner of the face object.
 
std::string filename_
 The name of the file from which the FreeType face can be acquired if requested.
 
FT_Face ftFace_ = nullptr
 The FreeType face (which represents a font) associated with this object, nullptr if the face object needs to be acquired from the file first.
 
FontMap fontMap_
 The map of font objects, one object for each individual combination of size and dpi.
 

Detailed Description

This class wrapps a FreeType face.

Each face represent a font with individual size.

Member Typedef Documentation

◆ FontMap

using Ocean::CV::Fonts::FTFontManager::Face::FontMap = std::unordered_map<uint64_t, SharedFont>
protected

Definition of a map mapping size and dpi to font objects.

Constructor & Destructor Documentation

◆ Face() [1/3]

Ocean::CV::Fonts::FTFontManager::Face::Face ( Face &&  face)
inline

Move constructor.

Parameters
faceThe face object to be moved

◆ Face() [2/3]

Ocean::CV::Fonts::FTFontManager::Face::Face ( FTFontManager fontManager,
const FT_Face &  ftFace,
const std::string &  filename 
)
inline

Creates a new face object for a given FreeType face and keeps ownership of this face object.

Parameters
fontManagerThe owner of this new object
ftFaceThe FreeType face defining the font, will be release after usage, can be nullptr if a valid 'filename' is provided
filenameThe filename from which the FreeType face can be accessed when actually needed, can be empty if 'ftFace' is valid

◆ ~Face()

Ocean::CV::Fonts::FTFontManager::Face::~Face ( )
inline

Destructs a Face object.

◆ Face() [3/3]

Ocean::CV::Fonts::FTFontManager::Face::Face ( const Face face)
protecteddelete

Disabled copy constructor.

Parameters
faceThe object which would be copied

Member Function Documentation

◆ filename()

const std::string & Ocean::CV::Fonts::FTFontManager::Face::filename ( ) const
inline

Returns the filename of this face object.

Returns
The face object's filename, if known

◆ font()

SharedFont Ocean::CV::Fonts::FTFontManager::Face::font ( const unsigned int  size,
const unsigned int  dpi 
)

Returns the font associated with this Face object for a specified size.

If the font does not exist yet, the font will be create and initialized.

Parameters
sizeThe size of the font, in dots, with range [1, infinity)
dpiThe dots per inch of the font, with range [1, infinity)
Returns
The requested font, nullptr if invalid

◆ operator=() [1/2]

Face & Ocean::CV::Fonts::FTFontManager::Face::operator= ( const Face face)
protecteddelete

Disabled copy operator.

Parameters
faceThe object which would be copied
Returns
The reference to this object

◆ operator=() [2/2]

Face & Ocean::CV::Fonts::FTFontManager::Face::operator= ( Face &&  face)

Move operator.

Parameters
faceThe object to be moved
Returns
The reference to this object

Field Documentation

◆ filename_

std::string Ocean::CV::Fonts::FTFontManager::Face::filename_
protected

The name of the file from which the FreeType face can be acquired if requested.

◆ fontManager_

FTFontManager& Ocean::CV::Fonts::FTFontManager::Face::fontManager_
protected

The owner of the face object.

◆ fontMap_

FontMap Ocean::CV::Fonts::FTFontManager::Face::fontMap_
protected

The map of font objects, one object for each individual combination of size and dpi.

◆ ftFace_

FT_Face Ocean::CV::Fonts::FTFontManager::Face::ftFace_ = nullptr
protected

The FreeType face (which represents a font) associated with this object, nullptr if the face object needs to be acquired from the file first.


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