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 _FPDF_RESOURCE_ | 7 #ifndef _FPDF_RESOURCE_ |
8 #define _FPDF_RESOURCE_ | 8 #define _FPDF_RESOURCE_ |
9 #ifndef _FPDF_PARSER_ | 9 #ifndef _FPDF_PARSER_ |
10 #include "fpdf_parser.h" | 10 #include "fpdf_parser.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 #define PDFFONT_SYMBOLIC 4 | 69 #define PDFFONT_SYMBOLIC 4 |
70 #define PDFFONT_SCRIPT 8 | 70 #define PDFFONT_SCRIPT 8 |
71 #define PDFFONT_NONSYMBOLIC 32 | 71 #define PDFFONT_NONSYMBOLIC 32 |
72 #define PDFFONT_ITALIC 64 | 72 #define PDFFONT_ITALIC 64 |
73 #define PDFFONT_ALLCAP 0x10000 | 73 #define PDFFONT_ALLCAP 0x10000 |
74 #define PDFFONT_SMALLCAP 0x20000 | 74 #define PDFFONT_SMALLCAP 0x20000 |
75 #define PDFFONT_FORCEBOLD 0x40000 | 75 #define PDFFONT_FORCEBOLD 0x40000 |
76 #define PDFFONT_USEEXTERNATTR 0x80000 | 76 #define PDFFONT_USEEXTERNATTR 0x80000 |
77 FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name); | 77 FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name); |
78 CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode); | 78 CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode); |
79 class CPDF_Font | 79 class CPDF_Font |
80 { | 80 { |
81 public: | 81 public: |
82 | |
83 static CPDF_Font* CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary
* pFontDict); | 82 static CPDF_Font* CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary
* pFontDict); |
84 | |
85 static CPDF_Font* GetStockFont(CPDF_Document* pDoc, FX_BSTR fontna
me); | 83 static CPDF_Font* GetStockFont(CPDF_Document* pDoc, FX_BSTR fontna
me); |
86 | 84 |
87 virtual ~CPDF_Font(); | 85 virtual ~CPDF_Font(); |
88 | 86 |
89 | 87 bool IsFontType(int fonttype) const { return fonttype == m_FontType; } |
90 | 88 int»GetFontType() const { return m_FontType; } |
91 | |
92 int»» » » » » GetFontType() const | |
93 { | |
94 return m_FontType; | |
95 } | |
96 | 89 |
97 CFX_ByteString GetFontTypeName() const; | 90 CFX_ByteString GetFontTypeName() const; |
98 | 91 |
99 const CFX_ByteString& GetBaseFont() const | 92 const CFX_ByteString& GetBaseFont() const |
100 { | 93 { |
101 return m_BaseFont; | 94 return m_BaseFont; |
102 } | 95 } |
103 | 96 |
104 const CFX_SubstFont* GetSubstFont() const | 97 const CFX_SubstFont* GetSubstFont() const |
105 { | 98 { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 242 |
250 virtual void GetCharBBox(FX_DWORD charcode, FX_RECT&
rect, int level = 0) = 0; | 243 virtual void GetCharBBox(FX_DWORD charcode, FX_RECT&
rect, int level = 0) = 0; |
251 | 244 |
252 | 245 |
253 | 246 |
254 CPDF_Document* m_pDocument; | 247 CPDF_Document* m_pDocument; |
255 | 248 |
256 class CFX_PathData* LoadGlyphPath(FX_DWORD charcode, int dest_width
= 0); | 249 class CFX_PathData* LoadGlyphPath(FX_DWORD charcode, int dest_width
= 0); |
257 | 250 |
258 CFX_Font m_Font; | 251 CFX_Font m_Font; |
| 252 |
259 protected: | 253 protected: |
260 | 254 explicit CPDF_Font(int fonttype); |
261 CPDF_Font(); | |
262 | 255 |
263 FX_BOOL Initialize(); | 256 FX_BOOL Initialize(); |
264 | 257 |
265 FX_BOOL Load(); | 258 FX_BOOL Load(); |
266 | 259 |
267 virtual FX_BOOL _Load() = 0; | 260 virtual FX_BOOL _Load() = 0; |
268 | 261 |
269 virtual FX_WCHAR _UnicodeFromCharCode(FX_DWORD charcode) const =
0; | 262 virtual FX_WCHAR _UnicodeFromCharCode(FX_DWORD charcode) const =
0; |
270 | 263 |
271 virtual FX_DWORD _CharCodeFromUnicode(FX_WCHAR Unicode) const = 0
; | 264 virtual FX_DWORD _CharCodeFromUnicode(FX_WCHAR Unicode) const = 0
; |
272 | 265 |
273 void LoadUnicodeMap(); | 266 void LoadUnicodeMap(); |
274 | 267 |
275 void LoadPDFEncoding(CPDF_Object* pEn
coding, int& iBaseEncoding, | 268 void LoadPDFEncoding(CPDF_Object* pEn
coding, int& iBaseEncoding, |
276 CFX_ByteString*& pCharNames, FX_BOOL
bEmbedded, FX_BOOL bTrueType); | 269 CFX_ByteString*& pCharNames, FX_BOOL
bEmbedded, FX_BOOL bTrueType); |
277 | 270 |
278 void LoadFontDescriptor(CPDF_Dictiona
ry*); | 271 void LoadFontDescriptor(CPDF_Dictiona
ry*); |
279 | 272 |
280 void LoadCharWidths(FX_WORD* pWidths)
; | 273 void LoadCharWidths(FX_WORD* pWidths)
; |
281 | 274 |
282 void CheckFontMetrics(); | 275 void CheckFontMetrics(); |
283 | 276 |
284 CFX_CharMap* m_pCharMap; | 277 CFX_CharMap* m_pCharMap; |
285 | 278 |
286 | 279 |
287 | 280 |
288 int m_FontType; | |
289 | |
290 CFX_ByteString m_BaseFont; | 281 CFX_ByteString m_BaseFont; |
291 | 282 |
292 CPDF_StreamAcc* m_pFontFile; | 283 CPDF_StreamAcc* m_pFontFile; |
293 | 284 |
294 CPDF_Dictionary* m_pFontDict; | 285 CPDF_Dictionary* m_pFontDict; |
295 | 286 |
296 CPDF_ToUnicodeMap* m_pToUnicodeMap; | 287 CPDF_ToUnicodeMap* m_pToUnicodeMap; |
297 | 288 |
298 FX_BOOL m_bToUnicodeLoaded; | 289 FX_BOOL m_bToUnicodeLoaded; |
299 | 290 |
300 | 291 |
301 | 292 |
302 | 293 |
303 int m_Flags; | 294 int m_Flags; |
304 | 295 |
305 FX_RECT m_FontBBox; | 296 FX_RECT m_FontBBox; |
306 | 297 |
307 int m_StemV; | 298 int m_StemV; |
308 | 299 |
309 int m_Ascent; | 300 int m_Ascent; |
310 | 301 |
311 int m_Descent; | 302 int m_Descent; |
312 | 303 |
313 int m_ItalicAngle; | 304 int m_ItalicAngle; |
314 | 305 |
| 306 private: |
| 307 const int m_FontType; |
315 }; | 308 }; |
316 #define PDFFONT_ENCODING_BUILTIN 0 | 309 #define PDFFONT_ENCODING_BUILTIN 0 |
317 #define PDFFONT_ENCODING_WINANSI 1 | 310 #define PDFFONT_ENCODING_WINANSI 1 |
318 #define PDFFONT_ENCODING_MACROMAN 2 | 311 #define PDFFONT_ENCODING_MACROMAN 2 |
319 #define PDFFONT_ENCODING_MACEXPERT 3 | 312 #define PDFFONT_ENCODING_MACEXPERT 3 |
320 #define PDFFONT_ENCODING_STANDARD 4 | 313 #define PDFFONT_ENCODING_STANDARD 4 |
321 #define PDFFONT_ENCODING_ADOBE_SYMBOL 5 | 314 #define PDFFONT_ENCODING_ADOBE_SYMBOL 5 |
322 #define PDFFONT_ENCODING_ZAPFDINGBATS 6 | 315 #define PDFFONT_ENCODING_ZAPFDINGBATS 6 |
323 #define PDFFONT_ENCODING_PDFDOC 7 | 316 #define PDFFONT_ENCODING_PDFDOC 7 |
324 #define PDFFONT_ENCODING_MS_SYMBOL 8 | 317 #define PDFFONT_ENCODING_MS_SYMBOL 8 |
(...skipping 23 matching lines...) Expand all Loading... |
348 } | 341 } |
349 | 342 |
350 CPDF_Object* Realize(); | 343 CPDF_Object* Realize(); |
351 public: | 344 public: |
352 | 345 |
353 FX_WCHAR m_Unicodes[256]; | 346 FX_WCHAR m_Unicodes[256]; |
354 }; | 347 }; |
355 class CPDF_SimpleFont : public CPDF_Font | 348 class CPDF_SimpleFont : public CPDF_Font |
356 { | 349 { |
357 public: | 350 public: |
358 | 351 explicit CPDF_SimpleFont(int fonttype); |
359 CPDF_SimpleFont(); | 352 ~CPDF_SimpleFont() override; |
360 | |
361 virtual ~CPDF_SimpleFont(); | |
362 | 353 |
363 CPDF_FontEncoding* GetEncoding() | 354 CPDF_FontEncoding* GetEncoding() |
364 { | 355 { |
365 return &m_Encoding; | 356 return &m_Encoding; |
366 } | 357 } |
367 virtual int GetCharWidthF(FX_DWORD charcode, int lev
el = 0); | 358 virtual int GetCharWidthF(FX_DWORD charcode, int lev
el = 0); |
368 virtual void GetCharBBox(FX_DWORD charcode, FX_RECT&
rect, int level = 0); | 359 virtual void GetCharBBox(FX_DWORD charcode, FX_RECT&
rect, int level = 0); |
369 virtual int GlyphFromCharCode(FX_DWORD charcode, FX_
BOOL *pVertGlyph = NULL); | 360 virtual int GlyphFromCharCode(FX_DWORD charcode, FX_
BOOL *pVertGlyph = NULL); |
370 virtual FX_BOOL IsUnicodeCompatible() const; | 361 virtual FX_BOOL IsUnicodeCompatible() const; |
371 protected: | 362 protected: |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 | 453 |
463 | 454 |
464 int m_Width; | 455 int m_Width; |
465 | 456 |
466 FX_RECT m_BBox; | 457 FX_RECT m_BBox; |
467 }; | 458 }; |
468 class CPDF_Type3Font : public CPDF_SimpleFont | 459 class CPDF_Type3Font : public CPDF_SimpleFont |
469 { | 460 { |
470 public: | 461 public: |
471 CPDF_Type3Font(); | 462 CPDF_Type3Font(); |
472 virtual ~CPDF_Type3Font(); | 463 ~CPDF_Type3Font() override; |
473 void SetPageResources(CPDF_Dictionary
* pResources) | 464 void SetPageResources(CPDF_Dictionary
* pResources) |
474 { | 465 { |
475 m_pPageResources = pResources; | 466 m_pPageResources = pResources; |
476 } | 467 } |
477 CPDF_Type3Char* LoadChar(FX_DWORD charcode, int level =
0); | 468 CPDF_Type3Char* LoadChar(FX_DWORD charcode, int level =
0); |
478 virtual int GetCharWidthF(FX_DWORD charcode, int lev
el = 0); | 469 virtual int GetCharWidthF(FX_DWORD charcode, int lev
el = 0); |
479 virtual int GetCharTypeWidth(FX_DWORD charcode) | 470 virtual int GetCharTypeWidth(FX_DWORD charcode) |
480 { | 471 { |
481 return GetCharWidthF(charcode); | 472 return GetCharWidthF(charcode); |
482 } | 473 } |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 FX_BOOL m_bIsMask; | 940 FX_BOOL m_bIsMask; |
950 | 941 |
951 FX_BOOL m_bInterpolate; | 942 FX_BOOL m_bInterpolate; |
952 | 943 |
953 CPDF_Document* m_pDocument; | 944 CPDF_Document* m_pDocument; |
954 | 945 |
955 CPDF_Dictionary* m_pOC; | 946 CPDF_Dictionary* m_pOC; |
956 CPDF_Dictionary* InitJPEG(FX_LPBYTE pData, FX_DWORD size); | 947 CPDF_Dictionary* InitJPEG(FX_LPBYTE pData, FX_DWORD size); |
957 }; | 948 }; |
958 #endif | 949 #endif |
OLD | NEW |