| 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" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #define THAI_CHARSET 222 | 44 #define THAI_CHARSET 222 |
| 45 #define EASTEUROPE_CHARSET 238 | 45 #define EASTEUROPE_CHARSET 238 |
| 46 #define RUSSIAN_CHARSET 204 | 46 #define RUSSIAN_CHARSET 204 |
| 47 #define BALTIC_CHARSET 186 | 47 #define BALTIC_CHARSET 186 |
| 48 | 48 |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 class CPWL_FontMap : public IFX_Edit_FontMap { | 51 class CPWL_FontMap : public IFX_Edit_FontMap { |
| 52 public: | 52 public: |
| 53 CPWL_FontMap(IFX_SystemHandler* pSystemHandler); | 53 CPWL_FontMap(IFX_SystemHandler* pSystemHandler); |
| 54 virtual ~CPWL_FontMap(); | 54 ~CPWL_FontMap() override; |
| 55 | 55 |
| 56 virtual CPDF_Font* GetPDFFont(int32_t nFontIndex); | 56 // IFX_Edit_FontMap |
| 57 virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex); | 57 CPDF_Font* GetPDFFont(int32_t nFontIndex) override; |
| 58 virtual int32_t GetWordFontIndex(FX_WORD word, | 58 CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) override; |
| 59 int32_t nCharset, | 59 int32_t GetWordFontIndex(FX_WORD word, |
| 60 int32_t nFontIndex); | 60 int32_t nCharset, |
| 61 virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word); | 61 int32_t nFontIndex) override; |
| 62 virtual int32_t CharSetFromUnicode(FX_WORD word, int32_t nOldCharset); | 62 int32_t CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word) override; |
| 63 int32_t CharSetFromUnicode(FX_WORD word, int32_t nOldCharset) override; |
| 63 | 64 |
| 64 public: | |
| 65 virtual void Initial(const FX_CHAR* fontname = NULL); | |
| 66 void SetSystemHandler(IFX_SystemHandler* pSystemHandler); | 65 void SetSystemHandler(IFX_SystemHandler* pSystemHandler); |
| 67 | |
| 68 int32_t GetFontMapCount() const; | 66 int32_t GetFontMapCount() const; |
| 69 const CPWL_FontMap_Data* GetFontMapData(int32_t nIndex) const; | 67 const CPWL_FontMap_Data* GetFontMapData(int32_t nIndex) const; |
| 70 | |
| 71 public: | |
| 72 static int32_t GetNativeCharset(); | 68 static int32_t GetNativeCharset(); |
| 73 CFX_ByteString GetNativeFontName(int32_t nCharset); | 69 CFX_ByteString GetNativeFontName(int32_t nCharset); |
| 74 | 70 |
| 75 static CFX_ByteString GetDefaultFontByCharset(int32_t nCharset); | 71 static CFX_ByteString GetDefaultFontByCharset(int32_t nCharset); |
| 76 | 72 |
| 77 CPDF_Font* AddFontToDocument(CPDF_Document* pDoc, | 73 CPDF_Font* AddFontToDocument(CPDF_Document* pDoc, |
| 78 CFX_ByteString& sFontName, | 74 CFX_ByteString& sFontName, |
| 79 uint8_t nCharset); | 75 uint8_t nCharset); |
| 80 static FX_BOOL IsStandardFont(const CFX_ByteString& sFontName); | 76 static FX_BOOL IsStandardFont(const CFX_ByteString& sFontName); |
| 81 CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName); | 77 CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName); |
| 82 CPDF_Font* AddSystemFont(CPDF_Document* pDoc, | 78 CPDF_Font* AddSystemFont(CPDF_Document* pDoc, |
| 83 CFX_ByteString& sFontName, | 79 CFX_ByteString& sFontName, |
| 84 uint8_t nCharset); | 80 uint8_t nCharset); |
| 85 | 81 |
| 86 protected: | 82 protected: |
| 87 virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, | 83 void Initial(const FX_CHAR* fontname = NULL); |
| 88 int32_t nCharset); | 84 CPDF_Document* GetDocument(); |
| 89 virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias); | 85 CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, int32_t nCharset); |
| 86 void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias); |
| 87 |
| 90 FX_BOOL KnowWord(int32_t nFontIndex, FX_WORD word); | 88 FX_BOOL KnowWord(int32_t nFontIndex, FX_WORD word); |
| 91 | 89 |
| 92 virtual CPDF_Document* GetDocument(); | |
| 93 | |
| 94 void Empty(); | 90 void Empty(); |
| 95 int32_t GetFontIndex(const CFX_ByteString& sFontName, | 91 int32_t GetFontIndex(const CFX_ByteString& sFontName, |
| 96 int32_t nCharset, | 92 int32_t nCharset, |
| 97 FX_BOOL bFind); | 93 FX_BOOL bFind); |
| 98 int32_t GetPWLFontIndex(FX_WORD word, int32_t nCharset); | 94 int32_t GetPWLFontIndex(FX_WORD word, int32_t nCharset); |
| 99 int32_t AddFontData(CPDF_Font* pFont, | 95 int32_t AddFontData(CPDF_Font* pFont, |
| 100 const CFX_ByteString& sFontAlias, | 96 const CFX_ByteString& sFontAlias, |
| 101 int32_t nCharset = DEFAULT_CHARSET); | 97 int32_t nCharset = DEFAULT_CHARSET); |
| 102 | 98 |
| 103 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName, | 99 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 121 | 117 |
| 122 private: | 118 private: |
| 123 CPDF_Document* m_pPDFDoc; | 119 CPDF_Document* m_pPDFDoc; |
| 124 IFX_SystemHandler* m_pSystemHandler; | 120 IFX_SystemHandler* m_pSystemHandler; |
| 125 }; | 121 }; |
| 126 | 122 |
| 127 class CPWL_DocFontMap : public CPWL_FontMap { | 123 class CPWL_DocFontMap : public CPWL_FontMap { |
| 128 public: | 124 public: |
| 129 CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler, | 125 CPWL_DocFontMap(IFX_SystemHandler* pSystemHandler, |
| 130 CPDF_Document* pAttachedDoc); | 126 CPDF_Document* pAttachedDoc); |
| 131 virtual ~CPWL_DocFontMap(); | 127 ~CPWL_DocFontMap() override; |
| 132 | 128 |
| 133 virtual CPDF_Document* GetDocument(); | 129 virtual CPDF_Document* GetDocument(); |
| 134 | 130 |
| 135 private: | 131 private: |
| 136 CPDF_Document* m_pAttachedDoc; | 132 CPDF_Document* m_pAttachedDoc; |
| 137 }; | 133 }; |
| 138 | 134 |
| 139 #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_FONTMAP_H_ | 135 #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_FONTMAP_H_ |
| OLD | NEW |