pdfmm 0.9.20
Public Member Functions | List of all members
mm::PdfFontConfigWrapper Class Reference

#include <PdfFontConfigWrapper.h>

Public Member Functions

 PdfFontConfigWrapper (FcConfig *fcConfig=nullptr)
 
std::string GetFontConfigFontPath (const std::string_view fontName, bool bold, bool italic)
 

Detailed Description

This class initializes and destroys the FontConfig library.

As initializing fontconfig can take a long time, you can create a wrapper by yourself to cache initialization of fontconfig.

This class is reference counted. The last user of the fontconfig library will destroy the fontconfig handle.

The fontconfig library is initialized on first used (lazy loading!)

Constructor & Destructor Documentation

◆ PdfFontConfigWrapper()

PdfFontConfigWrapper::PdfFontConfigWrapper ( FcConfig *  fcConfig = nullptr)

Create a new FontConfigWrapper and initialize the fontconfig library.

Member Function Documentation

◆ GetFontConfigFontPath()

string PdfFontConfigWrapper::GetFontConfigFontPath ( const std::string_view  fontName,
bool  bold,
bool  italic 
)

Get the path of a font file on a Unix system using fontconfig

This method is only available if pdfmm was compiled with fontconfig support. Make sure to lock any FontConfig mutexes before calling this method by yourself!

Parameters
pConfiga handle to an initialized fontconfig library
pszFontNamename of the requested font
bBoldif true find a bold font
bItalicif true find an italic font
Returns
the path to the fontfile or an empty string