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_FXGE_FX_FONT_H_ | 7 #ifndef CORE_INCLUDE_FXGE_FX_FONT_H_ |
8 #define CORE_INCLUDE_FXGE_FX_FONT_H_ | 8 #define CORE_INCLUDE_FXGE_FX_FONT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 protected: | 134 protected: |
135 FX_BOOL m_bEmbedded; | 135 FX_BOOL m_bEmbedded; |
136 FX_BOOL m_bVertical; | 136 FX_BOOL m_bVertical; |
137 FX_BOOL m_bLogic; | 137 FX_BOOL m_bLogic; |
138 void* m_pOwnedStream; | 138 void* m_pOwnedStream; |
139 }; | 139 }; |
140 #define ENCODING_INTERNAL 0 | 140 #define ENCODING_INTERNAL 0 |
141 #define ENCODING_UNICODE 1 | 141 #define ENCODING_UNICODE 1 |
142 | 142 |
143 class IFX_FontEncoding { | |
144 public: | |
145 virtual ~IFX_FontEncoding() {} | |
146 | |
147 virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode) = 0; | |
148 | |
149 virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const = 0; | |
150 | |
151 virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const = 0; | |
152 }; | |
153 | |
154 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont); | |
155 #define FXFM_ENC_TAG(a, b, c, d) \ | 143 #define FXFM_ENC_TAG(a, b, c, d) \ |
156 (((FX_DWORD)(a) << 24) | ((FX_DWORD)(b) << 16) | ((FX_DWORD)(c) << 8) | \ | 144 (((FX_DWORD)(a) << 24) | ((FX_DWORD)(b) << 16) | ((FX_DWORD)(c) << 8) | \ |
157 (FX_DWORD)(d)) | 145 (FX_DWORD)(d)) |
158 #define FXFM_ENCODING_NONE FXFM_ENC_TAG(0, 0, 0, 0) | 146 #define FXFM_ENCODING_NONE FXFM_ENC_TAG(0, 0, 0, 0) |
159 #define FXFM_ENCODING_MS_SYMBOL FXFM_ENC_TAG('s', 'y', 'm', 'b') | 147 #define FXFM_ENCODING_MS_SYMBOL FXFM_ENC_TAG('s', 'y', 'm', 'b') |
160 #define FXFM_ENCODING_UNICODE FXFM_ENC_TAG('u', 'n', 'i', 'c') | 148 #define FXFM_ENCODING_UNICODE FXFM_ENC_TAG('u', 'n', 'i', 'c') |
161 #define FXFM_ENCODING_MS_SJIS FXFM_ENC_TAG('s', 'j', 'i', 's') | 149 #define FXFM_ENCODING_MS_SJIS FXFM_ENC_TAG('s', 'j', 'i', 's') |
162 #define FXFM_ENCODING_MS_GB2312 FXFM_ENC_TAG('g', 'b', ' ', ' ') | 150 #define FXFM_ENCODING_MS_GB2312 FXFM_ENC_TAG('g', 'b', ' ', ' ') |
163 #define FXFM_ENCODING_MS_BIG5 FXFM_ENC_TAG('b', 'i', 'g', '5') | 151 #define FXFM_ENCODING_MS_BIG5 FXFM_ENC_TAG('b', 'i', 'g', '5') |
164 #define FXFM_ENCODING_MS_WANSUNG FXFM_ENC_TAG('w', 'a', 'n', 's') | 152 #define FXFM_ENCODING_MS_WANSUNG FXFM_ENC_TAG('w', 'a', 'n', 's') |
165 #define FXFM_ENCODING_MS_JOHAB FXFM_ENC_TAG('j', 'o', 'h', 'a') | 153 #define FXFM_ENCODING_MS_JOHAB FXFM_ENC_TAG('j', 'o', 'h', 'a') |
166 #define FXFM_ENCODING_ADOBE_STANDARD FXFM_ENC_TAG('A', 'D', 'O', 'B') | 154 #define FXFM_ENCODING_ADOBE_STANDARD FXFM_ENC_TAG('A', 'D', 'O', 'B') |
167 #define FXFM_ENCODING_ADOBE_EXPERT FXFM_ENC_TAG('A', 'D', 'B', 'E') | 155 #define FXFM_ENCODING_ADOBE_EXPERT FXFM_ENC_TAG('A', 'D', 'B', 'E') |
168 #define FXFM_ENCODING_ADOBE_CUSTOM FXFM_ENC_TAG('A', 'D', 'B', 'C') | 156 #define FXFM_ENCODING_ADOBE_CUSTOM FXFM_ENC_TAG('A', 'D', 'B', 'C') |
169 #define FXFM_ENCODING_ADOBE_LATIN_1 FXFM_ENC_TAG('l', 'a', 't', '1') | 157 #define FXFM_ENCODING_ADOBE_LATIN_1 FXFM_ENC_TAG('l', 'a', 't', '1') |
170 #define FXFM_ENCODING_OLD_LATIN_2 FXFM_ENC_TAG('l', 'a', 't', '2') | 158 #define FXFM_ENCODING_OLD_LATIN_2 FXFM_ENC_TAG('l', 'a', 't', '2') |
171 #define FXFM_ENCODING_APPLE_ROMAN FXFM_ENC_TAG('a', 'r', 'm', 'n') | 159 #define FXFM_ENCODING_APPLE_ROMAN FXFM_ENC_TAG('a', 'r', 'm', 'n') |
172 class IFX_FontEncodingEx : public IFX_FontEncoding { | 160 |
| 161 class CFX_UnicodeEncoding { |
173 public: | 162 public: |
174 virtual FX_DWORD GlyphIndexFromName(const FX_CHAR* pStrName) = 0; | 163 explicit CFX_UnicodeEncoding(CFX_Font* pFont); |
| 164 virtual ~CFX_UnicodeEncoding(); |
175 | 165 |
176 virtual CFX_ByteString NameFromGlyphIndex(FX_DWORD dwGlyphIndex) = 0; | 166 virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode); |
177 | 167 |
178 virtual FX_DWORD CharCodeFromGlyphIndex(FX_DWORD dwGlyphIndex) = 0; | 168 protected: |
| 169 // Unowned, not nullptr. |
| 170 CFX_Font* m_pFont; |
179 }; | 171 }; |
180 IFX_FontEncodingEx* FX_CreateFontEncodingEx( | 172 |
| 173 class CFX_UnicodeEncodingEx : public CFX_UnicodeEncoding { |
| 174 public: |
| 175 CFX_UnicodeEncodingEx(CFX_Font* pFont, FX_DWORD EncodingID); |
| 176 ~CFX_UnicodeEncodingEx() override; |
| 177 |
| 178 // CFX_UnicodeEncoding: |
| 179 FX_DWORD GlyphFromCharCode(FX_DWORD charcode) override; |
| 180 |
| 181 FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const; |
| 182 |
| 183 private: |
| 184 FX_DWORD m_nEncodingID; |
| 185 }; |
| 186 |
| 187 CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx( |
181 CFX_Font* pFont, | 188 CFX_Font* pFont, |
182 FX_DWORD nEncodingID = FXFM_ENCODING_NONE); | 189 FX_DWORD nEncodingID = FXFM_ENCODING_NONE); |
| 190 |
183 #define FXFONT_SUBST_MM 0x01 | 191 #define FXFONT_SUBST_MM 0x01 |
184 #define FXFONT_SUBST_GLYPHPATH 0x04 | 192 #define FXFONT_SUBST_GLYPHPATH 0x04 |
185 #define FXFONT_SUBST_CLEARTYPE 0x08 | 193 #define FXFONT_SUBST_CLEARTYPE 0x08 |
186 #define FXFONT_SUBST_TRANSFORM 0x10 | 194 #define FXFONT_SUBST_TRANSFORM 0x10 |
187 #define FXFONT_SUBST_NONSYMBOL 0x20 | 195 #define FXFONT_SUBST_NONSYMBOL 0x20 |
188 #define FXFONT_SUBST_EXACT 0x40 | 196 #define FXFONT_SUBST_EXACT 0x40 |
189 #define FXFONT_SUBST_STANDARD 0x80 | 197 #define FXFONT_SUBST_STANDARD 0x80 |
190 class CFX_SubstFont { | 198 class CFX_SubstFont { |
191 public: | 199 public: |
192 CFX_SubstFont(); | 200 CFX_SubstFont(); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 class IFX_GSUBTable { | 507 class IFX_GSUBTable { |
500 public: | 508 public: |
501 static IFX_GSUBTable* Create(CFX_Font* pFont); | 509 static IFX_GSUBTable* Create(CFX_Font* pFont); |
502 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; | 510 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; |
503 | 511 |
504 protected: | 512 protected: |
505 virtual ~IFX_GSUBTable() {} | 513 virtual ~IFX_GSUBTable() {} |
506 }; | 514 }; |
507 | 515 |
508 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 516 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
OLD | NEW |