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, |
| 45 uint8_t charcode); |
| 46 |
| 47 FX_WCHAR FT_UnicodeFromCharCode(int encoding, FX_DWORD charcode); |
| 48 FX_DWORD FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode); |
| 49 const FX_WORD* PDF_UnicodesForPredefinedCharSet(int encoding); |
| 50 const FX_CHAR* GetAdobeCharName(int iBaseEncoding, |
| 51 const CFX_ByteString* pCharNames, |
| 52 int charcode); |
| 53 |
41 template <class T> class CPDF_CountedObject | 54 template <class T> class CPDF_CountedObject |
42 { | 55 { |
43 public: | 56 public: |
44 explicit CPDF_CountedObject(T* ptr) : m_nCount(1), m_pObj(ptr) { } | 57 explicit CPDF_CountedObject(T* ptr) : m_nCount(1), m_pObj(ptr) { } |
45 void reset(T* ptr) { // CAUTION: tosses prior ref counts. | 58 void reset(T* ptr) { // CAUTION: tosses prior ref counts. |
46 m_nCount = 1; | 59 m_nCount = 1; |
47 m_pObj = ptr; | 60 m_pObj = ptr; |
48 } | 61 } |
49 void clear() { // Now you're all weak ptrs ... | 62 void clear() { // Now you're all weak ptrs ... |
50 delete m_pObj; | 63 delete m_pObj; |
51 m_pObj = nullptr; | 64 m_pObj = nullptr; |
52 } | 65 } |
53 T* get() const { return m_pObj; } | 66 T* get() const { return m_pObj; } |
54 T* AddRef() { FXSYS_assert(m_pObj); ++m_nCount; return m_pObj; } | 67 T* AddRef() { FXSYS_assert(m_pObj); ++m_nCount; return m_pObj; } |
55 void RemoveRef() { if (m_nCount) --m_nCount; } | 68 void RemoveRef() { if (m_nCount) --m_nCount; } |
56 size_t use_count() const { return m_nCount; } | 69 size_t use_count() const { return m_nCount; } |
57 | 70 |
58 protected: | 71 protected: |
59 size_t m_nCount; | 72 size_t m_nCount; |
60 T* m_pObj; | 73 T* m_pObj; |
61 }; | 74 }; |
62 using CPDF_CountedColorSpace = CPDF_CountedObject<CPDF_ColorSpace>; | 75 using CPDF_CountedColorSpace = CPDF_CountedObject<CPDF_ColorSpace>; |
63 using CPDF_CountedPattern = CPDF_CountedObject<CPDF_Pattern>; | 76 using CPDF_CountedPattern = CPDF_CountedObject<CPDF_Pattern>; |
64 | |
65 #define PDFFONT_TYPE1 1 | 77 #define PDFFONT_TYPE1 1 |
66 #define PDFFONT_TRUETYPE 2 | 78 #define PDFFONT_TRUETYPE 2 |
67 #define PDFFONT_TYPE3 3 | 79 #define PDFFONT_TYPE3 3 |
68 #define PDFFONT_CIDFONT 4 | 80 #define PDFFONT_CIDFONT 4 |
69 #define PDFFONT_FIXEDPITCH 1 | 81 #define PDFFONT_FIXEDPITCH 1 |
70 #define PDFFONT_SERIF 2 | 82 #define PDFFONT_SERIF 2 |
71 #define PDFFONT_SYMBOLIC 4 | 83 #define PDFFONT_SYMBOLIC 4 |
72 #define PDFFONT_SCRIPT 8 | 84 #define PDFFONT_SCRIPT 8 |
73 #define PDFFONT_NONSYMBOLIC 32 | 85 #define PDFFONT_NONSYMBOLIC 32 |
74 #define PDFFONT_ITALIC 64 | 86 #define PDFFONT_ITALIC 64 |
75 #define PDFFONT_ALLCAP 0x10000 | 87 #define PDFFONT_ALLCAP 0x10000 |
76 #define PDFFONT_SMALLCAP 0x20000 | 88 #define PDFFONT_SMALLCAP 0x20000 |
77 #define PDFFONT_FORCEBOLD 0x40000 | 89 #define PDFFONT_FORCEBOLD 0x40000 |
78 #define PDFFONT_USEEXTERNATTR 0x80000 | 90 #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 | 91 class CPDF_Font |
82 { | 92 { |
83 public: | 93 public: |
84 static CPDF_Font* CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary
* pFontDict); | 94 static CPDF_Font* CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary
* pFontDict); |
85 static CPDF_Font* GetStockFont(CPDF_Document* pDoc, const CFX_Byte
StringC& fontname); | 95 static CPDF_Font* GetStockFont(CPDF_Document* pDoc, const CFX_Byte
StringC& fontname); |
86 | 96 |
87 virtual ~CPDF_Font(); | 97 virtual ~CPDF_Font(); |
88 | 98 |
89 bool IsFontType(int fonttype) const { return fonttype == m_FontType; } | 99 bool IsFontType(int fonttype) const { return fonttype == m_FontType; } |
90 int GetFontType() const { return m_FontType; } | 100 int GetFontType() const { return m_FontType; } |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
942 | 952 |
943 FX_BOOL m_bInterpolate; | 953 FX_BOOL m_bInterpolate; |
944 | 954 |
945 CPDF_Document* m_pDocument; | 955 CPDF_Document* m_pDocument; |
946 | 956 |
947 CPDF_Dictionary* m_pOC; | 957 CPDF_Dictionary* m_pOC; |
948 CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size); | 958 CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size); |
949 }; | 959 }; |
950 | 960 |
951 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ | 961 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ |
OLD | NEW |