PoDoFo 0.9.6
PoDoFo::PdfEncoding Class Referenceabstract

#include <PdfEncoding.h>

Inheritance diagram for PoDoFo::PdfEncoding:
PoDoFo::PdfDifferenceEncoding PoDoFo::PdfIdentityEncoding PoDoFo::PdfSimpleEncoding PoDoFo::PdfDocEncoding PoDoFo::PdfMacRomanEncoding PoDoFo::PdfStandardEncoding PoDoFo::PdfSymbolEncoding PoDoFo::PdfWinAnsiEncoding PoDoFo::PdfZapfDingbatsEncoding PoDoFo::PdfIso88592Encoding PoDoFo::PdfWin1250Encoding

Public Member Functions

bool operator== (const PdfEncoding &rhs) const
bool operator< (const PdfEncoding &rhs) const
virtual void AddToDictionary (PdfDictionary &rDictionary) const =0
virtual PdfString ConvertToUnicode (const PdfString &rEncodedString, const PdfFont *pFont) const
virtual PdfRefCountedBuffer ConvertToEncoding (const PdfString &rString, const PdfFont *pFont) const
int GetFirstChar () const
int GetLastChar () const
const_iterator begin () const
const_iterator end () const
virtual pdf_utf16be GetCharCode (int nIndex) const =0

Protected Member Functions

 PdfEncoding (int nFirstChar, int nLastChar, PdfObject *=NULL)
virtual const PdfNameGetID () const =0

Protected Attributes

bool m_bToUnicodeIsLoaded
 If true, ToUnicode has been parsed.

Detailed Description

A PdfEncoding is in PdfFont to transform a text string into a representation so that it can be displayed in a PDF file.

PdfEncoding can also be used to convert strings from a PDF file back into a PdfString.

Constructor & Destructor Documentation

◆ PdfEncoding()

PoDoFo::PdfEncoding::PdfEncoding ( int nFirstChar,
int nLastChar,
PdfObject * pToUnicode = NULL )
protected

Create a new PdfEncoding.

Parameters
nFirstCharthe first supported character code (either a byte value in the current encoding or a Unicode value)
nLastCharthe last supported character code, must be larger than nFirstChar (either a byte value in the current encoding or a Unicode value)

Member Function Documentation

◆ AddToDictionary()

virtual void PoDoFo::PdfEncoding::AddToDictionary ( PdfDictionary & rDictionary) const
pure virtual

Add this encoding object to a dictionary usually be adding an /Encoding key in font dictionaries.

Parameters
rDictionaryadd the encoding to this dictionary

Implemented in PoDoFo::PdfDifferenceEncoding, PoDoFo::PdfIdentityEncoding, PoDoFo::PdfSimpleEncoding, and PoDoFo::PdfWinAnsiEncoding.

◆ begin()

PdfEncoding::const_iterator PoDoFo::PdfEncoding::begin ( ) const
inline

Iterate over all Unicode character points in this encoding, beginning with the first.

Returns
iterator pointing to the first defined Unicode character

◆ ConvertToEncoding()

PdfRefCountedBuffer PoDoFo::PdfEncoding::ConvertToEncoding ( const PdfString & rString,
const PdfFont * pFont ) const
virtual

Convert a Unicode PdfString to a string encoded with this encoding.

Parameters
rStringa Unicode PdfString.
pFontthe font for which this string is converted
Returns
an encoded PdfRefCountedBuffer. The PdfRefCountedBuffer is treated as a series of bytes and is allowed to have 0 bytes. The returned buffer must not be a Unicode string.

Reimplemented in PoDoFo::PdfDifferenceEncoding, PoDoFo::PdfIdentityEncoding, and PoDoFo::PdfSimpleEncoding.

◆ ConvertToUnicode()

PdfString PoDoFo::PdfEncoding::ConvertToUnicode ( const PdfString & rEncodedString,
const PdfFont * pFont ) const
virtual

Convert a string that is encoded with this encoding to a Unicode PdfString.

Parameters
rEncodedStringa string encoded by this encoding. Usually this string was read from a content stream.
pFontthe font for which this string is converted
Returns
a Unicode PdfString.

Reimplemented in PoDoFo::PdfDifferenceEncoding, PoDoFo::PdfIdentityEncoding, and PoDoFo::PdfSimpleEncoding.

◆ end()

PdfEncoding::const_iterator PoDoFo::PdfEncoding::end ( ) const
inline

Iterate over all Unicode character points in this encoding, beginning with the first.

Returns
iterator pointing at the end

◆ GetCharCode()

virtual pdf_utf16be PoDoFo::PdfEncoding::GetCharCode ( int nIndex) const
pure virtual

Get the Unicode character code for this encoding at the position nIndex. nIndex is a position between GetFirstChar() and GetLastChar()

Parameters
nIndexcharacter code at position index
Returns
Unicode character code
See also
GetFirstChar
GetLastChar

Will throw an exception if nIndex is out of range.

Implemented in PoDoFo::PdfDifferenceEncoding, PoDoFo::PdfIdentityEncoding, and PoDoFo::PdfSimpleEncoding.

◆ GetFirstChar()

int PoDoFo::PdfEncoding::GetFirstChar ( ) const
inline
Returns
the first character code that is defined for this encoding

◆ GetID()

virtual const PdfName & PoDoFo::PdfEncoding::GetID ( ) const
protectedpure virtual

Get a unique ID for this encoding which can used for comparisons!

Returns
a unique id for this encoding!

Implemented in PoDoFo::PdfDifferenceEncoding, PoDoFo::PdfIdentityEncoding, PoDoFo::PdfIso88592Encoding, PoDoFo::PdfSimpleEncoding, and PoDoFo::PdfWin1250Encoding.

◆ GetLastChar()

int PoDoFo::PdfEncoding::GetLastChar ( ) const
inline
Returns
the last character code that is defined for this encoding

◆ operator<()

bool PoDoFo::PdfEncoding::operator< ( const PdfEncoding & rhs) const
inline

Comparison operator.

Parameters
rhsthe PdfEncoding to which this encoding should be compared
Returns
true if this encoding is less than the specified.

◆ operator==()

bool PoDoFo::PdfEncoding::operator== ( const PdfEncoding & rhs) const
inline

Comparison operator.

Parameters
rhsthe PdfEncoding to which this encoding should be compared
Returns
true if both encodings are the same.