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 <memory>
13#include <vector>
14
15#include "core/fpdfapi/font/cpdf_font.h"
16#include "core/fxcrt/fx_coordinates.h"
17#include "core/fxcrt/fx_string.h"
18#include "core/fxcrt/retain_ptr.h"
19#include "core/fxcrt/unowned_ptr.h"
20
30
33class CPDF_CMap;
34class CPDF_StreamAcc;
35
36class CPDF_CIDFont final : public CPDF_Font {
37 public:
39 ~CPDF_CIDFont() override;
40
41 static float CIDTransformToFloat(uint8_t ch);
42
43 // CPDF_Font:
44 bool IsCIDFont() const override;
45 const CPDF_CIDFont* AsCIDFont() const override;
46 CPDF_CIDFont* AsCIDFont() override;
47 int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) override;
48 int GetCharWidthF(uint32_t charcode) override;
49 FX_RECT GetCharBBox(uint32_t charcode) override;
50 uint32_t GetNextChar(ByteStringView pString, size_t* pOffset) const override;
51 size_t CountChar(ByteStringView pString) const override;
52 int AppendChar(char* str, uint32_t charcode) const override;
53 bool IsVertWriting() const override;
54 bool IsUnicodeCompatible() const override;
55 bool Load() override;
56 WideString UnicodeFromCharCode(uint32_t charcode) const override;
57 uint32_t CharCodeFromUnicode(wchar_t Unicode) const override;
58
59 uint16_t CIDFromCharCode(uint32_t charcode) const;
60 const uint8_t* GetCIDTransform(uint16_t cid) const;
61 int16_t GetVertWidth(uint16_t cid) const;
62 CFX_Point16 GetVertOrigin(uint16_t cid) const;
63 int GetCharSize(uint32_t charcode) const;
64
65 private:
66 enum class CIDFontType : bool {
67 kType1, // CIDFontType0
68 kTrueType // CIDFontType2
69 };
70
71 CPDF_CIDFont(CPDF_Document* pDocument, RetainPtr<CPDF_Dictionary> pFontDict);
72
73 void LoadGB2312();
74 int GetGlyphIndex(uint32_t unicodeb, bool* pVertGlyph);
75 int GetVerticalGlyph(int index, bool* pVertGlyph);
76 void LoadSubstFont();
77 wchar_t GetUnicodeFromCharCode(uint32_t charcode) const;
78
79 RetainPtr<const CPDF_CMap> m_pCMap;
80 UnownedPtr<const CPDF_CID2UnicodeMap> m_pCID2UnicodeMap;
81 RetainPtr<CPDF_StreamAcc> m_pStreamAcc;
82 std::unique_ptr<CFX_CTTGSUBTable> m_pTTGSUBTable;
83 CIDFontType m_FontType = CIDFontType::kTrueType;
84 bool m_bCIDIsGID = false;
85 bool m_bAnsiWidthsFixed = false;
86 bool m_bAdobeCourierStd = false;
87 CIDSet m_Charset = CIDSET_UNKNOWN;
88 int16_t m_DefaultWidth = 1000;
89 int16_t m_DefaultVY = 880;
90 int16_t m_DefaultW1 = -1000;
91 std::vector<int> m_WidthList;
92 std::vector<int> m_VertMetrics;
93 FX_RECT m_CharBBox[256];
94};
95
96#endif // CORE_FPDFAPI_FONT_CPDF_CIDFONT_H_
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
const uint8_t * GetCIDTransform(uint16_t cid) const
bool IsUnicodeCompatible() const override
int AppendChar(char *str, uint32_t charcode) 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
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)
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
CIDSet
@ CIDSET_KOREA1
@ CIDSET_UNICODE
@ CIDSET_JAPAN1
@ CIDSET_UNKNOWN
@ CIDSET_GB1
@ CIDSET_NUM_SETS
@ CIDSET_CNS1
#define CONSTRUCT_VIA_MAKE_RETAIN
Definition retain_ptr.h:224