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 "fpdfsdk/include/fxedit/fx_edit.h" | 10 #include "fpdfsdk/include/fxedit/fx_edit.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 ~CPWL_FontMap() override; | 54 ~CPWL_FontMap() override; |
55 | 55 |
56 // IFX_Edit_FontMap | 56 // IFX_Edit_FontMap |
57 CPDF_Font* GetPDFFont(int32_t nFontIndex) override; | 57 CPDF_Font* GetPDFFont(int32_t nFontIndex) override; |
58 CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) override; | 58 CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) override; |
59 int32_t GetWordFontIndex(FX_WORD word, | 59 int32_t GetWordFontIndex(uint16_t word, |
60 int32_t nCharset, | 60 int32_t nCharset, |
61 int32_t nFontIndex) override; | 61 int32_t nFontIndex) override; |
62 int32_t CharCodeFromUnicode(int32_t nFontIndex, FX_WORD word) override; | 62 int32_t CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) override; |
63 int32_t CharSetFromUnicode(FX_WORD word, int32_t nOldCharset) override; | 63 int32_t CharSetFromUnicode(uint16_t word, int32_t nOldCharset) override; |
64 | 64 |
65 void SetSystemHandler(IFX_SystemHandler* pSystemHandler); | 65 void SetSystemHandler(IFX_SystemHandler* pSystemHandler); |
66 int32_t GetFontMapCount() const; | 66 int32_t GetFontMapCount() const; |
67 const CPWL_FontMap_Data* GetFontMapData(int32_t nIndex) const; | 67 const CPWL_FontMap_Data* GetFontMapData(int32_t nIndex) const; |
68 static int32_t GetNativeCharset(); | 68 static int32_t GetNativeCharset(); |
69 CFX_ByteString GetNativeFontName(int32_t nCharset); | 69 CFX_ByteString GetNativeFontName(int32_t nCharset); |
70 | 70 |
71 static CFX_ByteString GetDefaultFontByCharset(int32_t nCharset); | 71 static CFX_ByteString GetDefaultFontByCharset(int32_t nCharset); |
72 | 72 |
73 CPDF_Font* AddFontToDocument(CPDF_Document* pDoc, | 73 CPDF_Font* AddFontToDocument(CPDF_Document* pDoc, |
74 CFX_ByteString& sFontName, | 74 CFX_ByteString& sFontName, |
75 uint8_t nCharset); | 75 uint8_t nCharset); |
76 static FX_BOOL IsStandardFont(const CFX_ByteString& sFontName); | 76 static FX_BOOL IsStandardFont(const CFX_ByteString& sFontName); |
77 CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName); | 77 CPDF_Font* AddStandardFont(CPDF_Document* pDoc, CFX_ByteString& sFontName); |
78 CPDF_Font* AddSystemFont(CPDF_Document* pDoc, | 78 CPDF_Font* AddSystemFont(CPDF_Document* pDoc, |
79 CFX_ByteString& sFontName, | 79 CFX_ByteString& sFontName, |
80 uint8_t nCharset); | 80 uint8_t nCharset); |
81 | 81 |
82 protected: | 82 protected: |
83 virtual void Initialize(); | 83 virtual void Initialize(); |
84 virtual CPDF_Document* GetDocument(); | 84 virtual CPDF_Document* GetDocument(); |
85 virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, | 85 virtual CPDF_Font* FindFontSameCharset(CFX_ByteString& sFontAlias, |
86 int32_t nCharset); | 86 int32_t nCharset); |
87 virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias); | 87 virtual void AddedFont(CPDF_Font* pFont, const CFX_ByteString& sFontAlias); |
88 | 88 |
89 FX_BOOL KnowWord(int32_t nFontIndex, FX_WORD word); | 89 FX_BOOL KnowWord(int32_t nFontIndex, uint16_t word); |
90 | 90 |
91 void Empty(); | 91 void Empty(); |
92 int32_t GetFontIndex(const CFX_ByteString& sFontName, | 92 int32_t GetFontIndex(const CFX_ByteString& sFontName, |
93 int32_t nCharset, | 93 int32_t nCharset, |
94 FX_BOOL bFind); | 94 FX_BOOL bFind); |
95 int32_t GetPWLFontIndex(FX_WORD word, int32_t nCharset); | 95 int32_t GetPWLFontIndex(uint16_t word, int32_t nCharset); |
96 int32_t AddFontData(CPDF_Font* pFont, | 96 int32_t AddFontData(CPDF_Font* pFont, |
97 const CFX_ByteString& sFontAlias, | 97 const CFX_ByteString& sFontAlias, |
98 int32_t nCharset = DEFAULT_CHARSET); | 98 int32_t nCharset = DEFAULT_CHARSET); |
99 | 99 |
100 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName, | 100 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName, |
101 int32_t nCharset); | 101 int32_t nCharset); |
102 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName); | 102 CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName); |
103 | 103 |
104 private: | 104 private: |
105 CFX_ByteString GetFontName(int32_t nFontIndex); | 105 CFX_ByteString GetFontName(int32_t nFontIndex); |
(...skipping 22 matching lines...) Expand all Loading... |
128 ~CPWL_DocFontMap() override; | 128 ~CPWL_DocFontMap() override; |
129 | 129 |
130 private: | 130 private: |
131 // CPWL_FontMap: | 131 // CPWL_FontMap: |
132 CPDF_Document* GetDocument() override; | 132 CPDF_Document* GetDocument() override; |
133 | 133 |
134 CPDF_Document* m_pAttachedDoc; | 134 CPDF_Document* m_pAttachedDoc; |
135 }; | 135 }; |
136 | 136 |
137 #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_FONTMAP_H_ | 137 #endif // FPDFSDK_INCLUDE_PDFWINDOW_PWL_FONTMAP_H_ |
OLD | NEW |