| 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_FXGE_INCLUDE_FX_FONT_H_ | 7 #ifndef CORE_FXGE_INCLUDE_FX_FONT_H_ |
| 8 #define CORE_FXGE_INCLUDE_FX_FONT_H_ | 8 #define CORE_FXGE_INCLUDE_FX_FONT_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 void LoadSubst(const CFX_ByteString& face_name, | 79 void LoadSubst(const CFX_ByteString& face_name, |
| 80 FX_BOOL bTrueType, | 80 FX_BOOL bTrueType, |
| 81 uint32_t flags, | 81 uint32_t flags, |
| 82 int weight, | 82 int weight, |
| 83 int italic_angle, | 83 int italic_angle, |
| 84 int CharsetCP, | 84 int CharsetCP, |
| 85 FX_BOOL bVertical = FALSE); | 85 FX_BOOL bVertical = FALSE); |
| 86 | 86 |
| 87 FX_BOOL LoadEmbedded(const uint8_t* data, uint32_t size); | 87 FX_BOOL LoadEmbedded(const uint8_t* data, uint32_t size); |
| 88 FXFT_Face GetFace() const { return m_Face; } | 88 FXFT_Face GetFace() const { return m_Face; } |
| 89 CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; } | 89 CFX_SubstFont* GetSubstFont() const { return m_pSubstFont.get(); } |
| 90 | 90 |
| 91 #ifdef PDF_ENABLE_XFA | 91 #ifdef PDF_ENABLE_XFA |
| 92 FX_BOOL LoadFile(IFX_FileRead* pFile, | 92 FX_BOOL LoadFile(IFX_FileRead* pFile, |
| 93 int nFaceIndex = 0, | 93 int nFaceIndex = 0, |
| 94 int* pFaceCount = nullptr); | 94 int* pFaceCount = nullptr); |
| 95 | 95 |
| 96 FX_BOOL LoadClone(const CFX_Font* pFont); | 96 FX_BOOL LoadClone(const CFX_Font* pFont); |
| 97 void SetFace(FXFT_Face face) { m_Face = face; } | 97 void SetFace(FXFT_Face face) { m_Face = face; } |
| 98 void SetSubstFont(CFX_SubstFont* subst) { m_pSubstFont = subst; } | 98 void SetSubstFont(std::unique_ptr<CFX_SubstFont> subst) { |
| 99 m_pSubstFont = std::move(subst); |
| 100 } |
| 99 #endif // PDF_ENABLE_XFA | 101 #endif // PDF_ENABLE_XFA |
| 100 | 102 |
| 101 CFX_PathData* LoadGlyphPath(uint32_t glyph_index, int dest_width = 0); | 103 CFX_PathData* LoadGlyphPath(uint32_t glyph_index, int dest_width = 0); |
| 102 int GetGlyphWidth(uint32_t glyph_index); | 104 int GetGlyphWidth(uint32_t glyph_index); |
| 103 int GetAscent() const; | 105 int GetAscent() const; |
| 104 int GetDescent() const; | 106 int GetDescent() const; |
| 105 FX_BOOL GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox); | 107 FX_BOOL GetGlyphBBox(uint32_t glyph_index, FX_RECT& bbox); |
| 106 FX_BOOL IsItalic() const; | 108 FX_BOOL IsItalic() const; |
| 107 FX_BOOL IsBold() const; | 109 FX_BOOL IsBold() const; |
| 108 FX_BOOL IsFixedWidth() const; | 110 FX_BOOL IsFixedWidth() const; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 132 CFX_BinaryBuf m_OtfFontData; | 134 CFX_BinaryBuf m_OtfFontData; |
| 133 FX_BOOL m_bLogic; | 135 FX_BOOL m_bLogic; |
| 134 void* m_pOwnedStream; | 136 void* m_pOwnedStream; |
| 135 #endif // PDF_ENABLE_XFA | 137 #endif // PDF_ENABLE_XFA |
| 136 | 138 |
| 137 private: | 139 private: |
| 138 void ReleasePlatformResource(); | 140 void ReleasePlatformResource(); |
| 139 void DeleteFace(); | 141 void DeleteFace(); |
| 140 | 142 |
| 141 FXFT_Face m_Face; | 143 FXFT_Face m_Face; |
| 142 CFX_SubstFont* m_pSubstFont; | 144 std::unique_ptr<CFX_SubstFont> m_pSubstFont; |
| 143 uint8_t* m_pFontDataAllocation; | 145 std::vector<uint8_t> m_pFontDataAllocation; |
| 144 uint8_t* m_pFontData; | 146 uint8_t* m_pFontData; |
| 145 uint8_t* m_pGsubData; | 147 uint8_t* m_pGsubData; |
| 146 uint32_t m_dwSize; | 148 uint32_t m_dwSize; |
| 147 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 149 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
| 148 void* m_pPlatformFont; | 150 void* m_pPlatformFont; |
| 149 #endif | 151 #endif |
| 150 FX_BOOL m_bEmbedded; | 152 FX_BOOL m_bEmbedded; |
| 151 FX_BOOL m_bVertical; | 153 FX_BOOL m_bVertical; |
| 152 }; | 154 }; |
| 153 | 155 |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 }; | 496 }; |
| 495 | 497 |
| 496 class CFX_AutoFontCache { | 498 class CFX_AutoFontCache { |
| 497 public: | 499 public: |
| 498 CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont) | 500 CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont) |
| 499 : m_pFontCache(pFontCache), m_pFont(pFont) {} | 501 : m_pFontCache(pFontCache), m_pFont(pFont) {} |
| 500 ~CFX_AutoFontCache() { m_pFontCache->ReleaseCachedFace(m_pFont); } | 502 ~CFX_AutoFontCache() { m_pFontCache->ReleaseCachedFace(m_pFont); } |
| 501 CFX_FontCache* m_pFontCache; | 503 CFX_FontCache* m_pFontCache; |
| 502 CFX_Font* m_pFont; | 504 CFX_Font* m_pFont; |
| 503 }; | 505 }; |
| 506 |
| 504 #define FX_FONTCACHE_DEFINE(pFontCache, pFont) \ | 507 #define FX_FONTCACHE_DEFINE(pFontCache, pFont) \ |
| 505 CFX_AutoFontCache autoFontCache((pFontCache), (pFont)) | 508 CFX_AutoFontCache autoFontCache((pFontCache), (pFont)) |
| 506 class CFX_GlyphBitmap { | 509 class CFX_GlyphBitmap { |
| 507 public: | 510 public: |
| 508 int m_Top; | 511 int m_Top; |
| 509 int m_Left; | 512 int m_Left; |
| 510 CFX_DIBitmap m_Bitmap; | 513 CFX_DIBitmap m_Bitmap; |
| 511 }; | 514 }; |
| 515 |
| 512 class CFX_FaceCache { | 516 class CFX_FaceCache { |
| 513 public: | 517 public: |
| 514 explicit CFX_FaceCache(FXFT_Face face); | 518 explicit CFX_FaceCache(FXFT_Face face); |
| 515 ~CFX_FaceCache(); | 519 ~CFX_FaceCache(); |
| 516 const CFX_GlyphBitmap* LoadGlyphBitmap(CFX_Font* pFont, | 520 const CFX_GlyphBitmap* LoadGlyphBitmap(CFX_Font* pFont, |
| 517 uint32_t glyph_index, | 521 uint32_t glyph_index, |
| 518 FX_BOOL bFontStyle, | 522 FX_BOOL bFontStyle, |
| 519 const CFX_Matrix* pMatrix, | 523 const CFX_Matrix* pMatrix, |
| 520 int dest_width, | 524 int dest_width, |
| 521 int anti_alias, | 525 int anti_alias, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 FX_FLOAT retinaScaleX = 1.0f, | 576 FX_FLOAT retinaScaleX = 1.0f, |
| 573 FX_FLOAT retinaScaleY = 1.0f); | 577 FX_FLOAT retinaScaleY = 1.0f); |
| 574 | 578 |
| 575 CFX_ByteString GetNameFromTT(const uint8_t* name_table, | 579 CFX_ByteString GetNameFromTT(const uint8_t* name_table, |
| 576 uint32_t name_table_size, | 580 uint32_t name_table_size, |
| 577 uint32_t name); | 581 uint32_t name); |
| 578 | 582 |
| 579 int PDF_GetStandardFontName(CFX_ByteString* name); | 583 int PDF_GetStandardFontName(CFX_ByteString* name); |
| 580 | 584 |
| 581 #endif // CORE_FXGE_INCLUDE_FX_FONT_H_ | 585 #endif // CORE_FXGE_INCLUDE_FX_FONT_H_ |
| OLD | NEW |