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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 class CPDF_Font | 79 class CPDF_Font |
80 { | 80 { |
81 public: | 81 public: |
82 | 82 |
83 static CPDF_Font* CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary * pFontDict); | 83 static CPDF_Font* CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary * pFontDict); |
84 | 84 |
85 static CPDF_Font* GetStockFont(CPDF_Document* pDoc, FX_BSTR fontna me); | 85 static CPDF_Font* GetStockFont(CPDF_Document* pDoc, FX_BSTR fontna me); |
86 | 86 |
87 virtual ~CPDF_Font(); | 87 virtual ~CPDF_Font(); |
88 | 88 |
89 | 89 bool IsFontType(int fonttype) const { return fonttype == m_FontType; } |
90 | 90 int»GetFontType() const { return m_FontType; } |
91 | |
92 int»» » » » » GetFontType() const | |
93 { | |
94 return m_FontType; | |
95 } | |
96 | 91 |
97 CFX_ByteString GetFontTypeName() const; | 92 CFX_ByteString GetFontTypeName() const; |
98 | 93 |
99 const CFX_ByteString& GetBaseFont() const | 94 const CFX_ByteString& GetBaseFont() const |
100 { | 95 { |
101 return m_BaseFont; | 96 return m_BaseFont; |
102 } | 97 } |
103 | 98 |
104 const CFX_SubstFont* GetSubstFont() const | 99 const CFX_SubstFont* GetSubstFont() const |
105 { | 100 { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 | 244 |
250 virtual void GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level = 0) = 0; | 245 virtual void GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level = 0) = 0; |
251 | 246 |
252 | 247 |
253 | 248 |
254 CPDF_Document* m_pDocument; | 249 CPDF_Document* m_pDocument; |
255 | 250 |
256 class CFX_PathData* LoadGlyphPath(FX_DWORD charcode, int dest_width = 0); | 251 class CFX_PathData* LoadGlyphPath(FX_DWORD charcode, int dest_width = 0); |
257 | 252 |
258 CFX_Font m_Font; | 253 CFX_Font m_Font; |
254 | |
259 protected: | 255 protected: |
260 | 256 CPDF_Font(int fonttype); |
Lei Zhang
2015/04/17 19:40:59
explicit, also CPDF_SimpleFont below
Tom Sepez
2015/04/17 19:50:26
Done.
| |
261 CPDF_Font(); | |
262 | 257 |
263 FX_BOOL Initialize(); | 258 FX_BOOL Initialize(); |
264 | 259 |
265 FX_BOOL Load(); | 260 FX_BOOL Load(); |
266 | 261 |
267 virtual FX_BOOL _Load() = 0; | 262 virtual FX_BOOL _Load() = 0; |
268 | 263 |
269 virtual FX_WCHAR _UnicodeFromCharCode(FX_DWORD charcode) const = 0; | 264 virtual FX_WCHAR _UnicodeFromCharCode(FX_DWORD charcode) const = 0; |
270 | 265 |
271 virtual FX_DWORD _CharCodeFromUnicode(FX_WCHAR Unicode) const = 0 ; | 266 virtual FX_DWORD _CharCodeFromUnicode(FX_WCHAR Unicode) const = 0 ; |
272 | 267 |
273 void LoadUnicodeMap(); | 268 void LoadUnicodeMap(); |
274 | 269 |
275 void LoadPDFEncoding(CPDF_Object* pEn coding, int& iBaseEncoding, | 270 void LoadPDFEncoding(CPDF_Object* pEn coding, int& iBaseEncoding, |
276 CFX_ByteString*& pCharNames, FX_BOOL bEmbedded, FX_BOOL bTrueType); | 271 CFX_ByteString*& pCharNames, FX_BOOL bEmbedded, FX_BOOL bTrueType); |
277 | 272 |
278 void LoadFontDescriptor(CPDF_Dictiona ry*); | 273 void LoadFontDescriptor(CPDF_Dictiona ry*); |
279 | 274 |
280 void LoadCharWidths(FX_WORD* pWidths) ; | 275 void LoadCharWidths(FX_WORD* pWidths) ; |
281 | 276 |
282 void CheckFontMetrics(); | 277 void CheckFontMetrics(); |
283 | 278 |
284 CFX_CharMap* m_pCharMap; | 279 CFX_CharMap* m_pCharMap; |
285 | 280 |
286 | 281 |
287 | 282 |
288 int m_FontType; | |
289 | |
290 CFX_ByteString m_BaseFont; | 283 CFX_ByteString m_BaseFont; |
291 | 284 |
292 CPDF_StreamAcc* m_pFontFile; | 285 CPDF_StreamAcc* m_pFontFile; |
293 | 286 |
294 CPDF_Dictionary* m_pFontDict; | 287 CPDF_Dictionary* m_pFontDict; |
295 | 288 |
296 CPDF_ToUnicodeMap* m_pToUnicodeMap; | 289 CPDF_ToUnicodeMap* m_pToUnicodeMap; |
297 | 290 |
298 FX_BOOL m_bToUnicodeLoaded; | 291 FX_BOOL m_bToUnicodeLoaded; |
299 | 292 |
300 | 293 |
301 | 294 |
302 | 295 |
303 int m_Flags; | 296 int m_Flags; |
304 | 297 |
305 FX_RECT m_FontBBox; | 298 FX_RECT m_FontBBox; |
306 | 299 |
307 int m_StemV; | 300 int m_StemV; |
308 | 301 |
309 int m_Ascent; | 302 int m_Ascent; |
310 | 303 |
311 int m_Descent; | 304 int m_Descent; |
312 | 305 |
313 int m_ItalicAngle; | 306 int m_ItalicAngle; |
314 | 307 |
308 private: | |
309 int m_FontType; | |
Lei Zhang
2015/04/17 19:40:59
This can be const since we never change it, right?
Tom Sepez
2015/04/17 19:50:26
Done.
| |
315 }; | 310 }; |
316 #define PDFFONT_ENCODING_BUILTIN 0 | 311 #define PDFFONT_ENCODING_BUILTIN 0 |
317 #define PDFFONT_ENCODING_WINANSI 1 | 312 #define PDFFONT_ENCODING_WINANSI 1 |
318 #define PDFFONT_ENCODING_MACROMAN 2 | 313 #define PDFFONT_ENCODING_MACROMAN 2 |
319 #define PDFFONT_ENCODING_MACEXPERT 3 | 314 #define PDFFONT_ENCODING_MACEXPERT 3 |
320 #define PDFFONT_ENCODING_STANDARD 4 | 315 #define PDFFONT_ENCODING_STANDARD 4 |
321 #define PDFFONT_ENCODING_ADOBE_SYMBOL 5 | 316 #define PDFFONT_ENCODING_ADOBE_SYMBOL 5 |
322 #define PDFFONT_ENCODING_ZAPFDINGBATS 6 | 317 #define PDFFONT_ENCODING_ZAPFDINGBATS 6 |
323 #define PDFFONT_ENCODING_PDFDOC 7 | 318 #define PDFFONT_ENCODING_PDFDOC 7 |
324 #define PDFFONT_ENCODING_MS_SYMBOL 8 | 319 #define PDFFONT_ENCODING_MS_SYMBOL 8 |
(...skipping 23 matching lines...) Expand all Loading... | |
348 } | 343 } |
349 | 344 |
350 CPDF_Object* Realize(); | 345 CPDF_Object* Realize(); |
351 public: | 346 public: |
352 | 347 |
353 FX_WCHAR m_Unicodes[256]; | 348 FX_WCHAR m_Unicodes[256]; |
354 }; | 349 }; |
355 class CPDF_SimpleFont : public CPDF_Font | 350 class CPDF_SimpleFont : public CPDF_Font |
356 { | 351 { |
357 public: | 352 public: |
358 | 353 CPDF_SimpleFont(int fonttype); |
359 CPDF_SimpleFont(); | |
360 | 354 |
361 virtual ~CPDF_SimpleFont(); | 355 virtual ~CPDF_SimpleFont(); |
362 | 356 |
363 CPDF_FontEncoding* GetEncoding() | 357 CPDF_FontEncoding* GetEncoding() |
364 { | 358 { |
365 return &m_Encoding; | 359 return &m_Encoding; |
366 } | 360 } |
367 virtual int GetCharWidthF(FX_DWORD charcode, int lev el = 0); | 361 virtual int GetCharWidthF(FX_DWORD charcode, int lev el = 0); |
368 virtual void GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level = 0); | 362 virtual void GetCharBBox(FX_DWORD charcode, FX_RECT& rect, int level = 0); |
369 virtual int GlyphFromCharCode(FX_DWORD charcode, FX_ BOOL *pVertGlyph = NULL); | 363 virtual int GlyphFromCharCode(FX_DWORD charcode, FX_ BOOL *pVertGlyph = NULL); |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
949 FX_BOOL m_bIsMask; | 943 FX_BOOL m_bIsMask; |
950 | 944 |
951 FX_BOOL m_bInterpolate; | 945 FX_BOOL m_bInterpolate; |
952 | 946 |
953 CPDF_Document* m_pDocument; | 947 CPDF_Document* m_pDocument; |
954 | 948 |
955 CPDF_Dictionary* m_pOC; | 949 CPDF_Dictionary* m_pOC; |
956 CPDF_Dictionary* InitJPEG(FX_LPBYTE pData, FX_DWORD size); | 950 CPDF_Dictionary* InitJPEG(FX_LPBYTE pData, FX_DWORD size); |
957 }; | 951 }; |
958 #endif | 952 #endif |
OLD | NEW |