PoDoFo  0.9.1
Public Types | Public Member Functions | List of all members
PoDoFo::PdfFontTTFSubset Class Reference

#include <PdfFontTTFSubset.h>

Public Types

Public Member Functions

 PdfFontTTFSubset (const char *pszFontFileName, PdfFontMetrics *pMetrics, unsigned short nFaceIndex=0)
 
 PdfFontTTFSubset (PdfInputDevice *pDevice, PdfFontMetrics *pMetrics, EFontFileType eType, unsigned short nFaceIndex=0)
 
void BuildFont (PdfOutputDevice *pOutputDevice)
 
void AddGlyph (unsigned short nGlyphIndex)
 
void AddCharacter (pdf_utf16be nCharCode)
 
size_t GetSize () const
 

Detailed Description

This class is able to build a new TTF font with only certain glyphs from an existing font.

Member Enumeration Documentation

Internal enum specifying the type of a fontfile.

Enumerator
eFontFileType_TTF 

TrueType Font.

eFontFileType_TTC 

TrueType Collection.

eFontFileType_OTF 

OpenType Font.

eFontFileType_Unknown 

Unknown.

Constructor & Destructor Documentation

PoDoFo::PdfFontTTFSubset::PdfFontTTFSubset ( const char *  pszFontFileName,
PdfFontMetrics pMetrics,
unsigned short  nFaceIndex = 0 
)

Create a new PdfFontTTFSubset from an existing TTF font file.

Parameters
pszFontFileNamepath to a TTF file
pMetricsfont metrics object for this font
nFaceIndexindex of the face inside of the font
PoDoFo::PdfFontTTFSubset::PdfFontTTFSubset ( PdfInputDevice pDevice,
PdfFontMetrics pMetrics,
EFontFileType  eType,
unsigned short  nFaceIndex = 0 
)

Create a new PdfFontTTFSubset from an existing TTF font file using an input device.

Parameters
pDevicea PdfInputDevice
pMetricsfont metrics object for this font
eTypethe type of the font
nFaceIndexindex of the face inside of the font

Member Function Documentation

void PoDoFo::PdfFontTTFSubset::AddCharacter ( pdf_utf16be  nCharCode)
inline

Add an unicode character to the subset

Parameters
nCharCodeunicode character code
void PoDoFo::PdfFontTTFSubset::AddGlyph ( unsigned short  nGlyphIndex)

Add a new glyph index to the subset.

Parameters
nGlyphIndexinclude this glyph in the final font

Already existing values are ignored, so that every glyph can be added only once.

void PoDoFo::PdfFontTTFSubset::BuildFont ( PdfOutputDevice pOutputDevice)

Actually generate the subsetted font

Parameters
pOutputDevicewrite the font to this device
size_t PoDoFo::PdfFontTTFSubset::GetSize ( ) const
inline

Get the number of glyphs in this font.

Returns
the number of glyphs in this font.