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_cidfont.h
Go to the documentation of this file.
1// Copyright 2016 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_CIDFONT_H_
8#define CORE_FPDFAPI_FONT_CPDF_CIDFONT_H_
9
10#include <stdint.h>
11
12#include <array>
13#include <memory>
14#include <vector>
15
16#include "core/fpdfapi/font/cpdf_font.h"
17#include "core/fxcrt/fx_coordinates.h"
18#include "core/fxcrt/fx_string.h"
19#include "core/fxcrt/retain_ptr.h"
20#include "core/fxcrt/unowned_ptr.h"
21
31
33 uint16_t cid;
34 uint8_t a;
35 uint8_t b;
36 uint8_t c;
37 uint8_t d;
38 uint8_t e;
39 uint8_t f;
40};
41
44class CPDF_CMap;
45class CPDF_StreamAcc;
46
47class CPDF_CIDFont final : public CPDF_Font {
48 public:
50 ~CPDF_CIDFont() override;
51
52 static float CIDTransformToFloat(uint8_t ch);
53
54 // CPDF_Font:
55 bool IsCIDFont() const override;
56 const CPDF_CIDFont* AsCIDFont() const override;
57 CPDF_CIDFont* AsCIDFont() override;
58 int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) override;
59 int GetCharWidthF(uint32_t charcode) override;
60 FX_RECT GetCharBBox(uint32_t charcode) override;
61 uint32_t GetNextChar(ByteStringView pString, size_t* pOffset) const override;
62 size_t CountChar(ByteStringView pString) const override;
63 void AppendChar(ByteString* str, uint32_t charcode) const override;
64 bool IsVertWriting() const override;
65 bool IsUnicodeCompatible() const override;
66 bool Load() override;
67 WideString UnicodeFromCharCode(uint32_t charcode) const override;
68 uint32_t CharCodeFromUnicode(wchar_t Unicode) const override;
69
70 uint16_t CIDFromCharCode(uint32_t charcode) const;
71 const CIDTransform* GetCIDTransform(uint16_t cid) const;
72 int16_t GetVertWidth(uint16_t cid) const;
73 CFX_Point16 GetVertOrigin(uint16_t cid) const;
74 int GetCharSize(uint32_t charcode) const;
75
76 private:
77 enum class CIDFontType : bool {
78 kType1, // CIDFontType0
79 kTrueType // CIDFontType2
80 };
81
82 CPDF_CIDFont(CPDF_Document* pDocument, RetainPtr<CPDF_Dictionary> pFontDict);
83
84 void LoadGB2312();
85 int GetGlyphIndex(uint32_t unicodeb, bool* pVertGlyph);
86 int GetVerticalGlyph(int index, bool* pVertGlyph);
87 void LoadSubstFont();
88 wchar_t GetUnicodeFromCharCode(uint32_t charcode) const;
89
90 RetainPtr<const CPDF_CMap> m_pCMap;
91 UnownedPtr<const CPDF_CID2UnicodeMap> m_pCID2UnicodeMap;
92 RetainPtr<CPDF_StreamAcc> m_pStreamAcc;
93 std::unique_ptr<CFX_CTTGSUBTable> m_pTTGSUBTable;
94 CIDFontType m_FontType = CIDFontType::kTrueType;
95 bool m_bCIDIsGID = false;
96 bool m_bAnsiWidthsFixed = false;
97 bool m_bAdobeCourierStd = false;
98 CIDSet m_Charset = CIDSET_UNKNOWN;
99 int16_t m_DefaultWidth = 1000;
100 int16_t m_DefaultVY = 880;
101 int16_t m_DefaultW1 = -1000;
102 std::vector<int> m_WidthList;
103 std::vector<int> m_VertMetrics;
104 std::array<FX_RECT, 256> m_CharBBox;
105};
106
107#endif // CORE_FPDFAPI_FONT_CPDF_CIDFONT_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
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