10#include "PdfEncodingMap.h"
31 bool IsEndOfString()
const;
39 std::string_view::iterator m_it;
40 std::string_view::iterator m_end;
42 PdfEncodingLimits m_limits;
88 static std::unique_ptr<PdfEncoding> CreateDynamicEncoding(
const std::shared_ptr<PdfCharCodeMap>&
cidMap,
105 charbuff ConvertToEncoded(
const std::string_view&
str)
const;
132 char32_t GetCodePoint(
unsigned charCode)
const;
153 bool HasCIDMapping()
const;
158 bool IsSimpleEncoding()
const;
162 bool HasParsedLimits()
const;
166 bool IsDynamicEncoding()
const;
171 unsigned GetId()
const {
return m_Id; }
182 const PdfEncodingLimits& GetLimits()
const;
184 bool HasValidToUnicodeMap()
const;
204 inline const PdfEncodingMap& GetEncodingMap()
const {
return *m_Encoding; }
206 inline const PdfEncodingMapConstPtr GetEncodingMapPtr()
const {
return m_Encoding; }
211 PdfEncoding& operator=(
const PdfEncoding&) =
default;
215 void ExportToFont(PdfFont& font,
const PdfCIDSystemInfo& cidInfo)
const;
216 void ExportToFont(PdfFont& font)
const;
217 bool TryGetCIDId(
const PdfCharCode& codeUnit,
unsigned& cid)
const;
219 static unsigned GetNextId();
222 void exportToFont(PdfFont& font,
const PdfCIDSystemInfo* cidInfo)
const;
223 bool tryExportEncodingTo(PdfDictionary& dictionary,
bool wantCidMapping)
const;
224 bool tryConvertEncodedToUtf8(
const std::string_view& encoded, std::string& str)
const;
225 bool tryConvertEncodedToCIDs(
const std::string_view& encoded, std::vector<PdfCID>& cids)
const;
226 void writeCIDMapping(PdfObject& cmapObj,
const PdfFont& font,
const PdfCIDSystemInfo& info)
const;
227 void writeToUnicodeCMap(PdfObject& cmapObj,
const PdfFont& font)
const;
228 bool tryGetCharCode(PdfFont& font,
unsigned gid,
const unicodeview& codePoints, PdfCharCode& unit)
const;
232 bool m_IsObjectLoaded;
233 PdfEncodingLimits m_ParsedLimits;
A memory owning immutable block of code points, optimized for small segments as up to 3 elements can ...
Definition PdfCharCodeMap.h:29
This factory creates a PdfEncoding from an existing object in the PDF.
Definition PdfEncodingFactory.h:20
A PdfEncodingMap is a low level interface to convert between utf8 and encoded strings in and to deter...
Definition PdfEncodingMap.h:28
A PdfEncoding is in PdfFont to transform a text string into a representation so that it can be displa...
Definition PdfEncoding.h:55
bool IsObjectLoaded() const
True if the encoding is constructed from object loaded information.
Definition PdfEncoding.h:176
unsigned GetId() const
Return an Id to be used in hashed containers.
Definition PdfEncoding.h:171
A PdfFont that represents a CID-keyed font that has a TrueType/OpenType font backend (aka "CIDFontTyp...
Definition PdfFontCIDTrueType.h:17
A PdfFont that represents a CID-keyed font.
Definition PdfFontCID.h:17
This is a common base class for simple, non CID-keyed fonts like Type1, TrueType and Type3.
Definition PdfFontSimple.h:20
Before you can draw text on a PDF document, you have to create a font object first.
Definition PdfFont.h:45
A PDF string context to iteratively scan a string and collect both CID and unicode codepoints.
Definition PdfEncoding.h:24
A string that can be written to a PDF document.
Definition PdfString.h:24
Convenient type for char array storage and/or buffer with std::string compatibility.
Definition basetypes.h:38
SPDX-FileCopyrightText: (C) 2022 Francesco Pretto ceztko@gmail.com SPDX-License-Identifier: LGPL-2....
Definition basetypes.h:16
std::shared_ptr< const PdfEncodingMap > PdfToUnicodeMapConstPtr
Convenience alias for a const /ToUnicode CMap entry shared ptr.
Definition PdfEncodingMap.h:353
@ Create
Create a new file or truncate existing one for writing/reading.
std::shared_ptr< const PdfEncodingMap > PdfEncodingMapConstPtr
Convenience typedef for a const /Encoding map entry shared ptr.
Definition PdfEncodingMap.h:345
Represent a CID (Character ID) with full code unit information.
Definition PdfEncodingCommon.h:52
A character code unit.
Definition PdfEncodingCommon.h:20