PoDoFo  1.0.0-dev
Public Member Functions | List of all members
PoDoFo::PdfCharCodeMap Class Referencefinal

A bidirectional map from character code units to unspecified code points. More...

#include <PdfCharCodeMap.h>

Public Member Functions

 PdfCharCodeMap (PdfCharCodeMap &&map) noexcept
 
void PushMapping (const PdfCharCode &codeUnit, const codepointview &codePoints)
 Method to push a mapping. More...
 
void PushMapping (const PdfCharCode &codeUnit, codepoint codePoint)
 Convenience method to push a single code point mapping.
 
void PushRange (const PdfCharCode &srcCodeLo, unsigned size, codepoint dstCodeLo)
 Push a range mapping in the form "srcCodeLo srcCodeHi dstCodeLo". More...
 
void PushRange (const PdfCharCode &srcCodeLo, unsigned size, const codepointview &dstCodeLo)
 Push a range mapping in the form "srcCodeLo srcCodeHi dstCodeLo". More...
 
bool TryGetCodePoints (const PdfCharCode &codeUnit, CodePointSpan &codePoints) const
 Returns false when no mapped identifiers are not found in the map.
 
bool TryGetNextCharCode (std::string_view::iterator &it, const std::string_view::iterator &end, PdfCharCode &code) const
 Try get char code from utf8 encoded range. More...
 
bool TryGetCharCode (const codepointview &codePoints, PdfCharCode &code) const
 Try get char code from unicode code points. More...
 
bool TryGetCharCode (codepoint codePoint, PdfCharCode &code) const
 Try get char code from unicode code point.
 
PdfCharCodeMapoperator= (PdfCharCodeMap &&map) noexcept
 
const PdfEncodingLimits & GetLimits () const
 
bool IsEmpty () const
 
bool IsTrivialIdentity () const
 Determines if the map is a trivial identity.
 
std::vector< unsigned char > GetCodeRangeSizes () const
 Get a list or code range size defined in this map.
 
const CodeUnitMap & GetMappings () const
 Provides direct mappings.
 
const CodeUnitRanges & GetRanges () const
 Provides range mappings.
 

Detailed Description

A bidirectional map from character code units to unspecified code points.

Remarks
The actual code point nature is unspecified, but it can either be unicode code points or CID(s) as used in CID keyed fonts. For generic terminology see https://en.wikipedia.org/wiki/Character_encoding#Terminology See also 5014.CIDFont_Spec, 2.1 Terminology

Member Function Documentation

◆ PushMapping()

void PdfCharCodeMap::PushMapping ( const PdfCharCode codeUnit,
const codepointview &  codePoints 
)

Method to push a mapping.

Given string can be a ligature, es "ffi"

Remarks
The mapping is ignored if codePoints is empty

◆ PushRange() [1/2]

void PdfCharCodeMap::PushRange ( const PdfCharCode srcCodeLo,
unsigned  size,
codepoint  dstCodeLo 
)

Push a range mapping in the form "srcCodeLo srcCodeHi dstCodeLo".

See 5014.CIDFont_Spec, 7.2 Operator summary for begincidrange specifications

Remarks
The range is ignored if srcCodeHi < srcCodeLo

◆ PushRange() [2/2]

void PdfCharCodeMap::PushRange ( const PdfCharCode srcCodeLo,
unsigned  size,
const codepointview &  dstCodeLo 
)

Push a range mapping in the form "srcCodeLo srcCodeHi dstCodeLo".

See 5014.CIDFont_Spec, 7.2 Operator summary for beginbfrange specifications

Remarks
The range is ignored if srcCodeHi < srcCodeLo or dstCodeLo is empty

◆ TryGetCharCode()

bool PdfCharCodeMap::TryGetCharCode ( const codepointview &  codePoints,
PdfCharCode code 
) const

Try get char code from unicode code points.

Parameters
codePointssequence of unicode code points. All the sequence must match

◆ TryGetNextCharCode()

bool PdfCharCodeMap::TryGetNextCharCode ( std::string_view::iterator &  it,
const std::string_view::iterator &  end,
PdfCharCode code 
) const

Try get char code from utf8 encoded range.

Remarks
It assumes it != and it will consumes the iterator also when returning false

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