wxPdfDocument  0.9.6
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
wxPdfFontParserTrueType Class Reference

Class representing a TrueType/OpenType font parser. More...

#include <pdffontparsertruetype.h>

Inheritance diagram for wxPdfFontParserTrueType:
wxPdfFontParser wxPdfFontSubsetTrueType

Public Member Functions

 wxPdfFontParserTrueType ()
 Default constructor. More...
 
virtual ~wxPdfFontParserTrueType ()
 Default destructor. More...
 
wxPdfFontDataIdentifyFont (const wxString &fontFileName, int fontIndex)
 Identify font based on a font file. More...
 
bool LoadFontData (wxPdfFontData *fontData)
 Load the font data. More...
 
int GetCollectionFontCount (const wxString &fontFileName)
 Get the number of fonts within a font collection. More...
 
- Public Member Functions inherited from wxPdfFontParser
 wxPdfFontParser ()
 Default constructor. More...
 
virtual ~wxPdfFontParser ()
 Default destructor. More...
 
void SeekI (int offset)
 Seek to offset in default input stream. More...
 
void SeekI (int offset, wxInputStream *stream)
 Seek to offset in specific input stream. More...
 
int TellI ()
 Tell current position in default input stream. More...
 
int TellI (wxInputStream *stream)
 Tell current position in specific input stream. More...
 
void SkipBytes (int count)
 Skip bytes in default input stream. More...
 
void SkipBytes (int count, wxInputStream *stream)
 Skip bytes in specific input stream. More...
 
int ReadInt ()
 Read integer from default input stream. More...
 
short ReadShort ()
 Read short integer from default input stream. More...
 
unsigned short ReadUShort ()
 Read unsigned short integer from default input stream. More...
 
unsigned char ReadByte ()
 Read byte from default input stream. More...
 
unsigned char ReadByte (wxInputStream *stream)
 Read byte from specific input stream. More...
 
wxString ReadString (int length)
 Read string from default input stream. More...
 
wxString ReadString (int length, wxInputStream *stream)
 Read string from specific input stream. More...
 
wxString ReadUnicodeString (int length)
 Read Unicode string from default input stream. More...
 
short ReadShortLE (wxInputStream *stream)
 Read short integer from specific input stream in little endian mode. More...
 
unsigned short ReadUShortLE (wxInputStream *stream)
 Read unsigned short integer from specific input stream in little endian mode. More...
 
unsigned int ReadUIntLE (wxInputStream *stream)
 Read unsigned integer from specific input stream in little endian mode. More...
 
wxString ReadString (wxInputStream &stream)
 Read string from specific input stream. More...
 

Protected Member Functions

void ClearTableDirectory ()
 Clear the table directory. More...
 
void LockTable (const wxString &tableName)
 Lock font table. More...
 
void ReleaseTable ()
 Release font table. More...
 
int CalculateChecksum (const char *b, size_t length)
 Calculate a check sum. More...
 
wxPdfFontDataIdentifyFont ()
 Identify a font. More...
 
bool PrepareFontData (wxPdfFontData *fontData)
 Prepare the font data. More...
 
bool CheckTables ()
 Check whether the font contains all required tables. More...
 
void CheckCff ()
 Check whether the font is in compact font format (CFF) More...
 
void CheckRestrictions ()
 Check the font's access restrictions. More...
 
wxString GetBaseFont ()
 Get the base name of the font. More...
 
wxArrayString GetUniqueNames (int id)
 Get a list of unique names. More...
 
wxArrayString GetNames (int id, bool namesOnly=true)
 Get font names. More...
 
wxString GetEnglishName (int id)
 Get the English language font name. More...
 
bool ReadMaps ()
 Read font maps. More...
 
bool ReadGlyphWidths (int numberOfHMetrics, int unitsPerEm)
 Read the glyph widths. More...
 
void ReadKerning (int unitsPerEm)
 Read kerning information. More...
 
bool ReadTableDirectory ()
 Read table directory. More...
 
wxPdfCMap * ReadFormat0 ()
 Read a Format 0 CMap. More...
 
wxPdfCMap * ReadFormat4 ()
 Read a Format 4 CMap. More...
 
wxPdfCMap * ReadFormat6 ()
 Read a Format 6 CMap. More...
 
wxPdfCMap * ReadFormat12 ()
 Read a Format 12 CMap. More...
 
int GetGlyphWidth (unsigned int glyph)
 Get the width of a specific glyph. More...
 

Protected Attributes

size_t m_directoryOffset
 offset of the table directory More...
 
wxPdfTableDirectory * m_tableDirectory
 table directory of the font More...
 
bool m_isMacCoreText
 Flag whether a Mac Core Text font is to be parsed. More...
 
- Protected Attributes inherited from wxPdfFontParser
wxString m_fileName
 File name of the font file. More...
 
wxString m_fontName
 Name of font. More...
 
wxInputStream * m_inFont
 Font file input stream. More...
 
wxString m_style
 Font style. More...
 

Detailed Description

Class representing a TrueType/OpenType font parser.

Constructor & Destructor Documentation

◆ wxPdfFontParserTrueType()

wxPdfFontParserTrueType::wxPdfFontParserTrueType ( )

Default constructor.

◆ ~wxPdfFontParserTrueType()

virtual wxPdfFontParserTrueType::~wxPdfFontParserTrueType ( )
virtual

Default destructor.

Member Function Documentation

◆ CalculateChecksum()

int wxPdfFontParserTrueType::CalculateChecksum ( const char *  b,
size_t  length 
)
protected

