PoDoFo  1.0.0-dev
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Friends | List of all members
PoDoFo::PdfEncodingMap Class Referenceabstract

A PdfEncodingMap is a low level interface to convert between utf8 and encoded strings in and to determine correct CID mapping. More...

#include <PdfEncodingMap.h>

Inheritance diagram for PoDoFo::PdfEncodingMap:
PoDoFo::PdfEncodingMapBase PoDoFo::PdfEncodingMapOneByte PoDoFo::PdfIdentityEncoding PoDoFo::PdfNullEncodingMap PoDoFo::PdfPredefinedToUnicodeCMap PoDoFo::PdfBuiltInEncoding PoDoFo::PdfDifferenceEncoding PoDoFo::PdfPredefinedEncoding PoDoFo::PdfStandardEncoding PoDoFo::PdfSymbolEncoding PoDoFo::PdfZapfDingbatsEncoding PoDoFo::PdfMacExpertEncoding PoDoFo::PdfMacRomanEncoding PoDoFo::PdfWinAnsiEncoding

Public Member Functions

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...
 
virtual const PdfEncodingLimits & GetLimits () const =0
 
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...
 

Protected Member Functions

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 bool tryGetCharCode (char32_t codePoint, PdfCharCode &codeUnit) const =0
 Try get char code unit from unicode code point.
 
virtual bool tryGetCodePoints (const PdfCharCode &codeUnit, const unsigned *cidId, CodePointSpan &codePoints) const =0
 Get code points from a code unit. More...
 
virtual void getExportObject (PdfIndirectObjectList &objects, PdfName &name, PdfObject *&obj) const
 Get an export object that will be used during font init. 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
 
virtual void AppendToUnicodeEntries (OutputStream &stream, charbuff &temp) const =0
 During a WriteToUnicodeCMap append "beginbfchar" and "beginbfrange" entries. More...
 
virtual void AppendCIDMappingEntries (OutputStream &stream, const PdfFont &font, charbuff &temp) const =0
 During a PdfEncoding::ExportToFont() append "begincidchar" and/or "begincidrange" entries. More...
 

Static Protected Member Functions

static void AppendUTF16CodeTo (OutputStream &stream, char32_t codePoint, std::u16string &u16tmp)
 
static void AppendUTF16CodeTo (OutputStream &stream, const unicodeview &codePoints, std::u16string &u16tmp)
 

Friends

class PdfEncoding
 
class PdfEncodingMapBase
 
class PdfEncodingMapOneByte
 
class PdfNullEncodingMap
 
class PdfIdentityEncoding
 
class PdfPredefinedToUnicodeCMap
 
class PdfStringScanContext
 

Detailed Description

A PdfEncodingMap is a low level interface to convert between utf8 and encoded strings in and to determine correct CID mapping.

Remarks
Prefer using PdfEncoding methods instead: don't use this class directly unless you know what you are doing

Member Function Documentation

◆ AppendCIDMappingEntries()

virtual void PoDoFo::PdfEncodingMap::AppendCIDMappingEntries ( OutputStream stream,
const PdfFont font,
charbuff temp 
) const
protectedpure virtual

During a PdfEncoding::ExportToFont() append "begincidchar" and/or "begincidrange" entries.

See Adobe tecnichal notes #5014\

To be called by PdfEncoding

Implemented in PoDoFo::PdfPredefinedToUnicodeCMap, PoDoFo::PdfIdentityEncoding, PoDoFo::PdfNullEncodingMap, PoDoFo::PdfEncodingMapOneByte, and PoDoFo::PdfEncodingMapBase.

◆ AppendToUnicodeEntries()

virtual void PoDoFo::PdfEncodingMap::AppendToUnicodeEntries ( OutputStream stream,
charbuff temp 
) const
protectedpure virtual

During a WriteToUnicodeCMap append "beginbfchar" and "beginbfrange" entries.

"bf" stands for Base Font, see Adobe tecnichal notes #5014

To be called by PdfEncoding

Implemented in PoDoFo::PdfPredefinedToUnicodeCMap, PoDoFo::PdfIdentityEncoding, PoDoFo::PdfNullEncodingMap, PoDoFo::PdfEncodingMapOneByte, and PoDoFo::PdfEncodingMapBase.

◆ getExportObject()

void PdfEncodingMap::getExportObject ( PdfIndirectObjectList objects,
PdfName name,
PdfObject *&  obj 
) const
protectedvirtual

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

Remarks
Default implementation just throws

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

◆ GetType()

PdfEncodingMapType PoDoFo::PdfEncodingMap::GetType ( ) const
inline

Type of encoding, may be Simple or CMap.

Simple: built-in, difference and Type1 implicit encodings CMap: proper CMap or PdfIndentityEncoding and other predefined CMap names as well (ISO 32000-1:2008 Table 118 Predefined CJK CMap names, currently not implemented)

Remarks
This is a low level information. Use PdfEncoding::IsSimpleEncoding() to determine if the encoding is really a simple one

◆ GetWModeRaw()

int PdfEncodingMap::GetWModeRaw ( ) const
protectedvirtual

A code that specifies the writing mode for any CIDFont with which this map is combined (make sense when this is a CMap)

Returns
the raw value, -1 if meaningless for this map

◆ TryGetCharCode()

bool PdfEncodingMap::TryGetCharCode ( const unicodeview codePoints,
PdfCharCode codeUnit 
) const

Get the char code from a span of unicode code points.

Parameters
codePointsit can be a single code point or a ligature
Returns
true if the code points match a character code

◆ tryGetCharCodeSpan()

bool PdfEncodingMap::tryGetCharCodeSpan ( const unicodeview ligature,
PdfCharCode codeUnit 
) const
protectedvirtual

Try get next char code unit from a ligature.

Parameters
ligaturethe span has at least 2 unicode code points
Remarks
Default implementation just throws

Reimplemented in PoDoFo::PdfPredefinedToUnicodeCMap, and PoDoFo::PdfEncodingMapBase.

◆ TryGetCodePoints()

bool PdfEncodingMap::TryGetCodePoints ( const PdfCharCode codeUnit,
CodePointSpan codePoints 
) const

Try get code points from char code unit.

Remarks
it will iterate available code sizes

◆ tryGetCodePoints()

virtual bool PoDoFo::PdfEncodingMap::tryGetCodePoints ( const PdfCharCode codeUnit,
const unsigned *  cidId,
CodePointSpan codePoints 
) const
protectedpure virtual

Get code points from a code unit.

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

Implemented in PoDoFo::PdfPredefinedToUnicodeCMap, PoDoFo::PdfIdentityEncoding, PoDoFo::PdfNullEncodingMap, PoDoFo::PdfBuiltInEncoding, PoDoFo::PdfEncodingMapBase, and PoDoFo::PdfDifferenceEncoding.

◆ TryGetExportObject()

bool PdfEncodingMap::TryGetExportObject ( PdfIndirectObjectList objects,
PdfName name,
PdfObject *&  obj 
) const

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

Parameters
objectslist to use to create document objects
namename to use
objif not null the object will be used instead

◆ tryGetNextCharCode()

bool PdfEncodingMap::tryGetNextCharCode ( std::string_view::iterator &  it,
const std::string_view::iterator &  end,
PdfCharCode codeUnit 
) const
protectedvirtual

Try get next char code unit from a utf8 string range.

Remarks
Default implementation just throws

Reimplemented in PoDoFo::PdfEncodingMapBase.


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