diff options
Diffstat (limited to 'core/fxge/cfx_font.h')
-rw-r--r-- | core/fxge/cfx_font.h | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h index 5bd93ea7e1..9293fd7d66 100644 --- a/core/fxge/cfx_font.h +++ b/core/fxge/cfx_font.h @@ -14,6 +14,7 @@ #include "core/fxcrt/fx_coordinates.h" #include "core/fxcrt/unowned_ptr.h" #include "core/fxge/fx_freetype.h" +#include "third_party/base/span.h" #if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_ #include "core/fxge/fx_font.h" @@ -43,8 +44,8 @@ class CFX_Font { int CharsetCP, bool bVertical); - bool LoadEmbedded(const uint8_t* data, uint32_t size); - FXFT_Face GetFace() const { return m_Face; } + bool LoadEmbedded(pdfium::span<const uint8_t> src_span); + FXFT_Face GetFace() const { return m_Face.Get(); } CFX_SubstFont* GetSubstFont() const { return m_pSubstFont.get(); } #ifdef PDF_ENABLE_XFA @@ -85,16 +86,14 @@ class CFX_Font { bool IsEmbedded() const { return m_bEmbedded; } uint8_t* GetSubData() const { return m_pGsubData.get(); } void SetSubData(uint8_t* data) { m_pGsubData.reset(data); } + pdfium::span<uint8_t> GetFontSpan() const { return m_FontData; } + void AdjustMMParams(int glyph_index, int dest_width, int weight) const; + CFX_PathData* LoadGlyphPathImpl(uint32_t glyph_index, + uint32_t dest_width) const; #if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ void* GetPlatformFont() const { return m_pPlatformFont; } void SetPlatformFont(void* font) { m_pPlatformFont = font; } #endif - uint8_t* GetFontData() const { return m_pFontData; } - uint32_t GetSize() const { return m_dwSize; } - void AdjustMMParams(int glyph_index, int dest_width, int weight) const; - - CFX_PathData* LoadGlyphPathImpl(uint32_t glyph_index, - uint32_t dest_width) const; static const size_t kAngleSkewArraySize = 30; static const char s_AngleSkew[kAngleSkewArraySize]; @@ -123,24 +122,23 @@ class CFX_Font { private: CFX_FaceCache* GetFaceCache() const; + void DeleteFace(); + void ClearFaceCache(); #if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ void ReleasePlatformResource(); #endif // _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ - void DeleteFace(); - void ClearFaceCache(); - FXFT_Face m_Face; + mutable UnownedPtr<FXFT_FaceRec> m_Face; mutable UnownedPtr<CFX_FaceCache> m_FaceCache; std::unique_ptr<CFX_SubstFont> m_pSubstFont; - std::vector<uint8_t> m_pFontDataAllocation; - uint8_t* m_pFontData; std::unique_ptr<uint8_t, FxFreeDeleter> m_pGsubData; - uint32_t m_dwSize; + std::vector<uint8_t> m_pFontDataAllocation; + pdfium::span<uint8_t> m_FontData; + bool m_bEmbedded = false; + bool m_bVertical = false; #if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_ - void* m_pPlatformFont; + void* m_pPlatformFont = nullptr; #endif - bool m_bEmbedded; - bool m_bVertical; }; #endif // CORE_FXGE_CFX_FONT_H_ |