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 <map> | 10 #include <map> |
(...skipping 29 matching lines...) Expand all Loading... |
40 typedef struct FT_FaceRec_* FXFT_Face; | 40 typedef struct FT_FaceRec_* FXFT_Face; |
41 | 41 |
42 FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name); | 42 FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name); |
43 CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode); | 43 CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode); |
44 const FX_CHAR* FCS_GetAltStr(FX_WCHAR unicode); | 44 const FX_CHAR* FCS_GetAltStr(FX_WCHAR unicode); |
45 const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, | 45 const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, |
46 uint8_t charcode); | 46 uint8_t charcode); |
47 | 47 |
48 FX_WCHAR FT_UnicodeFromCharCode(int encoding, FX_DWORD charcode); | 48 FX_WCHAR FT_UnicodeFromCharCode(int encoding, FX_DWORD charcode); |
49 FX_DWORD FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode); | 49 FX_DWORD FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode); |
50 const FX_WORD* PDF_UnicodesForPredefinedCharSet(int encoding); | 50 const uint16_t* PDF_UnicodesForPredefinedCharSet(int encoding); |
51 const FX_CHAR* GetAdobeCharName(int iBaseEncoding, | 51 const FX_CHAR* GetAdobeCharName(int iBaseEncoding, |
52 const CFX_ByteString* pCharNames, | 52 const CFX_ByteString* pCharNames, |
53 int charcode); | 53 int charcode); |
54 | 54 |
55 template <class T> | 55 template <class T> |
56 class CPDF_CountedObject { | 56 class CPDF_CountedObject { |
57 public: | 57 public: |
58 explicit CPDF_CountedObject(T* ptr) : m_nCount(1), m_pObj(ptr) {} | 58 explicit CPDF_CountedObject(T* ptr) : m_nCount(1), m_pObj(ptr) {} |
59 void reset(T* ptr) { // CAUTION: tosses prior ref counts. | 59 void reset(T* ptr) { // CAUTION: tosses prior ref counts. |
60 m_nCount = 1; | 60 m_nCount = 1; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 protected: | 237 protected: |
238 virtual void LoadGlyphMap() = 0; | 238 virtual void LoadGlyphMap() = 0; |
239 | 239 |
240 FX_BOOL LoadCommon(); | 240 FX_BOOL LoadCommon(); |
241 void LoadSubstFont(); | 241 void LoadSubstFont(); |
242 void LoadFaceMetrics(); | 242 void LoadFaceMetrics(); |
243 void LoadCharMetrics(int charcode); | 243 void LoadCharMetrics(int charcode); |
244 | 244 |
245 CPDF_FontEncoding m_Encoding; | 245 CPDF_FontEncoding m_Encoding; |
246 FX_WORD m_GlyphIndex[256]; | 246 uint16_t m_GlyphIndex[256]; |
247 FX_WORD m_ExtGID[256]; | 247 uint16_t m_ExtGID[256]; |
248 CFX_ByteString* m_pCharNames; | 248 CFX_ByteString* m_pCharNames; |
249 int m_BaseEncoding; | 249 int m_BaseEncoding; |
250 FX_WORD m_CharWidth[256]; | 250 uint16_t m_CharWidth[256]; |
251 FX_SMALL_RECT m_CharBBox[256]; | 251 FX_SMALL_RECT m_CharBBox[256]; |
252 FX_BOOL m_bUseFontWidth; | 252 FX_BOOL m_bUseFontWidth; |
253 }; | 253 }; |
254 | 254 |
255 class CPDF_Type1Font : public CPDF_SimpleFont { | 255 class CPDF_Type1Font : public CPDF_SimpleFont { |
256 public: | 256 public: |
257 CPDF_Type1Font(); | 257 CPDF_Type1Font(); |
258 | 258 |
259 // CPDF_Font: | 259 // CPDF_Font: |
260 bool IsType1Font() const override; | 260 bool IsType1Font() const override; |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 int CountChar(const FX_CHAR* pString, int size) const override; | 374 int CountChar(const FX_CHAR* pString, int size) const override; |
375 int AppendChar(FX_CHAR* str, FX_DWORD charcode) const override; | 375 int AppendChar(FX_CHAR* str, FX_DWORD charcode) const override; |
376 int GetCharSize(FX_DWORD charcode) const override; | 376 int GetCharSize(FX_DWORD charcode) const override; |
377 FX_BOOL IsVertWriting() const override; | 377 FX_BOOL IsVertWriting() const override; |
378 FX_BOOL IsUnicodeCompatible() const override; | 378 FX_BOOL IsUnicodeCompatible() const override; |
379 FX_BOOL Load() override; | 379 FX_BOOL Load() override; |
380 CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const override; | 380 CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const override; |
381 FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const override; | 381 FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const override; |
382 | 382 |
383 FX_BOOL LoadGB2312(); | 383 FX_BOOL LoadGB2312(); |
384 FX_WORD CIDFromCharCode(FX_DWORD charcode) const; | 384 uint16_t CIDFromCharCode(FX_DWORD charcode) const; |
385 const uint8_t* GetCIDTransform(FX_WORD CID) const; | 385 const uint8_t* GetCIDTransform(uint16_t CID) const; |
386 short GetVertWidth(FX_WORD CID) const; | 386 short GetVertWidth(uint16_t CID) const; |
387 void GetVertOrigin(FX_WORD CID, short& vx, short& vy) const; | 387 void GetVertOrigin(uint16_t CID, short& vx, short& vy) const; |
388 virtual FX_BOOL IsFontStyleFromCharCode(FX_DWORD charcode) const; | 388 virtual FX_BOOL IsFontStyleFromCharCode(FX_DWORD charcode) const; |
389 | 389 |
390 protected: | 390 protected: |
391 int GetGlyphIndex(FX_DWORD unicodeb, FX_BOOL* pVertGlyph); | 391 int GetGlyphIndex(FX_DWORD unicodeb, FX_BOOL* pVertGlyph); |
392 void LoadMetricsArray(CPDF_Array* pArray, | 392 void LoadMetricsArray(CPDF_Array* pArray, |
393 CFX_DWordArray& result, | 393 CFX_DWordArray& result, |
394 int nElements); | 394 int nElements); |
395 void LoadSubstFont(); | 395 void LoadSubstFont(); |
396 FX_WCHAR GetUnicodeFromCharCode(FX_DWORD charcode) const; | 396 FX_WCHAR GetUnicodeFromCharCode(FX_DWORD charcode) const; |
397 | 397 |
398 CPDF_CMap* m_pCMap; | 398 CPDF_CMap* m_pCMap; |
399 CPDF_CMap* m_pAllocatedCMap; | 399 CPDF_CMap* m_pAllocatedCMap; |
400 CPDF_CID2UnicodeMap* m_pCID2UnicodeMap; | 400 CPDF_CID2UnicodeMap* m_pCID2UnicodeMap; |
401 CIDSet m_Charset; | 401 CIDSet m_Charset; |
402 FX_BOOL m_bType1; | 402 FX_BOOL m_bType1; |
403 CPDF_StreamAcc* m_pCIDToGIDMap; | 403 CPDF_StreamAcc* m_pCIDToGIDMap; |
404 FX_BOOL m_bCIDIsGID; | 404 FX_BOOL m_bCIDIsGID; |
405 FX_WORD m_DefaultWidth; | 405 uint16_t m_DefaultWidth; |
406 FX_WORD* m_pAnsiWidths; | 406 uint16_t* m_pAnsiWidths; |
407 FX_SMALL_RECT m_CharBBox[256]; | 407 FX_SMALL_RECT m_CharBBox[256]; |
408 CFX_DWordArray m_WidthList; | 408 CFX_DWordArray m_WidthList; |
409 short m_DefaultVY; | 409 short m_DefaultVY; |
410 short m_DefaultW1; | 410 short m_DefaultW1; |
411 CFX_DWordArray m_VertMetrics; | 411 CFX_DWordArray m_VertMetrics; |
412 FX_BOOL m_bAdobeCourierStd; | 412 FX_BOOL m_bAdobeCourierStd; |
413 CFX_CTTGSUBTable* m_pTTGSUBTable; | 413 CFX_CTTGSUBTable* m_pTTGSUBTable; |
414 }; | 414 }; |
415 | 415 |
416 #define PDFCS_DEVICEGRAY 1 | 416 #define PDFCS_DEVICEGRAY 1 |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 | 765 |
766 FX_BOOL m_bInterpolate; | 766 FX_BOOL m_bInterpolate; |
767 | 767 |
768 CPDF_Document* m_pDocument; | 768 CPDF_Document* m_pDocument; |
769 | 769 |
770 CPDF_Dictionary* m_pOC; | 770 CPDF_Dictionary* m_pOC; |
771 CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size); | 771 CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size); |
772 }; | 772 }; |
773 | 773 |
774 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ | 774 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ |
OLD | NEW |