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