PoDoFo  1.0.0-dev
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
PoDoFo::PdfDifferenceEncoding Class Referencefinal

PdfDifferenceEncoding is an encoding, which is based on either the fonts encoding or a predefined encoding and defines differences to this base encoding. More...

#include <PdfDifferenceEncoding.h>

Inheritance diagram for PoDoFo::PdfDifferenceEncoding:
PoDoFo::PdfEncodingMapOneByte PoDoFo::PdfEncodingMap

Public Member Functions

 PdfDifferenceEncoding (const PdfEncodingMapConstPtr &baseEncoding, const PdfDifferenceList &differences)
 Create a new PdfDifferenceEncoding which is based on a predefined encoding. More...
 
const PdfDifferenceListGetDifferences () const
 Get read-only access to the object containing the actual differences. More...
 
- Public Member Functions inherited from PoDoFo::PdfEncodingMap
bool TryGetNextCharCode (std::string_view::iterator &it, const std::string_view::iterator &end, PdfCharCode &codeUnit) const
 Try decode next char code from utf8 string range.
 
bool TryGetCharCode (char32_t codePoint, PdfCharCode &codeUnit) const
 Try get next char code unit from unicode code point.
 
bool TryGetCharCode (const unicodeview &codePoints, PdfCharCode &codeUnit) const
 Get the char code from a span of unicode code points. More...
 
bool TryGetCharCode (unsigned cid, PdfCharCode &codeUnit) const
 Try get next char code unit from cid.
 
bool TryGetNextCID (std::string_view::iterator &it, const std::string_view::iterator &end, PdfCID &cid) const
 Try decode next cid from from encoded string range.
 
bool TryGetNextCodePoints (std::string_view::iterator &it, const std::string_view::iterator &end, CodePointSpan &codePoints) const
 Try decode next code points from encoded string range.
 
bool TryGetCodePoints (const PdfCharCode &codeUnit, CodePointSpan &codePoints) const
 Try get code points from char code unit. More...
 
PdfEncodingMapType GetType () const
 Type of encoding, may be Simple or CMap. More...
 
virtual PdfPredefinedEncodingType GetPredefinedEncodingType () const
 True if the encoding is builtin in a font program.
 
virtual bool HasLigaturesSupport () const
 True if the encoding has ligatures support.
 
bool TryGetExportObject (PdfIndirectObjectList &objects, PdfName &name, PdfObject *&obj) const
 Get an export object that will be used during font init. More...
 

Static Public Member Functions

static bool TryCreateFromObject (const PdfObject &obj, const PdfFontMetrics &metrics, std::unique_ptr< PdfDifferenceEncoding > &encoding)
 Create a new PdfDifferenceEncoding from an existing object. More...
 
static std::unique_ptr< PdfDifferenceEncodingCreateFromObject (const PdfObject &obj, const PdfFontMetrics &metrics)
 Create a new PdfDifferenceEncoding from an existing object. More...
 
static char32_t NameToCodePoint (const std::string_view &name)
 Convert a standard character name to a unicode code point. More...
 
static PdfName CodePointToName (char32_t codePoint)
 Convert an unicode code point to a standard character name. More...
 

Protected Member Functions

void getExportObject (PdfIndirectObjectList &objects, PdfName &name, PdfObject *&obj) const override
 Get an export object that will be used during font init. More...
 
bool tryGetCharCode (char32_t codePoint, PdfCharCode &codeUnit) const override
 Try get char code unit from unicode code point.
 
bool tryGetCodePoints (const PdfCharCode &codeUnit, const unsigned *cidId, CodePointSpan &codePoints) const override
 Get code points from a code unit. More...
 
- Protected Member Functions inherited from PoDoFo::PdfEncodingMapOneByte
void AppendToUnicodeEntries (OutputStream &stream, charbuff &temp) const override
 During a WriteToUnicodeCMap append "beginbfchar" and "beginbfrange" entries. More...
 
