pdfmm 0.9.20
Public Member Functions | List of all members
mm::PdfEncoding Class Reference

#include <PdfEncoding.h>

Inheritance diagram for mm::PdfEncoding:
mm::PdfDynamicEncoding mm::PdfEncodingShim

Public Member Functions

 PdfEncoding ()
 
std::string ConvertToUtf8 (const PdfString &encodedStr) const
 
bool TryConvertToUtf8 (const PdfString &encodedStr, std::string &str) const
 
std::string ConvertToEncoded (const std::string_view &str) const
 
std::vector< PdfCIDConvertToCIDs (const std::string_view &str) const
 
bool TryConvertToCIDs (const std::string_view &str, std::vector< PdfCID > &cids) const
 
std::vector< PdfCIDConvertToCIDs (const PdfString &encodedStr) const
 
bool TryConvertToCIDs (const PdfString &encodedStr, std::vector< PdfCID > &cids) const
 
PdfCID GetCID (char32_t codePoint) const
 
char32_t GetCodePoint (const PdfCharCode &codeUnit) const
 
char32_t GetCodePoint (unsigned charCode) const
 
const PdfCharCodeGetFirstChar () const
 
const PdfCharCodeGetLastChar () const
 
size_t GetId () const
 
const PdfEncodingLimits & GetLimits () const
 

Detailed Description

A PdfEncoding is in PdfFont to transform a text string into a representation so that it can be displayed in a PDF file.

PdfEncoding can also be used to convert strings from a PDF file back into a PdfString.

Constructor & Destructor Documentation

◆ PdfEncoding()

PdfEncoding::PdfEncoding ( )

Null encoding

Member Function Documentation

◆ ConvertToCIDs() [1/2]

vector< PdfCID > PdfEncoding::ConvertToCIDs ( const PdfString encodedStr) const
Remarks
Doesn't throw if conversion failed, totally or partially

◆ ConvertToCIDs() [2/2]

std::vector< PdfCID > mm::PdfEncoding::ConvertToCIDs ( const std::string_view &  str) const

Get a cid codes from a utf8 string

Remarks
Doesn't throw if conversion failed, totally or partially

◆ ConvertToEncoded()

string PdfEncoding::ConvertToEncoded ( const std::string_view &  str) const
Remarks
It throws if conversion failed, totally or partially

◆ ConvertToUtf8()

string PdfEncoding::ConvertToUtf8 ( const PdfString encodedStr) const
Remarks
Doesn't throw if conversion failed, totally or partially

◆ GetCID()

PdfCID PdfEncoding::GetCID ( char32_t  codePoint) const
Remarks
Doesn't throw if conversion failed, totally or partially

◆ GetCodePoint() [1/2]

char32_t PdfEncoding::GetCodePoint ( const PdfCharCode codeUnit) const

Get code point from char code unit

Returns
the found code point or U'\0' if missing or multiple matched codepoints

◆ GetCodePoint() [2/2]

char32_t PdfEncoding::GetCodePoint ( unsigned  charCode) const

Get code point from char code

Returns
the found code point or U'\0' if missing or multiple matched codepoints
Remarks
it will iterate available code sizes

◆ GetFirstChar()

const PdfCharCode & PdfEncoding::GetFirstChar ( ) const

This return the first char code used in the encoding

Remarks
Mostly useful for non cid-keyed fonts to export /FirstChar

◆ GetId()

size_t mm::PdfEncoding::GetId ( ) const
inline

Return an Id to be used in hashed containers. Id 0 has a special meaning for PdfDynamicEncoding

See also
PdfDynamicEncoding

◆ GetLastChar()

const PdfCharCode & PdfEncoding::GetLastChar ( ) const

This return the last char code used in the encoding

Remarks
Mostly useful for non cid-keyed fonts to export /LastChar

◆ GetLimits()

const PdfEncodingLimits & PdfEncoding::GetLimits ( ) const

Get actual limits of the encoding

May be the limits inferred from /Encoding or the limits inferred by /FirstChar, /LastChar

◆ TryConvertToCIDs() [1/2]

bool mm::PdfEncoding::TryConvertToCIDs ( const PdfString encodedStr,
std::vector< PdfCID > &  cids 
) const
Remarks
Produces a partial result also in case of failure

◆ TryConvertToCIDs() [2/2]

bool mm::PdfEncoding::TryConvertToCIDs ( const std::string_view &  str,
std::vector< PdfCID > &  cids 
) const

Try to get a cid codes from a utf8 string

Remarks
Produces a partial result also in case of failure

◆ TryConvertToUtf8()

bool PdfEncoding::TryConvertToUtf8 ( const PdfString encodedStr,
std::string &  str 
) const
Remarks
Produces a partial result also in case of failure