PoDoFo  0.9.4
Public Member Functions | Protected Member Functions | List of all members
PoDoFo::PdfIdentityEncoding Class Reference

#include <PdfIdentityEncoding.h>

Inheritance diagram for PoDoFo::PdfIdentityEncoding:
PoDoFo::PdfEncoding

Public Member Functions

 PdfIdentityEncoding (int nFirstChar=0, int nLastChar=0xffff, bool bAutoDelete=true, PdfObject *pToUnicode=NULL)
 
virtual void AddToDictionary (PdfDictionary &rDictionary) const
 
virtual PdfString ConvertToUnicode (const PdfString &rEncodedString, const PdfFont *pFont) const
 
virtual PdfRefCountedBuffer ConvertToEncoding (const PdfString &rString, const PdfFont *pFont) const
 
virtual bool IsAutoDelete () const
 
virtual bool IsSingleByteEncoding () const
 
virtual pdf_utf16be GetCharCode (int nIndex) const
 
- Public Member Functions inherited from PoDoFo::PdfEncoding
bool operator== (const PdfEncoding &rhs) const
 
bool operator< (const PdfEncoding &rhs) const
 
int GetFirstChar () const
 
int GetLastChar () const
 
const_iterator begin () const
 
const_iterator end () const
 

Protected Member Functions

virtual const PdfNameGetID () const
 
- Protected Member Functions inherited from PoDoFo::PdfEncoding
 PdfEncoding (int nFirstChar, int nLastChar, PdfObject *=NULL)
 

Additional Inherited Members

- Protected Attributes inherited from PoDoFo::PdfEncoding
bool m_bToUnicodeIsLoaded
 If true, ToUnicode has been parse.
 

Detailed Description

PdfIdentityEncoding is a two-byte encoding which can be used with TrueType fonts to represent all characters present in a font. If the font contains all unicode glyphs, PdfIdentityEncoding will support all unicode characters.

Constructor & Destructor Documentation

PoDoFo::PdfIdentityEncoding::PdfIdentityEncoding ( int  nFirstChar = 0,
int  nLastChar = 0xffff,
bool  bAutoDelete = true,
PdfObject pToUnicode = NULL 
)

Create a new PdfIdentityEncoding.

Parameters
nFirstCharthe first supported unicode character code (at least 0)
nLastCharthe last supported unicode character code, must be larger than nFirstChar (max value is 0xffff)
bAutoDeleteif true the encoding is deleted by its owning font

Member Function Documentation

void PoDoFo::PdfIdentityEncoding::AddToDictionary ( PdfDictionary rDictionary) const
virtual

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

Parameters
rDictionaryadd the encoding to this dictionary

Implements PoDoFo::PdfEncoding.

PdfRefCountedBuffer PoDoFo::PdfIdentityEncoding::ConvertToEncoding ( const PdfString rString,
const PdfFont pFont 
) const
virtual

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

Parameters
rStringan 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 from PoDoFo::PdfEncoding.

PdfString PoDoFo::PdfIdentityEncoding::ConvertToUnicode ( const PdfString rEncodedString,
const PdfFont pFont 
) const
virtual

Convert a string that is encoded with this encoding to an 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
an unicode PdfString.

Reimplemented from PoDoFo::PdfEncoding.

pdf_utf16be PoDoFo::PdfIdentityEncoding::GetCharCode ( int  nIndex) const
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.

Implements PoDoFo::PdfEncoding.

const PdfName & PoDoFo::PdfIdentityEncoding::GetID ( ) const
inlineprotectedvirtual

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

Returns
a unique id for this encoding!

Implements PoDoFo::PdfEncoding.

bool PoDoFo::PdfIdentityEncoding::IsAutoDelete ( ) const
inlinevirtual

PdfIdentityEncoding is usually delete along with the font.

Returns
true if this encoding should be deleted automatically with the font.

Implements PoDoFo::PdfEncoding.

bool PoDoFo::PdfIdentityEncoding::IsSingleByteEncoding ( ) const
inlinevirtual
Returns
true if this is a single byte encoding with a maximum of 256 values.

Implements PoDoFo::PdfEncoding.