| 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 FPDFSDK_INCLUDE_PDFWINDOW_PWL_FONTMAP_H_ | 7 #ifndef FPDFSDK_INCLUDE_PDFWINDOW_PWL_FONTMAP_H_ |
| 8 #define FPDFSDK_INCLUDE_PDFWINDOW_PWL_FONTMAP_H_ | 8 #define FPDFSDK_INCLUDE_PDFWINDOW_PWL_FONTMAP_H_ |
| 9 | 9 |
| 10 #include "../../../public/fpdf_sysfontinfo.h" | 10 #include "../../../public/fpdf_sysfontinfo.h" |
| 11 #include "../fxedit/fx_edit.h" | 11 #include "../fxedit/fx_edit.h" |
| 12 | 12 |
| 13 class CPDF_Document; | 13 class CPDF_Document; |
| 14 class IFX_SystemHandler; | 14 class IFX_SystemHandler; |
| 15 | 15 |
| 16 struct CPWL_FontMap_Data | 16 struct CPWL_FontMap_Data { |
| 17 { | 17 CPDF_Font* pFont; |
| 18 » CPDF_Font*» » » pFont; | 18 int32_t nCharset; |
| 19 » int32_t»» » nCharset; | 19 CFX_ByteString sFontName; |
| 20 » CFX_ByteString» » sFontName; | |
| 21 }; | 20 }; |
| 22 | 21 |
| 23 struct CPWL_FontMap_Native | 22 struct CPWL_FontMap_Native { |
| 24 { | 23 int32_t nCharset; |
| 25 » int32_t»» » nCharset; | 24 CFX_ByteString sFontName; |
| 26 » CFX_ByteString» » sFontName; | |
| 27 }; | 25 }; |
| 28 | 26 |
| 29 #ifndef ANSI_CHARSET | 27 #ifndef ANSI_CHARSET |
| 30 | 28 |
| 31 #define ANSI_CHARSET 0 | 29 #define ANSI_CHARSET 0 |
| 32 #define DEFAULT_CHARSET 1 | 30 #define DEFAULT_CHARSET 1 |
| 33 #define SYMBOL_CHARSET 2 | 31 #define SYMBOL_CHARSET 2 |
| 34 #define SHIFTJIS_CHARSET 128 | 32 #define SHIFTJIS_CHARSET 128 |
| 35 #define HANGEUL_CHARSET 129 | 33 #define HANGEUL_CHARSET 129 |
| 36 #define HANGUL_CHARSET 129 | 34 #define HANGUL_CHARSET 129 |
| 37 #define GB2312_CHARSET 134 | 35 #define GB2312_CHARSET 134 |
| 38 #define CHINESEBIG5_CHARSET 136 | 36 #define CHINESEBIG5_CHARSET 136 |
| 39 #define OEM_CHARSET 255 | 37 #define OEM_CHARSET 255 |
| 40 #define JOHAB_CHARSET 130 | 38 #define JOHAB_CHARSET 130 |
| 41 #define HEBREW_CHARSET 177 | 39 #define HEBREW_CHARSET 177 |
| 42 #define ARABIC_CHARSET 178 | 40 #define ARABIC_CHARSET 178 |
| 43 #define GREEK_CHARSET 161 | 41 #define GREEK_CHARSET 161 |
| 44 #define TURKISH_CHARSET 162 | 42 #define TURKISH_CHARSET 162 |
| 45 #define VIETNAMESE_CHARSET 163 | 43 #define VIETNAMESE_CHARSET 163 |
| 46 #define THAI_CHARSET 222 | 44 #define THAI_CHARSET 222 |
| 47 #define EASTEUROPE_CHARSET 238 | 45 #define EASTEUROPE_CHARSET 238 |
| 48 #define RUSSIAN_CHARSET 204 | 46 #define RUSSIAN_CHARSET 204 |
| 49 #define BALTIC_CHARSET 186 | 47 #define BALTIC_CHARSET 186 |
| 50 | 48 |
| 51 #endif | 49 #endif |
| 52 | 50 |
| 53 class CPWL_FontMap : public IFX_Edit_FontMap | 51 class CPWL_FontMap : public IFX_Edit_FontMap { |
| 54 { | 52 public: |
| 55 public: | 53 CPWL_FontMap(IFX_SystemHandler* pSystemHandler); |
| 56 » CPWL_FontMap(IFX_SystemHandler* pSystemHandler); | 54 virtual ~CPWL_FontMap(); |
| 57 » virtual ~CPWL_FontMap(); | |
| 58 | 55 |
| 59 » virtual CPDF_Font*» » » » » » »
GetPDFFont(int32_t nFontIndex); | 56 virtual CPDF_Font* GetPDFFont(int32_t nFontIndex); |
| 60 » virtual CFX_ByteString» » » » » » GetPDFFo
ntAlias(int32_t nFontIndex); | 57 virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex); |
| 61 » virtual int32_t»» » » » » » GetWordF
ontIndex(FX_WORD word, int32_t nCharset, int32_t nFontIndex); | 58 virtual int32_t GetWordFontIndex(FX_WORD word, |
| 62 » virtual int32_t»» » » » » » CharCode
FromUnicode(int32_t nFontIndex, FX_WORD word); | 59 int32_t nCharset, |
| 63 » virtual int32_t»» » » » » » CharSetF
romUnicode(FX_WORD word, int32_t nOldCharset); | 60 int32_t nFontIndex); |
| 61 virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word); |
| 62 virtual int32_t CharSetFromUnicode(FX_WORD word, int32_t nOldCharset); |
| 64 | 63 |
| 65 public: | 64 public: |
| 66 » virtual void» » » » » » » »
Initial(const FX_CHAR* fontname = NULL); | 65 virtual void Initial(const FX_CHAR* fontname = NULL); |
| 67 » void» » » » » » » » »
» SetSystemHandler(IFX_SystemHandler* pSystemHandler); | 66 void SetSystemHandler(IFX_SystemHandler* pSystemHandler); |
| 68 | 67 |
| 69 » int32_t»» » » » » » » »
GetFontMapCount() const; | 68 int32_t GetFontMapCount() const; |
| 70 » const CPWL_FontMap_Data*» » » » » GetFontM
apData(int32_t nIndex) const; | 69 const CPWL_FontMap_Data* GetFontMapData(int32_t nIndex) const; |
| 71 | 70 |
| 72 public: | 71 public: |
| 73 » static int32_t» » » » » » » »
GetNativeCharset(); | 72 static int32_t GetNativeCharset(); |
| 74 » CFX_ByteString» » » » » » » »
GetNativeFontName(int32_t nCharset); | 73 CFX_ByteString GetNativeFontName(int32_t nCharset); |
| 75 | 74 |
| 76 » static CFX_ByteString» » » » » » GetDefau
ltFontByCharset(int32_t nCharset); | 75 static CFX_ByteString GetDefaultFontByCharset(int32_t nCharset); |
| 77 | 76 |
| 78 » CPDF_Font*» » » » » » » »
» AddFontToDocument(CPDF_Document* pDoc, CFX_ByteString& sFontName, uint8_
t nCharset); | 77 CPDF_Font* AddFontToDocument(CPDF_Document* pDoc, |
| 79 » static FX_BOOL» » » » » » » »
IsStandardFont(const CFX_ByteString& sFontName); | 78 CFX_ByteString& sFontName, |
| 80 » CPDF_Font*» » » » » » » »
» AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName); | 79 uint8_t nCharset); |
| 81 » CPDF_Font*» » » » » » » »
» AddSystemFont(CPDF_Document* pDoc, CFX_ByteString& sFontName, | 80 static FX_BOOL IsStandardFont(const CFX_ByteString& sFontName); |
| 82 » » » » » » » » » »
» » » uint8_t nCharset); | 81 CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName); |
| 82 CPDF_Font* AddSystemFont(CPDF_Document* pDoc, |
| 83 CFX_ByteString& sFontName, |
| 84 uint8_t nCharset); |
| 83 | 85 |
| 84 protected: | 86 protected: |
| 85 » virtual CPDF_Font*» » » » » » »
FindFontSameCharset(CFX_ByteString& sFontAlias, int32_t nCharset); | 87 virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, |
| 86 » virtual void» » » » » » » »
AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias); | 88 int32_t nCharset); |
| 87 » FX_BOOL»» » » » » » » »
» KnowWord(int32_t nFontIndex, FX_WORD word); | 89 virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias); |
| 90 FX_BOOL KnowWord(int32_t nFontIndex, FX_WORD word); |
| 88 | 91 |
| 89 » virtual CPDF_Document*» » » » » » GetDocum
ent(); | 92 virtual CPDF_Document* GetDocument(); |
| 90 | 93 |
| 91 » void» » » » » » » » »
» Empty(); | 94 void Empty(); |
| 92 » int32_t»» » » » » » » »
GetFontIndex(const CFX_ByteString& sFontName, int32_t nCharset, FX_BOOL bFind); | 95 int32_t GetFontIndex(const CFX_ByteString& sFontName, |
| 93 » int32_t»» » » » » » » »
GetPWLFontIndex(FX_WORD word, int32_t nCharset); | 96 int32_t nCharset, |
| 94 » int32_t»» » » » » » » »
AddFontData(CPDF_Font* pFont, const CFX_ByteString& sFontAlias, int32_t nCharset
= DEFAULT_CHARSET); | 97 FX_BOOL bFind); |
| 98 int32_t GetPWLFontIndex(FX_WORD word, int32_t nCharset); |
| 99 int32_t AddFontData(CPDF_Font* pFont, |
| 100 const CFX_ByteString& sFontAlias, |
| 101 int32_t nCharset = DEFAULT_CHARSET); |
| 95 | 102 |
| 96 » CFX_ByteString» » » » » » » »
EncodeFontAlias(const CFX_ByteString& sFontName, int32_t nCharset); | 103 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName, |
| 97 » CFX_ByteString» » » » » » » »
EncodeFontAlias(const CFX_ByteString& sFontName); | 104 int32_t nCharset); |
| 105 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName); |
| 98 | 106 |
| 99 private: | 107 private: |
| 100 » CFX_ByteString» » » » » » » »
GetFontName(int32_t nFontIndex); | 108 CFX_ByteString GetFontName(int32_t nFontIndex); |
| 101 » int32_t»» » » » » » » »
FindFont(const CFX_ByteString& sFontName, int32_t nCharset = DEFAULT_CHARSET); | 109 int32_t FindFont(const CFX_ByteString& sFontName, |
| 110 int32_t nCharset = DEFAULT_CHARSET); |
| 102 | 111 |
| 103 » CFX_ByteString» » » » » » » »
GetNativeFont(int32_t nCharset); | 112 CFX_ByteString GetNativeFont(int32_t nCharset); |
| 104 | 113 |
| 105 public: | 114 public: |
| 106 using CharsetFontMap = FPDF_CharsetFontMap; | 115 using CharsetFontMap = FPDF_CharsetFontMap; |
| 107 » static const CharsetFontMap» » » » » defaultT
TFMap[]; | 116 static const CharsetFontMap defaultTTFMap[]; |
| 108 | 117 |
| 109 protected: | 118 protected: |
| 110 » CFX_ArrayTemplate<CPWL_FontMap_Data*>» » m_aData; | 119 CFX_ArrayTemplate<CPWL_FontMap_Data*> m_aData; |
| 111 » CFX_ArrayTemplate<CPWL_FontMap_Native*>»» m_aNativeFont; | 120 CFX_ArrayTemplate<CPWL_FontMap_Native*> m_aNativeFont; |
| 112 | 121 |
| 113 private: | 122 private: |
| 114 » CPDF_Document*» » » » » » » »
m_pPDFDoc; | 123 CPDF_Document* m_pPDFDoc; |
| 115 » IFX_SystemHandler*» » » » » » »
m_pSystemHandler; | 124 IFX_SystemHandler* m_pSystemHandler; |
| 116 }; | 125 }; |
| 117 | 126 |
| 118 class CPWL_DocFontMap : public CPWL_FontMap | 127 class CPWL_DocFontMap : public CPWL_FontMap { |
| 119 { | 128 public: |
| 120 public: | 129 CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler, |
| 121 » CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler, CPDF_Document* pAttac
hedDoc); | 130 CPDF_Document* pAttachedDoc); |
| 122 » virtual ~CPWL_DocFontMap(); | 131 virtual ~CPWL_DocFontMap(); |
| 123 | 132 |
| 124 » virtual CPDF_Document*» » » » » » GetDocum
ent(); | 133 virtual CPDF_Document* GetDocument(); |
| 125 | 134 |
| 126 private: | 135 private: |
| 127 » CPDF_Document*» » » » » » » »
m_pAttachedDoc; | 136 CPDF_Document* m_pAttachedDoc; |
| 128 }; | 137 }; |
| 129 | 138 |
| 130 #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_FONTMAP_H_ | 139 #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_FONTMAP_H_ |
| OLD | NEW |