Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cpdf_fontglobals.h
Go to the documentation of this file.
1// Copyright 2017 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#ifndef CORE_FPDFAPI_FONT_CPDF_FONTGLOBALS_H_
8#define CORE_FPDFAPI_FONT_CPDF_FONTGLOBALS_H_
9
10#include <array>
11#include <functional>
12#include <map>
13#include <memory>
14
15#include "core/fpdfapi/cmaps/fpdf_cmaps.h"
16#include "core/fpdfapi/font/cpdf_cidfont.h"
17#include "core/fxcrt/raw_span.h"
18#include "core/fxcrt/retain_ptr.h"
19#include "core/fxcrt/span.h"
20#include "core/fxge/cfx_fontmapper.h"
21
23class CPDF_Font;
24
26 public:
27 // Per-process singleton which must be managed by callers.
28 static void Create();
29 static void Destroy();
31
32 // Caller must load the maps before using font globals.
33 void LoadEmbeddedMaps();
34
35 void Clear(CPDF_Document* pDoc);
38 void Set(CPDF_Document* pDoc,
40 RetainPtr<CPDF_Font> pFont);
41
42 void SetEmbeddedCharset(CIDSet idx, pdfium::span<const fxcmap::CMap> map) {
43 m_EmbeddedCharsets[idx] = map;
44 }
46 return m_EmbeddedCharsets[idx];
47 }
48 void SetEmbeddedToUnicode(CIDSet idx, pdfium::span<const uint16_t> map) {
49 m_EmbeddedToUnicodes[idx] = map;
50 }
52 return m_EmbeddedToUnicodes[idx];
53 }
54
55 RetainPtr<const CPDF_CMap> GetPredefinedCMap(const ByteString& name);
57
58 private:
59 CPDF_FontGlobals();
60 ~CPDF_FontGlobals();
61
62 void LoadEmbeddedGB1CMaps();
63 void LoadEmbeddedCNS1CMaps();
64 void LoadEmbeddedJapan1CMaps();
65 void LoadEmbeddedKorea1CMaps();
66
67 std::map<ByteString, RetainPtr<const CPDF_CMap>> m_CMaps;
68 std::array<std::unique_ptr<CPDF_CID2UnicodeMap>, CIDSET_NUM_SETS>
69 m_CID2UnicodeMaps;
76 std::less<>>
78};
79
80#endif // CORE_FPDFAPI_FONT_CPDF_FONTGLOBALS_H_
fxcrt::ByteString ByteString
Definition bytestring.h:180
wchar_t UnicodeFromCID(uint16_t cid) const
CPDF_CID2UnicodeMap(CIDSet charset)
~CPDF_CIDFont() override
size_t CountChar(ByteStringView pString) const override
uint32_t GetNextChar(ByteStringView pString, size_t *pOffset) const override
bool IsCIDFont() const override
bool IsUnicodeCompatible() const override
CFX_Point16 GetVertOrigin(uint16_t cid) const
int GetCharWidthF(uint32_t charcode) override
const CPDF_CIDFont * AsCIDFont() const override
uint16_t CIDFromCharCode(uint32_t charcode) const
bool Load() override
const CIDTransform * GetCIDTransform(uint16_t cid) const
int GlyphFromCharCode(uint32_t charcode, bool *pVertGlyph) override
int16_t GetVertWidth(uint16_t cid) const
FX_RECT GetCharBBox(uint32_t charcode) override
static float CIDTransformToFloat(uint8_t ch)
void AppendChar(ByteString *str, uint32_t charcode) const override
bool IsVertWriting() const override
uint32_t CharCodeFromUnicode(wchar_t Unicode) const override
int GetCharSize(uint32_t charcode) const
WideString UnicodeFromCharCode(uint32_t charcode) const override
CPDF_CIDFont * AsCIDFont() override
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
void Set(CPDF_Document *pDoc, CFX_FontMapper::StandardFont index, RetainPtr< CPDF_Font > pFont)
static void Destroy()
RetainPtr< CPDF_Font > Find(CPDF_Document *pDoc, CFX_FontMapper::StandardFont index)
static CPDF_FontGlobals * GetInstance()
pdfium::span< const fxcmap::CMap > GetEmbeddedCharset(CIDSet idx) const
pdfium::span< const uint16_t > GetEmbeddedToUnicode(CIDSet idx)
RetainPtr< const CPDF_CMap > GetPredefinedCMap(const ByteString &name)
void Clear(CPDF_Document *pDoc)
void SetEmbeddedCharset(CIDSet idx, pdfium::span< const fxcmap::CMap > map)
CPDF_CID2UnicodeMap * GetCID2UnicodeMap(CIDSet charset)
void SetEmbeddedToUnicode(CIDSet idx, pdfium::span< const uint16_t > map)
CIDSet
@ CIDSET_KOREA1
@ CIDSET_UNICODE
@ CIDSET_JAPAN1
@ CIDSET_UNKNOWN
@ CIDSET_GB1
@ CIDSET_NUM_SETS
@ CIDSET_CNS1
CFX_PTemplate< int16_t > CFX_Point16
#define CONSTRUCT_VIA_MAKE_RETAIN
Definition retain_ptr.h:222
fxcrt::ByteStringView ByteStringView
uint16_t cid
fxcrt::WideString WideString
Definition widestring.h:207