OLD | NEW |
---|---|
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ | 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ |
8 #define CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ | 8 #define CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ |
9 | 9 |
10 #include "../fxcrt/fx_system.h" | 10 #include "../fxcrt/fx_system.h" |
(...skipping 20 matching lines...) Expand all Loading... | |
31 class CPDF_Pattern; | 31 class CPDF_Pattern; |
32 class CPDF_RenderContext; | 32 class CPDF_RenderContext; |
33 class CPDF_ShadingPattern; | 33 class CPDF_ShadingPattern; |
34 class CPDF_TilingPattern; | 34 class CPDF_TilingPattern; |
35 class CPDF_ToUnicodeMap; | 35 class CPDF_ToUnicodeMap; |
36 class CPDF_TrueTypeFont; | 36 class CPDF_TrueTypeFont; |
37 class CPDF_Type1Font; | 37 class CPDF_Type1Font; |
38 class CPDF_Type3Font; | 38 class CPDF_Type3Font; |
39 typedef struct FT_FaceRec_* FXFT_Face; | 39 typedef struct FT_FaceRec_* FXFT_Face; |
40 | 40 |
41 FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name); | |
42 CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode); | |
43 const FX_CHAR* FCS_GetAltStr(FX_WCHAR unicode); | |
44 const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode) ; | |
Lei Zhang
2015/07/21 23:08:05
80 chars, also line 48
Tom Sepez
2015/07/21 23:41:31
Done.
| |
45 FX_WCHAR FT_UnicodeFromCharCode(int encoding, FX_DWORD charcode); | |
46 FX_DWORD FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode); | |
47 const FX_WORD* PDF_UnicodesForPredefinedCharSet(int encoding); | |
48 const FX_CHAR* GetAdobeCharName(int iBaseEncoding, const CFX_ByteString* pCharNa mes, int charcode); | |
49 | |
41 template <class T> class CPDF_CountedObject | 50 template <class T> class CPDF_CountedObject |
42 { | 51 { |
43 public: | 52 public: |
44 explicit CPDF_CountedObject(T* ptr) : m_nCount(1), m_pObj(ptr) { } | 53 explicit CPDF_CountedObject(T* ptr) : m_nCount(1), m_pObj(ptr) { } |
45 void reset(T* ptr) { // CAUTION: tosses prior ref counts. | 54 void reset(T* ptr) { // CAUTION: tosses prior ref counts. |
46 m_nCount = 1; | 55 m_nCount = 1; |
47 m_pObj = ptr; | 56 m_pObj = ptr; |
48 } | 57 } |
49 void clear() { // Now you're all weak ptrs ... | 58 void clear() { // Now you're all weak ptrs ... |
50 delete m_pObj; | 59 delete m_pObj; |
51 m_pObj = nullptr; | 60 m_pObj = nullptr; |
52 } | 61 } |
53 T* get() const { return m_pObj; } | 62 T* get() const { return m_pObj; } |
54 T* AddRef() { FXSYS_assert(m_pObj); ++m_nCount; return m_pObj; } | 63 T* AddRef() { FXSYS_assert(m_pObj); ++m_nCount; return m_pObj; } |
55 void RemoveRef() { if (m_nCount) --m_nCount; } | 64 void RemoveRef() { if (m_nCount) --m_nCount; } |
56 size_t use_count() const { return m_nCount; } | 65 size_t use_count() const { return m_nCount; } |
57 | 66 |
58 protected: | 67 protected: |
59 size_t m_nCount; | 68 size_t m_nCount; |
60 T* m_pObj; | 69 T* m_pObj; |
61 }; | 70 }; |
62 using CPDF_CountedColorSpace = CPDF_CountedObject<CPDF_ColorSpace>; | 71 using CPDF_CountedColorSpace = CPDF_CountedObject<CPDF_ColorSpace>; |
63 using CPDF_CountedPattern = CPDF_CountedObject<CPDF_Pattern>; | 72 using CPDF_CountedPattern = CPDF_CountedObject<CPDF_Pattern>; |
64 | |
65 #define PDFFONT_TYPE1 1 | 73 #define PDFFONT_TYPE1 1 |
66 #define PDFFONT_TRUETYPE 2 | 74 #define PDFFONT_TRUETYPE 2 |
67 #define PDFFONT_TYPE3 3 | 75 #define PDFFONT_TYPE3 3 |
68 #define PDFFONT_CIDFONT 4 | 76 #define PDFFONT_CIDFONT 4 |
69 #define PDFFONT_FIXEDPITCH 1 | 77 #define PDFFONT_FIXEDPITCH 1 |
70 #define PDFFONT_SERIF 2 | 78 #define PDFFONT_SERIF 2 |
71 #define PDFFONT_SYMBOLIC 4 | 79 #define PDFFONT_SYMBOLIC 4 |
72 #define PDFFONT_SCRIPT 8 | 80 #define PDFFONT_SCRIPT 8 |
73 #define PDFFONT_NONSYMBOLIC 32 | 81 #define PDFFONT_NONSYMBOLIC 32 |
74 #define PDFFONT_ITALIC 64 | 82 #define PDFFONT_ITALIC 64 |
75 #define PDFFONT_ALLCAP 0x10000 | 83 #define PDFFONT_ALLCAP 0x10000 |
76 #define PDFFONT_SMALLCAP 0x20000 | 84 #define PDFFONT_SMALLCAP 0x20000 |
77 #define PDFFONT_FORCEBOLD 0x40000 | 85 #define PDFFONT_FORCEBOLD 0x40000 |
78 #define PDFFONT_USEEXTERNATTR 0x80000 | 86 #define PDFFONT_USEEXTERNATTR 0x80000 |
79 FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name); | |
80 CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode); | |
81 class CPDF_Font | 87 class CPDF_Font |
82 { | 88 { |
83 public: | 89 public: |
84 static CPDF_Font* CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary * pFontDict); | 90 static CPDF_Font* CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary * pFontDict); |
85 static CPDF_Font* GetStockFont(CPDF_Document* pDoc, const CFX_Byte StringC& fontname); | 91 static CPDF_Font* GetStockFont(CPDF_Document* pDoc, const CFX_Byte StringC& fontname); |
86 | 92 |
87 virtual ~CPDF_Font(); | 93 virtual ~CPDF_Font(); |
88 | 94 |
89 bool IsFontType(int fonttype) const { return fonttype == m_FontType; } | 95 bool IsFontType(int fonttype) const { return fonttype == m_FontType; } |
90 int GetFontType() const { return m_FontType; } | 96 int GetFontType() const { return m_FontType; } |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
942 | 948 |
943 FX_BOOL m_bInterpolate; | 949 FX_BOOL m_bInterpolate; |
944 | 950 |
945 CPDF_Document* m_pDocument; | 951 CPDF_Document* m_pDocument; |
946 | 952 |
947 CPDF_Dictionary* m_pOC; | 953 CPDF_Dictionary* m_pOC; |
948 CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size); | 954 CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size); |
949 }; | 955 }; |
950 | 956 |
951 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ | 957 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ |
OLD | NEW |