Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: core/include/fxge/fx_font.h

Issue 1471323004: Inflict PPDF_ENABLE_XFA ifdefs on XFA core/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 16 matching lines...) Expand all
27 class IFX_SystemFontInfo; 27 class IFX_SystemFontInfo;
28 28
29 #define FXFONT_FIXED_PITCH 0x01 29 #define FXFONT_FIXED_PITCH 0x01
30 #define FXFONT_SERIF 0x02 30 #define FXFONT_SERIF 0x02
31 #define FXFONT_SYMBOLIC 0x04 31 #define FXFONT_SYMBOLIC 0x04
32 #define FXFONT_SCRIPT 0x08 32 #define FXFONT_SCRIPT 0x08
33 #define FXFONT_ITALIC 0x40 33 #define FXFONT_ITALIC 0x40
34 #define FXFONT_BOLD 0x40000 34 #define FXFONT_BOLD 0x40000
35 #define FXFONT_USEEXTERNATTR 0x80000 35 #define FXFONT_USEEXTERNATTR 0x80000
36 #define FXFONT_CIDFONT 0x100000 36 #define FXFONT_CIDFONT 0x100000
37 #ifdef PDF_ENABLE_XFA
37 #define FXFONT_EXACTMATCH 0x80000000 38 #define FXFONT_EXACTMATCH 0x80000000
39 #endif
38 #define FXFONT_ANSI_CHARSET 0 40 #define FXFONT_ANSI_CHARSET 0
39 #define FXFONT_DEFAULT_CHARSET 1 41 #define FXFONT_DEFAULT_CHARSET 1
40 #define FXFONT_SYMBOL_CHARSET 2 42 #define FXFONT_SYMBOL_CHARSET 2
41 #define FXFONT_SHIFTJIS_CHARSET 128 43 #define FXFONT_SHIFTJIS_CHARSET 128
42 #define FXFONT_HANGEUL_CHARSET 129 44 #define FXFONT_HANGEUL_CHARSET 129
43 #define FXFONT_GB2312_CHARSET 134 45 #define FXFONT_GB2312_CHARSET 134
44 #define FXFONT_CHINESEBIG5_CHARSET 136 46 #define FXFONT_CHINESEBIG5_CHARSET 136
45 #define FXFONT_THAI_CHARSET 222 47 #define FXFONT_THAI_CHARSET 222
46 #define FXFONT_EASTEUROPE_CHARSET 238 48 #define FXFONT_EASTEUROPE_CHARSET 238
47 #define FXFONT_RUSSIAN_CHARSET 204 49 #define FXFONT_RUSSIAN_CHARSET 204
(...skipping 14 matching lines...) Expand all
62 ~CFX_Font(); 64 ~CFX_Font();
63 65
64 void LoadSubst(const CFX_ByteString& face_name, 66 void LoadSubst(const CFX_ByteString& face_name,
65 FX_BOOL bTrueType, 67 FX_BOOL bTrueType,
66 FX_DWORD flags, 68 FX_DWORD flags,
67 int weight, 69 int weight,
68 int italic_angle, 70 int italic_angle,
69 int CharsetCP, 71 int CharsetCP,
70 FX_BOOL bVertical = FALSE); 72 FX_BOOL bVertical = FALSE);
71 FX_BOOL LoadEmbedded(const uint8_t* data, FX_DWORD size); 73 FX_BOOL LoadEmbedded(const uint8_t* data, FX_DWORD size);
74 #ifdef PDF_ENABLE_XFA
72 75
73 FX_BOOL LoadFile(IFX_FileRead* pFile, 76 FX_BOOL LoadFile(IFX_FileRead* pFile,
74 int nFaceIndex = 0, 77 int nFaceIndex = 0,
75 int* pFaceCount = NULL); 78 int* pFaceCount = NULL);
76 79
77 FX_BOOL LoadClone(const CFX_Font* pFont); 80 FX_BOOL LoadClone(const CFX_Font* pFont);
78 81
82 #endif
79 FXFT_Face GetFace() const { return m_Face; } 83 FXFT_Face GetFace() const { return m_Face; }
84 #ifndef PDF_ENABLE_XFA
85 const CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; }
86 #else
80 CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; } 87 CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; }
81 void SetFace(FXFT_Face face) { m_Face = face; } 88 void SetFace(FXFT_Face face) { m_Face = face; }
82 void SetSubstFont(CFX_SubstFont* subst) { m_pSubstFont = subst; } 89 void SetSubstFont(CFX_SubstFont* subst) { m_pSubstFont = subst; }
90 #endif
83 CFX_PathData* LoadGlyphPath(FX_DWORD glyph_index, int dest_width = 0); 91 CFX_PathData* LoadGlyphPath(FX_DWORD glyph_index, int dest_width = 0);
84 int GetGlyphWidth(FX_DWORD glyph_index); 92 int GetGlyphWidth(FX_DWORD glyph_index);
85 int GetAscent() const; 93 int GetAscent() const;
86 int GetDescent() const; 94 int GetDescent() const;
87 FX_BOOL GetGlyphBBox(FX_DWORD glyph_index, FX_RECT& bbox); 95 FX_BOOL GetGlyphBBox(FX_DWORD glyph_index, FX_RECT& bbox);
88 FX_BOOL IsItalic() const; 96 FX_BOOL IsItalic() const;
89 FX_BOOL IsBold() const; 97 FX_BOOL IsBold() const;
90 FX_BOOL IsFixedWidth() const; 98 FX_BOOL IsFixedWidth() const;
91 FX_BOOL IsVertical() const { return m_bVertical; } 99 FX_BOOL IsVertical() const { return m_bVertical; }
92 CFX_WideString GetPsName() const; 100 CFX_WideString GetPsName() const;
(...skipping 25 matching lines...) Expand all
118 uint8_t* m_pGsubData; 126 uint8_t* m_pGsubData;
119 FX_DWORD m_dwSize; 127 FX_DWORD m_dwSize;
120 CFX_BinaryBuf m_OtfFontData; 128 CFX_BinaryBuf m_OtfFontData;
121 void* m_hHandle; 129 void* m_hHandle;
122 void* m_pPlatformFont; 130 void* m_pPlatformFont;
123 void* m_pPlatformFontCollection; 131 void* m_pPlatformFontCollection;
124 void* m_pDwFont; 132 void* m_pDwFont;
125 FX_BOOL m_bDwLoaded; 133 FX_BOOL m_bDwLoaded;
126 FX_BOOL m_bEmbedded; 134 FX_BOOL m_bEmbedded;
127 FX_BOOL m_bVertical; 135 FX_BOOL m_bVertical;
136 #ifdef PDF_ENABLE_XFA
128 137
129 protected: 138 protected:
130 FX_BOOL m_bLogic; 139 FX_BOOL m_bLogic;
131 void* m_pOwnedStream; 140 void* m_pOwnedStream;
141 #endif
132 }; 142 };
133 143
134 #define ENCODING_INTERNAL 0 144 #define ENCODING_INTERNAL 0
135 #define ENCODING_UNICODE 1 145 #define ENCODING_UNICODE 1
136 146
147 #ifdef PDF_ENABLE_XFA
137 #define FXFM_ENC_TAG(a, b, c, d) \ 148 #define FXFM_ENC_TAG(a, b, c, d) \
138 (((FX_DWORD)(a) << 24) | ((FX_DWORD)(b) << 16) | ((FX_DWORD)(c) << 8) | \ 149 (((FX_DWORD)(a) << 24) | ((FX_DWORD)(b) << 16) | ((FX_DWORD)(c) << 8) | \
139 (FX_DWORD)(d)) 150 (FX_DWORD)(d))
140 #define FXFM_ENCODING_NONE FXFM_ENC_TAG(0, 0, 0, 0) 151 #define FXFM_ENCODING_NONE FXFM_ENC_TAG(0, 0, 0, 0)
141 #define FXFM_ENCODING_MS_SYMBOL FXFM_ENC_TAG('s', 'y', 'm', 'b') 152 #define FXFM_ENCODING_MS_SYMBOL FXFM_ENC_TAG('s', 'y', 'm', 'b')
142 #define FXFM_ENCODING_UNICODE FXFM_ENC_TAG('u', 'n', 'i', 'c') 153 #define FXFM_ENCODING_UNICODE FXFM_ENC_TAG('u', 'n', 'i', 'c')
143 #define FXFM_ENCODING_MS_SJIS FXFM_ENC_TAG('s', 'j', 'i', 's') 154 #define FXFM_ENCODING_MS_SJIS FXFM_ENC_TAG('s', 'j', 'i', 's')
144 #define FXFM_ENCODING_MS_GB2312 FXFM_ENC_TAG('g', 'b', ' ', ' ') 155 #define FXFM_ENCODING_MS_GB2312 FXFM_ENC_TAG('g', 'b', ' ', ' ')
145 #define FXFM_ENCODING_MS_BIG5 FXFM_ENC_TAG('b', 'i', 'g', '5') 156 #define FXFM_ENCODING_MS_BIG5 FXFM_ENC_TAG('b', 'i', 'g', '5')
146 #define FXFM_ENCODING_MS_WANSUNG FXFM_ENC_TAG('w', 'a', 'n', 's') 157 #define FXFM_ENCODING_MS_WANSUNG FXFM_ENC_TAG('w', 'a', 'n', 's')
147 #define FXFM_ENCODING_MS_JOHAB FXFM_ENC_TAG('j', 'o', 'h', 'a') 158 #define FXFM_ENCODING_MS_JOHAB FXFM_ENC_TAG('j', 'o', 'h', 'a')
148 #define FXFM_ENCODING_ADOBE_STANDARD FXFM_ENC_TAG('A', 'D', 'O', 'B') 159 #define FXFM_ENCODING_ADOBE_STANDARD FXFM_ENC_TAG('A', 'D', 'O', 'B')
149 #define FXFM_ENCODING_ADOBE_EXPERT FXFM_ENC_TAG('A', 'D', 'B', 'E') 160 #define FXFM_ENCODING_ADOBE_EXPERT FXFM_ENC_TAG('A', 'D', 'B', 'E')
150 #define FXFM_ENCODING_ADOBE_CUSTOM FXFM_ENC_TAG('A', 'D', 'B', 'C') 161 #define FXFM_ENCODING_ADOBE_CUSTOM FXFM_ENC_TAG('A', 'D', 'B', 'C')
151 #define FXFM_ENCODING_ADOBE_LATIN_1 FXFM_ENC_TAG('l', 'a', 't', '1') 162 #define FXFM_ENCODING_ADOBE_LATIN_1 FXFM_ENC_TAG('l', 'a', 't', '1')
152 #define FXFM_ENCODING_OLD_LATIN_2 FXFM_ENC_TAG('l', 'a', 't', '2') 163 #define FXFM_ENCODING_OLD_LATIN_2 FXFM_ENC_TAG('l', 'a', 't', '2')
153 #define FXFM_ENCODING_APPLE_ROMAN FXFM_ENC_TAG('a', 'r', 'm', 'n') 164 #define FXFM_ENCODING_APPLE_ROMAN FXFM_ENC_TAG('a', 'r', 'm', 'n')
154 165
166 #endif
155 class CFX_UnicodeEncoding { 167 class CFX_UnicodeEncoding {
156 public: 168 public:
157 explicit CFX_UnicodeEncoding(CFX_Font* pFont); 169 explicit CFX_UnicodeEncoding(CFX_Font* pFont);
158 virtual ~CFX_UnicodeEncoding(); 170 virtual ~CFX_UnicodeEncoding();
159 171
160 virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode); 172 virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode);
161 173
162 protected: 174 protected:
163 // Unowned, not nullptr. 175 // Unowned, not nullptr.
164 CFX_Font* m_pFont; 176 CFX_Font* m_pFont;
165 }; 177 };
166 178
179 #ifdef PDF_ENABLE_XFA
167 class CFX_UnicodeEncodingEx : public CFX_UnicodeEncoding { 180 class CFX_UnicodeEncodingEx : public CFX_UnicodeEncoding {
168 public: 181 public:
169 CFX_UnicodeEncodingEx(CFX_Font* pFont, FX_DWORD EncodingID); 182 CFX_UnicodeEncodingEx(CFX_Font* pFont, FX_DWORD EncodingID);
170 ~CFX_UnicodeEncodingEx() override; 183 ~CFX_UnicodeEncodingEx() override;
171 184
172 // CFX_UnicodeEncoding: 185 // CFX_UnicodeEncoding:
173 FX_DWORD GlyphFromCharCode(FX_DWORD charcode) override; 186 FX_DWORD GlyphFromCharCode(FX_DWORD charcode) override;
174 187
175 FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const; 188 FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const;
176 189
177 private: 190 private:
178 FX_DWORD m_nEncodingID; 191 FX_DWORD m_nEncodingID;
179 }; 192 };
180 193
181 CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx( 194 CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx(
182 CFX_Font* pFont, 195 CFX_Font* pFont,
183 FX_DWORD nEncodingID = FXFM_ENCODING_NONE); 196 FX_DWORD nEncodingID = FXFM_ENCODING_NONE);
184 197
198 #endif
185 #define FXFONT_SUBST_MM 0x01 199 #define FXFONT_SUBST_MM 0x01
186 #define FXFONT_SUBST_GLYPHPATH 0x04 200 #define FXFONT_SUBST_GLYPHPATH 0x04
187 #define FXFONT_SUBST_CLEARTYPE 0x08 201 #define FXFONT_SUBST_CLEARTYPE 0x08
188 #define FXFONT_SUBST_TRANSFORM 0x10 202 #define FXFONT_SUBST_TRANSFORM 0x10
189 #define FXFONT_SUBST_NONSYMBOL 0x20 203 #define FXFONT_SUBST_NONSYMBOL 0x20
190 #define FXFONT_SUBST_EXACT 0x40 204 #define FXFONT_SUBST_EXACT 0x40
191 #define FXFONT_SUBST_STANDARD 0x80 205 #define FXFONT_SUBST_STANDARD 0x80
192 206
193 class CFX_SubstFont { 207 class CFX_SubstFont {
194 public: 208 public:
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 m_pFontEnumerator = pFontEnumerator; 314 m_pFontEnumerator = pFontEnumerator;
301 } 315 }
302 IFX_FontEnumerator* GetFontEnumerator() const { return m_pFontEnumerator; } 316 IFX_FontEnumerator* GetFontEnumerator() const { return m_pFontEnumerator; }
303 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, 317 FXFT_Face FindSubstFont(const CFX_ByteString& face_name,
304 FX_BOOL bTrueType, 318 FX_BOOL bTrueType,
305 FX_DWORD flags, 319 FX_DWORD flags,
306 int weight, 320 int weight,
307 int italic_angle, 321 int italic_angle,
308 int CharsetCP, 322 int CharsetCP,
309 CFX_SubstFont* pSubstFont); 323 CFX_SubstFont* pSubstFont);
324 #ifdef PDF_ENABLE_XFA
310 FXFT_Face FindSubstFontByUnicode(FX_DWORD dwUnicode, 325 FXFT_Face FindSubstFontByUnicode(FX_DWORD dwUnicode,
311 FX_DWORD flags, 326 FX_DWORD flags,
312 int weight, 327 int weight,
313 int italic_angle); 328 int italic_angle);
314 FX_BOOL IsBuiltinFace(const FXFT_Face face) const; 329 FX_BOOL IsBuiltinFace(const FXFT_Face face) const;
330 #endif
315 331
316 private: 332 private:
317 static const size_t MM_FACE_COUNT = 2; 333 static const size_t MM_FACE_COUNT = 2;
318 static const size_t FOXIT_FACE_COUNT = 14; 334 static const size_t FOXIT_FACE_COUNT = 14;
319 335
320 CFX_ByteString GetPSNameFromTT(void* hFont); 336 CFX_ByteString GetPSNameFromTT(void* hFont);
321 CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_name); 337 CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_name);
322 FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont, 338 FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont,
323 int iBaseFont, 339 int iBaseFont,
324 int italic_angle, 340 int italic_angle,
(...skipping 16 matching lines...) Expand all
341 static IFX_SystemFontInfo* CreateDefault(const char** pUserPaths); 357 static IFX_SystemFontInfo* CreateDefault(const char** pUserPaths);
342 virtual void Release() = 0; 358 virtual void Release() = 0;
343 359
344 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; 360 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0;
345 virtual void* MapFont(int weight, 361 virtual void* MapFont(int weight,
346 FX_BOOL bItalic, 362 FX_BOOL bItalic,
347 int charset, 363 int charset,
348 int pitch_family, 364 int pitch_family,
349 const FX_CHAR* face, 365 const FX_CHAR* face,
350 int& iExact) = 0; 366 int& iExact) = 0;
367 #ifdef PDF_ENABLE_XFA
351 virtual void* MapFontByUnicode(FX_DWORD dwUnicode, 368 virtual void* MapFontByUnicode(FX_DWORD dwUnicode,
352 int weight, 369 int weight,
353 FX_BOOL bItalic, 370 FX_BOOL bItalic,
354 int pitch_family) { 371 int pitch_family) {
355 return NULL; 372 return NULL;
356 } 373 }
374 #endif
357 virtual void* GetFont(const FX_CHAR* face) = 0; 375 virtual void* GetFont(const FX_CHAR* face) = 0;
358 virtual FX_DWORD GetFontData(void* hFont, 376 virtual FX_DWORD GetFontData(void* hFont,
359 FX_DWORD table, 377 FX_DWORD table,
360 uint8_t* buffer, 378 uint8_t* buffer,
361 FX_DWORD size) = 0; 379 FX_DWORD size) = 0;
362 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0; 380 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0;
363 virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0; 381 virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0;
364 virtual int GetFaceIndex(void* hFont) { return 0; } 382 virtual int GetFaceIndex(void* hFont) { return 0; }
365 virtual void DeleteFont(void* hFont) = 0; 383 virtual void DeleteFont(void* hFont) = 0;
366 virtual void* RetainFont(void* hFont) { return NULL; } 384 virtual void* RetainFont(void* hFont) { return NULL; }
(...skipping 10 matching lines...) Expand all
377 395
378 // IFX_SytemFontInfo: 396 // IFX_SytemFontInfo:
379 void Release() override; 397 void Release() override;
380 FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override; 398 FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override;
381 void* MapFont(int weight, 399 void* MapFont(int weight,
382 FX_BOOL bItalic, 400 FX_BOOL bItalic,
383 int charset, 401 int charset,
384 int pitch_family, 402 int pitch_family,
385 const FX_CHAR* face, 403 const FX_CHAR* face,
386 int& bExact) override; 404 int& bExact) override;
405 #ifdef PDF_ENABLE_XFA
387 void* MapFontByUnicode(FX_DWORD dwUnicode, 406 void* MapFontByUnicode(FX_DWORD dwUnicode,
388 int weight, 407 int weight,
389 FX_BOOL bItalic, 408 FX_BOOL bItalic,
390 int pitch_family) override; 409 int pitch_family) override;
410 #endif
391 void* GetFont(const FX_CHAR* face) override; 411 void* GetFont(const FX_CHAR* face) override;
392 FX_DWORD GetFontData(void* hFont, 412 FX_DWORD GetFontData(void* hFont,
393 FX_DWORD table, 413 FX_DWORD table,
394 uint8_t* buffer, 414 uint8_t* buffer,
395 FX_DWORD size) override; 415 FX_DWORD size) override;
396 void DeleteFont(void* hFont) override; 416 void DeleteFont(void* hFont) override;
397 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; 417 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override;
398 FX_BOOL GetFontCharset(void* hFont, int& charset) override; 418 FX_BOOL GetFontCharset(void* hFont, int& charset) override;
399 419
400 protected: 420 protected:
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 533
514 protected: 534 protected:
515 virtual ~IFX_GSUBTable() {} 535 virtual ~IFX_GSUBTable() {}
516 }; 536 };
517 537
518 CFX_ByteString GetNameFromTT(const uint8_t* name_table, FX_DWORD name); 538 CFX_ByteString GetNameFromTT(const uint8_t* name_table, FX_DWORD name);
519 539
520 int PDF_GetStandardFontName(CFX_ByteString* name); 540 int PDF_GetStandardFontName(CFX_ByteString* name);
521 541
522 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ 542 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698