diff options
author | Tom Sepez <tsepez@chromium.org> | 2018-06-13 17:55:36 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-06-13 17:55:36 +0000 |
commit | c6fd4d7dddd83d111e98a1ddc46bc7aa80e05933 (patch) | |
tree | 46e6a0c566d08edc0aceb4ccf4c76ea984cb407f /core | |
parent | dae73f540c2aac24d94794f63a2142b1a9c91574 (diff) | |
download | pdfium-c6fd4d7dddd83d111e98a1ddc46bc7aa80e05933.tar.xz |
Guard some non-windows only code in cfx_font with ifdefs.
The callers are all in blocks controlled by the same ifdef.
Change-Id: I2bf1dfd8725eefcfab5b05460fc31b0e7e08c75e
Reviewed-on: https://pdfium-review.googlesource.com/35090
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/fxge/cfx_font.cpp | 38 | ||||
-rw-r--r-- | core/fxge/cfx_font.h | 2 |
2 files changed, 21 insertions, 19 deletions
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp index 08e33d6397..bda576777e 100644 --- a/core/fxge/cfx_font.cpp +++ b/core/fxge/cfx_font.cpp @@ -306,6 +306,24 @@ CFX_Font::CFX_Font() } #ifdef PDF_ENABLE_XFA +bool CFX_Font::LoadFile(const RetainPtr<IFX_SeekableReadStream>& pFile, + int nFaceIndex) { + m_bEmbedded = false; + + CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); + pFontMgr->InitFTLibrary(); + + FXFT_Library library = pFontMgr->GetFTLibrary(); + std::unique_ptr<FXFT_StreamRec> stream; + if (!LoadFileImp(library, &m_Face, pFile, nFaceIndex, &stream)) + return false; + + m_pOwnedStream = std::move(stream); + FXFT_Set_Pixel_Sizes(m_Face, 0, 64); + return true; +} + +#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_ void CFX_Font::SetFace(FXFT_Face face) { ClearFaceCache(); m_Face = face; @@ -314,6 +332,7 @@ void CFX_Font::SetFace(FXFT_Face face) { void CFX_Font::SetSubstFont(std::unique_ptr<CFX_SubstFont> subst) { m_pSubstFont = std::move(subst); } +#endif // _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_ #endif // PDF_ENABLE_XFA CFX_Font::~CFX_Font() { @@ -353,25 +372,6 @@ void CFX_Font::LoadSubst(const ByteString& face_name, } } -#ifdef PDF_ENABLE_XFA -bool CFX_Font::LoadFile(const RetainPtr<IFX_SeekableReadStream>& pFile, - int nFaceIndex) { - m_bEmbedded = false; - - CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); - pFontMgr->InitFTLibrary(); - - FXFT_Library library = pFontMgr->GetFTLibrary(); - std::unique_ptr<FXFT_StreamRec> stream; - if (!LoadFileImp(library, &m_Face, pFile, nFaceIndex, &stream)) - return false; - - m_pOwnedStream = std::move(stream); - FXFT_Set_Pixel_Sizes(m_Face, 0, 64); - return true; -} -#endif // PDF_ENABLE_XFA - uint32_t CFX_Font::GetGlyphWidth(uint32_t glyph_index) { if (!m_Face) return 0; diff --git a/core/fxge/cfx_font.h b/core/fxge/cfx_font.h index a5a0057c16..0d858ea5c4 100644 --- a/core/fxge/cfx_font.h +++ b/core/fxge/cfx_font.h @@ -50,8 +50,10 @@ class CFX_Font { #ifdef PDF_ENABLE_XFA bool LoadFile(const RetainPtr<IFX_SeekableReadStream>& pFile, int nFaceIndex); +#if _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_ void SetFace(FXFT_Face face); void SetSubstFont(std::unique_ptr<CFX_SubstFont> subst); +#endif // _FX_PLATFORM_ != _FX_PLATFORM_WINDOWS_ #endif // PDF_ENABLE_XFA const CFX_GlyphBitmap* LoadGlyphBitmap(uint32_t glyph_index, |