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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 void LoadGlyphMap() override {} | 407 void LoadGlyphMap() override {} |
408 | 408 |
409 int m_CharWidthL[256]; | 409 int m_CharWidthL[256]; |
410 CPDF_Dictionary* m_pCharProcs; | 410 CPDF_Dictionary* m_pCharProcs; |
411 CPDF_Dictionary* m_pPageResources; | 411 CPDF_Dictionary* m_pPageResources; |
412 CPDF_Dictionary* m_pFontResources; | 412 CPDF_Dictionary* m_pFontResources; |
413 CFX_MapPtrToPtr m_CacheMap; | 413 CFX_MapPtrToPtr m_CacheMap; |
414 CFX_MapPtrToPtr m_DeletedMap; | 414 CFX_MapPtrToPtr m_DeletedMap; |
415 }; | 415 }; |
416 | 416 |
417 #define CIDSET_UNKNOWN 0 | 417 enum CIDSet { |
418 #define CIDSET_GB1 1 | 418 CIDSET_UNKNOWN, |
419 #define CIDSET_CNS1 2 | 419 CIDSET_GB1, |
420 #define CIDSET_JAPAN1 3 | 420 CIDSET_CNS1, |
421 #define CIDSET_KOREA1 4 | 421 CIDSET_JAPAN1, |
422 #define CIDSET_UNICODE 5 | 422 CIDSET_KOREA1, |
423 #define NUMBER_OF_CIDSETS 6 | 423 CIDSET_UNICODE, |
| 424 CIDSET_NUM_SETS |
| 425 }; |
424 | 426 |
425 class CPDF_CIDFont : public CPDF_Font { | 427 class CPDF_CIDFont : public CPDF_Font { |
426 public: | 428 public: |
427 CPDF_CIDFont(); | 429 CPDF_CIDFont(); |
428 | 430 |
429 ~CPDF_CIDFont() override; | 431 ~CPDF_CIDFont() override; |
430 | 432 |
| 433 static FX_FLOAT CIDTransformToFloat(uint8_t ch); |
| 434 |
431 FX_BOOL LoadGB2312(); | 435 FX_BOOL LoadGB2312(); |
432 int GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph = NULL) override; | 436 int GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph = NULL) override; |
433 int GetCharWidthF(FX_DWORD charcode, int level = 0) override; | 437 int GetCharWidthF(FX_DWORD charcode, int level = 0) override; |
434 void GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level = 0) override; | 438 void GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level = 0) override; |
435 FX_WORD CIDFromCharCode(FX_DWORD charcode) const; | 439 FX_WORD CIDFromCharCode(FX_DWORD charcode) const; |
436 | 440 |
437 FX_BOOL IsTrueType() const { return !m_bType1; } | 441 FX_BOOL IsTrueType() const { return !m_bType1; } |
438 | 442 |
439 virtual FX_DWORD GetNextChar(const FX_CHAR* pString, | 443 virtual FX_DWORD GetNextChar(const FX_CHAR* pString, |
440 int nStrLen, | 444 int nStrLen, |
441 int& offset) const override; | 445 int& offset) const override; |
442 int CountChar(const FX_CHAR* pString, int size) const override; | 446 int CountChar(const FX_CHAR* pString, int size) const override; |
443 int AppendChar(FX_CHAR* str, FX_DWORD charcode) const override; | 447 int AppendChar(FX_CHAR* str, FX_DWORD charcode) const override; |
444 int GetCharSize(FX_DWORD charcode) const override; | 448 int GetCharSize(FX_DWORD charcode) const override; |
445 | |
446 int GetCharset() const { return m_Charset; } | |
447 | |
448 const uint8_t* GetCIDTransform(FX_WORD CID) const; | 449 const uint8_t* GetCIDTransform(FX_WORD CID) const; |
449 FX_BOOL IsVertWriting() const override; | 450 FX_BOOL IsVertWriting() const override; |
450 short GetVertWidth(FX_WORD CID) const; | 451 short GetVertWidth(FX_WORD CID) const; |
451 void GetVertOrigin(FX_WORD CID, short& vx, short& vy) const; | 452 void GetVertOrigin(FX_WORD CID, short& vx, short& vy) const; |
452 FX_BOOL IsUnicodeCompatible() const override; | 453 FX_BOOL IsUnicodeCompatible() const override; |
453 virtual FX_BOOL IsFontStyleFromCharCode(FX_DWORD charcode) const; | 454 virtual FX_BOOL IsFontStyleFromCharCode(FX_DWORD charcode) const; |
454 | 455 |
455 protected: | 456 protected: |
456 friend class CPDF_Font; | 457 friend class CPDF_Font; |
457 | 458 |
458 FX_BOOL _Load() override; | 459 FX_BOOL _Load() override; |
459 FX_WCHAR _UnicodeFromCharCode(FX_DWORD charcode) const override; | 460 FX_WCHAR _UnicodeFromCharCode(FX_DWORD charcode) const override; |
460 FX_DWORD _CharCodeFromUnicode(FX_WCHAR Unicode) const override; | 461 FX_DWORD _CharCodeFromUnicode(FX_WCHAR Unicode) const override; |
461 int GetGlyphIndex(FX_DWORD unicodeb, FX_BOOL* pVertGlyph); | 462 int GetGlyphIndex(FX_DWORD unicodeb, FX_BOOL* pVertGlyph); |
462 void LoadMetricsArray(CPDF_Array* pArray, | 463 void LoadMetricsArray(CPDF_Array* pArray, |
463 CFX_DWordArray& result, | 464 CFX_DWordArray& result, |
464 int nElements); | 465 int nElements); |
465 void LoadSubstFont(); | 466 void LoadSubstFont(); |
466 | 467 |
467 CPDF_CMap* m_pCMap; | 468 CPDF_CMap* m_pCMap; |
468 CPDF_CMap* m_pAllocatedCMap; | 469 CPDF_CMap* m_pAllocatedCMap; |
469 CPDF_CID2UnicodeMap* m_pCID2UnicodeMap; | 470 CPDF_CID2UnicodeMap* m_pCID2UnicodeMap; |
470 int m_Charset; | 471 CIDSet m_Charset; |
471 FX_BOOL m_bType1; | 472 FX_BOOL m_bType1; |
472 CPDF_StreamAcc* m_pCIDToGIDMap; | 473 CPDF_StreamAcc* m_pCIDToGIDMap; |
473 FX_BOOL m_bCIDIsGID; | 474 FX_BOOL m_bCIDIsGID; |
474 FX_WORD m_DefaultWidth; | 475 FX_WORD m_DefaultWidth; |
475 FX_WORD* m_pAnsiWidths; | 476 FX_WORD* m_pAnsiWidths; |
476 FX_SMALL_RECT m_CharBBox[256]; | 477 FX_SMALL_RECT m_CharBBox[256]; |
477 CFX_DWordArray m_WidthList; | 478 CFX_DWordArray m_WidthList; |
478 short m_DefaultVY; | 479 short m_DefaultVY; |
479 short m_DefaultW1; | 480 short m_DefaultW1; |
480 CFX_DWordArray m_VertMetrics; | 481 CFX_DWordArray m_VertMetrics; |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 | 834 |
834 FX_BOOL m_bInterpolate; | 835 FX_BOOL m_bInterpolate; |
835 | 836 |
836 CPDF_Document* m_pDocument; | 837 CPDF_Document* m_pDocument; |
837 | 838 |
838 CPDF_Dictionary* m_pOC; | 839 CPDF_Dictionary* m_pOC; |
839 CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size); | 840 CPDF_Dictionary* InitJPEG(uint8_t* pData, FX_DWORD size); |
840 }; | 841 }; |
841 | 842 |
842 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ | 843 #endif // CORE_INCLUDE_FPDFAPI_FPDF_RESOURCE_H_ |
OLD | NEW |