| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | |
| 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_FPDF_FONT_CPDF_CIDFONT_H_ | |
| 8 #define CORE_FPDFAPI_FPDF_FONT_CPDF_CIDFONT_H_ | |
| 9 | |
| 10 #include <memory> | |
| 11 | |
| 12 #include "core/fpdfapi/fpdf_font/cpdf_font.h" | |
| 13 #include "core/fxcrt/fx_string.h" | |
| 14 #include "core/fxcrt/fx_system.h" | |
| 15 | |
| 16 enum CIDSet { | |
| 17 CIDSET_UNKNOWN, | |
| 18 CIDSET_GB1, | |
| 19 CIDSET_CNS1, | |
| 20 CIDSET_JAPAN1, | |
| 21 CIDSET_KOREA1, | |
| 22 CIDSET_UNICODE, | |
| 23 CIDSET_NUM_SETS | |
| 24 }; | |
| 25 | |
| 26 class CFX_CTTGSUBTable; | |
| 27 class CPDF_Array; | |
| 28 class CPDF_CID2UnicodeMap; | |
| 29 class CPDF_CMap; | |
| 30 class CPDF_StreamAcc; | |
| 31 | |
| 32 class CPDF_CIDFont : public CPDF_Font { | |
| 33 public: | |
| 34 CPDF_CIDFont(); | |
| 35 ~CPDF_CIDFont() override; | |
| 36 | |
| 37 static FX_FLOAT CIDTransformToFloat(uint8_t ch); | |
| 38 | |
| 39 // CPDF_Font: | |
| 40 bool IsCIDFont() const override; | |
| 41 const CPDF_CIDFont* AsCIDFont() const override; | |
| 42 CPDF_CIDFont* AsCIDFont() override; | |
| 43 int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) override; | |
| 44 int GetCharWidthF(uint32_t charcode) override; | |
| 45 FX_RECT GetCharBBox(uint32_t charcode) override; | |
| 46 uint32_t GetNextChar(const FX_CHAR* pString, | |
| 47 int nStrLen, | |
| 48 int& offset) const override; | |
| 49 int CountChar(const FX_CHAR* pString, int size) const override; | |
| 50 int AppendChar(FX_CHAR* str, uint32_t charcode) const override; | |
| 51 int GetCharSize(uint32_t charcode) const override; | |
| 52 bool IsVertWriting() const override; | |
| 53 bool IsUnicodeCompatible() const override; | |
| 54 bool Load() override; | |
| 55 CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override; | |
| 56 uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const override; | |
| 57 | |
| 58 uint16_t CIDFromCharCode(uint32_t charcode) const; | |
| 59 const uint8_t* GetCIDTransform(uint16_t CID) const; | |
| 60 short GetVertWidth(uint16_t CID) const; | |
| 61 void GetVertOrigin(uint16_t CID, short& vx, short& vy) const; | |
| 62 | |
| 63 protected: | |
| 64 void LoadGB2312(); | |
| 65 int GetGlyphIndex(uint32_t unicodeb, bool* pVertGlyph); | |
| 66 int GetVerticalGlyph(int index, bool* pVertGlyph); | |
| 67 void LoadMetricsArray(CPDF_Array* pArray, | |
| 68 CFX_ArrayTemplate<uint32_t>& result, | |
| 69 int nElements); | |
| 70 void LoadSubstFont(); | |
| 71 FX_WCHAR GetUnicodeFromCharCode(uint32_t charcode) const; | |
| 72 | |
| 73 CPDF_CMap* m_pCMap; | |
| 74 std::unique_ptr<CPDF_CMap> m_pAllocatedCMap; | |
| 75 CPDF_CID2UnicodeMap* m_pCID2UnicodeMap; | |
| 76 CIDSet m_Charset; | |
| 77 bool m_bType1; | |
| 78 bool m_bCIDIsGID; | |
| 79 uint16_t m_DefaultWidth; | |
| 80 std::unique_ptr<CPDF_StreamAcc> m_pStreamAcc; | |
| 81 bool m_bAnsiWidthsFixed; | |
| 82 FX_RECT m_CharBBox[256]; | |
| 83 CFX_ArrayTemplate<uint32_t> m_WidthList; | |
| 84 short m_DefaultVY; | |
| 85 short m_DefaultW1; | |
| 86 CFX_ArrayTemplate<uint32_t> m_VertMetrics; | |
| 87 bool m_bAdobeCourierStd; | |
| 88 std::unique_ptr<CFX_CTTGSUBTable> m_pTTGSUBTable; | |
| 89 }; | |
| 90 | |
| 91 #endif // CORE_FPDFAPI_FPDF_FONT_CPDF_CIDFONT_H_ | |
| OLD | NEW |