pdfmm 0.9.20
Public Member Functions | List of all members
mm::PdfFontManager Class Referencefinal

#include <PdfFontManager.h>

Public Member Functions

 ~PdfFontManager ()
 
PdfFontGetFont (PdfObject &obj)
 
PdfFontGetFont (const std::string_view &fontName, const PdfFontCreationParams &params={ })
 
PdfFontGetFont (FT_Face face, const PdfEncoding &encoding=PdfEncodingFactory::CreateWinAnsiEncoding(), bool isSymbolCharset=false, PdfFontInitOptions initOptions=PdfFontInitOptions::Embed)
 

Detailed Description

This class assists PdfDocument with caching font information.

Additional to font caching, this class is also responsible for font matching.

PdfFont is an actual font that can be used in a PDF file (i.e. it does also font embedding) and PdfFontMetrics provides only metrics informations.

See also
PdfDocument

Constructor & Destructor Documentation

◆ ~PdfFontManager()

PdfFontManager::~PdfFontManager ( )

Destroy and empty the font cache

Member Function Documentation

◆ GetFont() [1/3]

PdfFont * mm::PdfFontManager::GetFont ( const std::string_view &  fontName,
const PdfFontCreationParams &  params = { } 
)

Get a font from the cache. If the font does not yet exist, add it to the cache.

Parameters
fontNamea valid fontname
paramsfont creation params
Returns
a PdfFont object or nullptr if the font could not be created or found.

◆ GetFont() [2/3]

PdfFont * PdfFontManager::GetFont ( FT_Face  face,
const PdfEncoding encoding = PdfEncodingFactory::CreateWinAnsiEncoding(),
bool  isSymbolCharset = false,
PdfFontInitOptions  initOptions = PdfFontInitOptions::Embed 
)

Get a font from the cache. If the font does not yet exist, add it to the cache.

Parameters
facea valid freetype font face (will be free'd by pdfmm)
encodingthe encoding of the font. The font will not take ownership of this object.
isSymbolCharsetwhether to use a symbol charset
embedif true a font for embedding into PDF will be created
Returns
a PdfFont object or nullptr if the font could not be created or found.

◆ GetFont() [3/3]

PdfFont * PdfFontManager::GetFont ( PdfObject obj)

Get a font from the cache. If the font does not yet exist, add it to the cache. This font is created from an existing object.

Parameters
obja PdfObject that is a font
Returns
a PdfFont object or nullptr if the font could not be created or found.