void AppendCIDMappingEntries (OutputStream &stream, const PdfFont &font, charbuff &temp) const override
 During a PdfEncoding::ExportToFont() append "begincidchar" and/or "begincidrange" entries. More...
 
const PdfEncodingLimits & GetLimits () const override
 
- Protected Member Functions inherited from PoDoFo::PdfEncodingMap
virtual bool tryGetNextCharCode (std::string_view::iterator &it, const std::string_view::iterator &end, PdfCharCode &codeUnit) const
 Try get next char code unit from a utf8 string range. More...
 
virtual bool tryGetCharCodeSpan (const unicodeview &ligature, PdfCharCode &codeUnit) const
 Try get next char code unit from a ligature. More...
 
virtual int GetWModeRaw () const
 A code that specifies the writing mode for any CIDFont with which this map is combined (make sense when this is a CMap) More...
 
virtual void AppendCodeSpaceRange (OutputStream &stream, charbuff &temp) const
 

Additional Inherited Members

- Static Protected Member Functions inherited from PoDoFo::PdfEncodingMap
static void AppendUTF16CodeTo (OutputStream &stream, char32_t codePoint, std::u16string &u16tmp)
 
static void AppendUTF16CodeTo (OutputStream &stream, const unicodeview &codePoints, std::u16string &u16tmp)
 

Detailed Description

PdfDifferenceEncoding is an encoding, which is based on either the fonts encoding or a predefined encoding and defines differences to this base encoding.

Constructor & Destructor Documentation

◆ PdfDifferenceEncoding()

PdfDifferenceEncoding::PdfDifferenceEncoding ( const PdfEncodingMapConstPtr baseEncoding,
const PdfDifferenceList differences 
)

Create a new PdfDifferenceEncoding which is based on a predefined encoding.

Parameters
differencethe differences in this encoding
baseEncodingthe base encoding of this font

Member Function Documentation

◆ CodePointToName()

PdfName PdfDifferenceEncoding::CodePointToName ( char32_t  codePoint)
static

Convert an unicode code point to a standard character name.

Parameters
codePointa code point
Returns
a standard character name of /.notdef if none could be found

◆ CreateFromObject()

unique_ptr< PdfDifferenceEncoding > PdfDifferenceEncoding::CreateFromObject ( const PdfObject obj,
const PdfFontMetrics metrics 
)
static

Create a new PdfDifferenceEncoding from an existing object.

Parameters
objobject for the difference encoding
metricsan existing font metrics
Returns
On success, returns a non null PdfDifferenceEncoding
Remarks
throws on failure

◆ GetDifferences()

const PdfDifferenceList& PoDoFo::PdfDifferenceEncoding::GetDifferences ( ) const
inline

Get read-only access to the object containing the actual differences.

Returns
the container with the actual differences

◆ getExportObject()

void PdfDifferenceEncoding::getExportObject ( PdfIndirectObjectList objects,
PdfName name,
PdfObject *&  obj 
) const
overrideprotectedvirtual

Get an export object that will be used during font init.

Remarks
Default implementation just throws

Reimplemented from PoDoFo::PdfEncodingMap.

◆ NameToCodePoint()

char32_t PdfDifferenceEncoding::NameToCodePoint ( const std::string_view &  name)
static

Convert a standard character name to a unicode code point.

Parameters
namea standard character name
Returns
an unicode code point

◆ TryCreateFromObject()

bool PdfDifferenceEncoding::TryCreateFromObject ( const PdfObject obj,
const PdfFontMetrics metrics,
std::unique_ptr< PdfDifferenceEncoding > &  encoding 
)
static

Create a new PdfDifferenceEncoding from an existing object.

Parameters
objobject for the difference encoding
metricsan existing font metrics

◆ tryGetCodePoints()

bool PdfDifferenceEncoding::tryGetCodePoints ( const PdfCharCode codeUnit,
const unsigned *  cidId,
CodePointSpan codePoints 
) const
overrideprotectedvirtual

Get code points from a code unit.

Parameters
cidIdCID identifier that if available some encodings can benefit to fetch code points faster

Implements PoDoFo::PdfEncodingMap.


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