pdfmm 0.9.20
Public Member Functions | Protected Member Functions | List of all members
mm::PdfEncodingMap Class Referenceabstract

#include <PdfEncodingMap.h>

Inheritance diagram for mm::PdfEncodingMap:
mm::PdfDummyEncodingMap mm::PdfEncodingMapBase mm::PdfEncodingMapSimple mm::PdfIdentityEncoding mm::PdfFontType1Encoding mm::PdfDifferenceEncoding mm::PdfPredefinedEncoding mm::PdfDocEncoding mm::PdfMacExpertEncoding mm::PdfMacRomanEncoding mm::PdfStandardEncoding mm::PdfSymbolEncoding mm::PdfWinAnsiEncoding mm::PdfZapfDingbatsEncoding mm::PdfIso88592Encoding mm::PdfWin1250Encoding

Public Member Functions

bool TryGetNextCharCode (std::string_view::iterator &it, const std::string_view::iterator &end, PdfCharCode &codeUnit) const
 
bool TryGetCharCode (char32_t codePoint, PdfCharCode &codeUnit) const
 
bool TryGetCharCode (const cspan< char32_t > &codePoints, PdfCharCode &codeUnit) const
 
bool TryGetCharCode (unsigned cid, PdfCharCode &codeUnit) const
 
bool TryGetNextCID (std::string_view::iterator &it, const std::string_view::iterator &end, PdfCID &cid) const
 
bool TryGetNextCodePoints (std::string_view::iterator &it, const std::string_view::iterator &end, std::vector< char32_t > &codePoints) const
 
bool TryGetCodePoints (const PdfCharCode &codeUnit, std::vector< char32_t > &codePoints) const
 
bool TryGetCIDId (const PdfCharCode &codeUnit, unsigned &id) const
 
virtual bool HasCIDMapping () const
 
virtual bool HasLigaturesSupport () const
 
bool TryGetExportObject (PdfIndirectObjectList &objects, PdfName &name, PdfObject *&obj) const
 

Protected Member Functions

virtual bool tryGetNextCharCode (std::string_view::iterator &it, const std::string_view::iterator &end, PdfCharCode &codeUnit) const
 
virtual bool tryGetCharCodeSpan (const cspan< char32_t > &ligature, PdfCharCode &codeUnit) const
 
virtual bool tryGetCharCode (char32_t codePoint, PdfCharCode &codeUnit) const =0
 
virtual bool tryGetCodePoints (const PdfCharCode &codeUnit, std::vector< char32_t > &codePoints) const =0
 
virtual void getExportObject (PdfIndirectObjectList &objects, PdfName &name, PdfObject *&obj) const
 
virtual void appendBaseFontEntries (PdfStream &stream) const =0
 

Detailed Description

A PdfEncodingMap is a low level interface to convert between utf8 and encoded strings in Pdf.

Remarks
Don't use this class directly, use PdfEncoding

Member Function Documentation

◆ appendBaseFontEntries()

virtual void mm::PdfEncodingMap::appendBaseFontEntries ( PdfStream stream) const
protectedpure virtual

During a WriteToUnicodeCMap append "beginbfchar" and "beginbfrange" entries "bf" stands for Base Font, see Adobe tecnichal notes #5014

Implemented in mm::PdfEncodingMapBase, mm::PdfEncodingMapSimple, mm::PdfDummyEncodingMap, and mm::PdfIdentityEncoding.

◆ 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 mm::PdfDifferenceEncoding, mm::PdfFontType1Encoding, mm::PdfIdentityEncoding, mm::PdfPredefinedEncoding, and mm::PdfWinAnsiEncoding.

◆ HasCIDMapping()

bool PdfEncodingMap::HasCIDMapping ( ) const
virtual

True if the encoding has proper CID mapping

Most maps represents just an identity CID encoding such as built-in/difference encodings and rely on presence of /FirstChar to map from a character code to a index in the glyph list

Reimplemented in mm::PdfIdentityEncoding.

◆ HasLigaturesSupport()

bool PdfEncodingMap::HasLigaturesSupport ( ) const
virtual

True if the encoding has ligatures support

◆ TryGetCharCode() [1/3]

bool PdfEncodingMap::TryGetCharCode ( char32_t  codePoint,
PdfCharCode codeUnit 
) const

Try get next char code unit from unicode code point

◆ tryGetCharCode()

virtual bool mm::PdfEncodingMap::tryGetCharCode ( char32_t  codePoint,
PdfCharCode codeUnit 
) const
protectedpure virtual

◆ TryGetCharCode() [2/3]

bool PdfEncodingMap::TryGetCharCode ( const cspan< char32_t > &  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

◆ TryGetCharCode() [3/3]

bool PdfEncodingMap::TryGetCharCode ( unsigned  cid,
PdfCharCode codeUnit 
) const

Try get next char code unit from cid

◆ tryGetCharCodeSpan()

bool PdfEncodingMap::tryGetCharCodeSpan ( const cspan< char32_t > &  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 mm::PdfEncodingMapBase.

◆ TryGetCIDId()

bool PdfEncodingMap::TryGetCIDId ( const PdfCharCode codeUnit,
unsigned &  id 
) const

Try get CID identifier code from code unit

Parameters
idthe identifier of the CID. The identifier is actually the PdfCID::Id part in the full CID representation

◆ TryGetCodePoints()

bool PdfEncodingMap::TryGetCodePoints ( const PdfCharCode codeUnit,
std::vector< char32_t > &  codePoints 
) const

Try get code points from char code unit

Remarks
it will iterate available code sizes

◆ tryGetCodePoints()

virtual bool mm::PdfEncodingMap::tryGetCodePoints ( const PdfCharCode codeUnit,
std::vector< char32_t > &  codePoints 
) const
protectedpure virtual

Get code points from a code unit

Parameters
wantCIDtrue requires mapping to CID identifier, false for Unicode code points

Implemented in mm::PdfDifferenceEncoding, mm::PdfEncodingMapBase, mm::PdfDummyEncodingMap, mm::PdfIdentityEncoding, and mm::PdfPredefinedEncoding.

◆ 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

Try decode next char code from utf8 string range

◆ 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 mm::PdfEncodingMapBase.

◆ TryGetNextCID()

bool PdfEncodingMap::TryGetNextCID ( std::string_view::iterator &  it,
const std::string_view::iterator &  end,
PdfCID cid 
) const

Try decode next cid from from encoded string range

◆ TryGetNextCodePoints()

bool PdfEncodingMap::TryGetNextCodePoints ( std::string_view::iterator &  it,
const std::string_view::iterator &  end,
std::vector< char32_t > &  codePoints 
) const

Try decode next code points from encoded string range