10#include "PdfEncodingMap.h"
13#include "PdfCIDToGIDMap.h"
32 bool IsEndOfString()
const;
40 std::string_view::iterator m_it;
41 std::string_view::iterator m_end;
43 PdfEncodingLimits m_limits;
94 static std::unique_ptr<PdfEncoding> CreateDynamicEncoding(
const std::shared_ptr<PdfCharCodeMap>&
cidMap,
111 charbuff ConvertToEncoded(
const std::string_view&
str)
const;
138 char32_t GetCodePoint(
unsigned charCode)
const;
159 bool HasCIDMapping()
const;
164 bool IsSimpleEncoding()
const;
168 bool HasParsedLimits()
const;
172 bool IsDynamicEncoding()
const;
177 unsigned GetId()
const {
return m_Id; }
188 const PdfEncodingLimits& GetLimits()
const;
190 bool HasValidToUnicodeMap()
const;
210 const PdfEncodingMap& GetEncodingMap()
const {
return *m_Encoding; }
212 PdfEncodingMapConstPtr GetEncodingMapPtr()
const {
return m_Encoding; }
217 PdfEncoding& operator=(
const PdfEncoding&) =
default;
221 void ExportToFont(PdfFont& font,
const PdfCIDSystemInfo& cidInfo)
const;
222 void ExportToFont(PdfFont& font)
const;
223 bool TryGetCIDId(
const PdfCharCode& codeUnit,
unsigned& cid)
const;
224 const PdfCIDToGIDMap* GetCIDToGIDMap()
const {
return m_CIDToGIDMap.get(); }
226 static unsigned GetNextId();
229 void exportToFont(PdfFont& font,
const PdfCIDSystemInfo* cidInfo)
const;
230 bool tryExportEncodingTo(PdfDictionary& dictionary,
bool wantCidMapping)
const;
231 bool tryConvertEncodedToUtf8(
const std::string_view& encoded, std::string& str)
const;
232 bool tryConvertEncodedToCIDs(
const std::string_view& encoded, std::vector<PdfCID>& cids)
const;
233 void writeCIDMapping(PdfObject& cmapObj,
const PdfFont& font,
const PdfCIDSystemInfo& info)
const;
234 void writeToUnicodeCMap(PdfObject& cmapObj,
const PdfFont& font)
const;
235 bool tryGetCharCode(PdfFont& font,
unsigned gid,
const unicodeview& codePoints, PdfCharCode& unit)
const;
239 bool m_IsObjectLoaded;
240 PdfEncodingLimits m_ParsedLimits;
244 PdfCIDToGIDMapConstPtr m_CIDToGIDMap;
A memory owning immutable block of code points, optimized for small segments as up to 3 elements can ...
Definition PdfEncodingCommon.h:141
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:32
A PdfEncoding is in PdfFont to transform a text string into a representation so that it can be displa...
Definition PdfEncoding.h:56
bool IsObjectLoaded() const
True if the encoding is constructed from object loaded information.
Definition PdfEncoding.h:182
unsigned GetId() const
Return an Id to be used in hashed containers.
Definition PdfEncoding.h:177
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:25
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:363
@ 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:355
Represent a CID (Character ID) with full code unit information.
Definition PdfEncodingCommon.h:52
A character code unit.
Definition PdfEncodingCommon.h:20