Calculate a check sum.

◆ CheckCff()

void wxPdfFontParserTrueType::CheckCff ( )
protected

Check whether the font is in compact font format (CFF)

◆ CheckRestrictions()

void wxPdfFontParserTrueType::CheckRestrictions ( )
protected

Check the font's access restrictions.

◆ CheckTables()

bool wxPdfFontParserTrueType::CheckTables ( )
protected

Check whether the font contains all required tables.

◆ ClearTableDirectory()

void wxPdfFontParserTrueType::ClearTableDirectory ( )
protected

Clear the table directory.

◆ GetBaseFont()

wxString wxPdfFontParserTrueType::GetBaseFont ( )
protected

Get the base name of the font.

Gets the Postscript font name.

Returns
the Postscript font name

◆ GetCollectionFontCount()

int wxPdfFontParserTrueType::GetCollectionFontCount ( const wxString &  fontFileName)

Get the number of fonts within a font collection.

Parameters
fontFileNamethe fully qualified name of the font collection file
Returns
the number of fonts in the collection

◆ GetEnglishName()

wxString wxPdfFontParserTrueType::GetEnglishName ( int  id)
protected

Get the English language font name.

Parameters
idthe name id to retrieve
Returns
the English font name

◆ GetGlyphWidth()

int wxPdfFontParserTrueType::GetGlyphWidth ( unsigned int  glyph)
protected

Get the width of a specific glyph.

◆ GetNames()

wxArrayString wxPdfFontParserTrueType::GetNames ( int  id,
bool  namesOnly = true 
)
protected

Get font names.

Extracts the names of the font in all the languages available. Optionally the platform, encoding and language identifiers are extracted as well. In the latter case 4 consecutive entries in the resulting string array represent a single font name.

Parameters
idthe name id to retrieve
namesOnlyflag whether to extract only names or names and identifiers
Returns
a list of font names

◆ GetUniqueNames()

wxArrayString wxPdfFontParserTrueType::GetUniqueNames ( int  id)
protected

Get a list of unique names.

Extracts the names of the font in all the languages available.

Parameters
idthe name id to retrieve
Returns
a list of unique names

◆ IdentifyFont() [1/2]

wxPdfFontData* wxPdfFontParserTrueType::IdentifyFont ( const wxString &  fontFileName,
int  fontIndex 
)

Identify font based on a font file.

Parameters
fontFileNamefully qualified name of the font file
fontIndexthe index of the font within a font collection (if appropriate)
Returns
a reference to a new font data instance

◆ IdentifyFont() [2/2]

wxPdfFontData* wxPdfFontParserTrueType::IdentifyFont ( )
protected

Identify a font.

◆ LoadFontData()

bool wxPdfFontParserTrueType::LoadFontData ( wxPdfFontData fontData)

Load the font data.

Before using a font it's data have be loaded into memory. This method tries to load the required font data for a previously identified font.

Parameters
fontDatathe font data instance to be loaded
Returns
TRUE if the font data could be loaded successfully, FALSE otherwise

◆ LockTable()

void wxPdfFontParserTrueType::LockTable ( const wxString &  tableName)
protected

Lock font table.

◆ PrepareFontData()

bool wxPdfFontParserTrueType::PrepareFontData ( wxPdfFontData fontData)
protected

Prepare the font data.

◆ ReadFormat0()

wxPdfCMap* wxPdfFontParserTrueType::ReadFormat0 ( )
protected

Read a Format 0 CMap.

◆ ReadFormat12()

wxPdfCMap* wxPdfFontParserTrueType::ReadFormat12 ( )
protected

Read a Format 12 CMap.

◆ ReadFormat4()

wxPdfCMap* wxPdfFontParserTrueType::ReadFormat4 ( )
protected

Read a Format 4 CMap.

◆ ReadFormat6()

wxPdfCMap* wxPdfFontParserTrueType::ReadFormat6 ( )
protected

Read a Format 6 CMap.

◆ ReadGlyphWidths()

bool wxPdfFontParserTrueType::ReadGlyphWidths ( int  numberOfHMetrics,
int  unitsPerEm 
)
protected

Read the glyph widths.

Reads the glyphs widths. The widths are extracted from the table 'hmtx'. The glyphs are normalized to 1000 units.

Parameters
numberOfHMetrics
unitsPerEm
Returns
TRUE if the glyph widths could be read successfully, FALSE otherwise

◆ ReadKerning()

void wxPdfFontParserTrueType::ReadKerning ( int  unitsPerEm)
protected

Read kerning information.

◆ ReadMaps()

bool wxPdfFontParserTrueType::ReadMaps ( )
protected

Read font maps.

Reads the tables 'head', 'hhea', 'OS/2' and 'post' filling several variables.

Returns
TRUE if the font maps could be read successfully, FALSE otherwise

◆ ReadTableDirectory()

bool wxPdfFontParserTrueType::ReadTableDirectory ( )
protected

Read table directory.

◆ ReleaseTable()

void wxPdfFontParserTrueType::ReleaseTable ( )
protected

Release font table.

Member Data Documentation

◆ m_directoryOffset

size_t wxPdfFontParserTrueType::m_directoryOffset
protected

offset of the table directory

◆ m_isMacCoreText

bool wxPdfFontParserTrueType::m_isMacCoreText
protected

Flag whether a Mac Core Text font is to be parsed.

◆ m_tableDirectory

wxPdfTableDirectory* wxPdfFontParserTrueType::m_tableDirectory
protected

table directory of the font


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