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