From d19e912dd469e4bdad9f3020e1f6eb98f10f3470 Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 2 Nov 2016 15:43:18 -0700 Subject: Remove FX_BOOL from xfa. Review-Url: https://codereview.chromium.org/2467203003 --- xfa/fgas/font/fgas_font.h | 2 +- xfa/fgas/font/fgas_gefont.cpp | 114 +++++++++++++++++++------------------- xfa/fgas/font/fgas_gefont.h | 52 +++++++++-------- xfa/fgas/font/fgas_stdfontmgr.cpp | 62 ++++++++++----------- xfa/fgas/font/fgas_stdfontmgr.h | 12 ++-- 5 files changed, 118 insertions(+), 124 deletions(-) (limited to 'xfa/fgas/font') diff --git a/xfa/fgas/font/fgas_font.h b/xfa/fgas/font/fgas_font.h index 07bfc1daea..dbc4ec2f3b 100644 --- a/xfa/fgas/font/fgas_font.h +++ b/xfa/fgas/font/fgas_font.h @@ -111,7 +111,7 @@ class IFGAS_FontMgr { const FX_WCHAR* pszFontAlias = nullptr, uint32_t dwFontStyles = 0, uint16_t wCodePage = 0, - FX_BOOL bSaveStream = FALSE) = 0; + bool bSaveStream = false) = 0; virtual CFGAS_GEFont* LoadFont(CFGAS_GEFont* pSrcFont, uint32_t dwFontStyles, uint16_t wCodePage = 0xFFFF) = 0; diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp index d83db63343..b78cfe516a 100644 --- a/xfa/fgas/font/fgas_gefont.cpp +++ b/xfa/fgas/font/fgas_gefont.cpp @@ -73,7 +73,7 @@ CFGAS_GEFont* CFGAS_GEFont::LoadFont(const uint8_t* pBuffer, // static CFGAS_GEFont* CFGAS_GEFont::LoadFont(IFX_Stream* pFontStream, IFGAS_FontMgr* pFontMgr, - FX_BOOL bSaveStream) { + bool bSaveStream) { CFGAS_GEFont* pFont = new CFGAS_GEFont(pFontMgr); if (!pFont->LoadFontInternal(pFontStream, bSaveStream)) { pFont->Release(); @@ -86,7 +86,7 @@ CFGAS_GEFont* CFGAS_GEFont::LoadFont(IFX_Stream* pFontStream, CFGAS_GEFont::CFGAS_GEFont(IFGAS_FontMgr* pFontMgr) : #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - m_bUseLogFontStyle(FALSE), + m_bUseLogFontStyle(false), m_dwLogFontStyle(0), #endif m_pFont(nullptr), @@ -100,7 +100,7 @@ CFGAS_GEFont::CFGAS_GEFont(IFGAS_FontMgr* pFontMgr) CFGAS_GEFont::CFGAS_GEFont(CFGAS_GEFont* src, uint32_t dwFontStyles) : #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - m_bUseLogFontStyle(FALSE), + m_bUseLogFontStyle(false), m_dwLogFontStyle(0), #endif m_pFont(nullptr), @@ -156,11 +156,11 @@ CFGAS_GEFont* CFGAS_GEFont::Retain() { } #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL CFGAS_GEFont::LoadFontInternal(const FX_WCHAR* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { +bool CFGAS_GEFont::LoadFontInternal(const FX_WCHAR* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { if (m_pFont) { - return FALSE; + return false; } CFX_ByteString csFontFamily; if (pszFontFamily) { @@ -198,64 +198,62 @@ FX_BOOL CFGAS_GEFont::LoadFontInternal(const FX_WCHAR* pszFontFamily, } else if (dwFlags & FXFONT_ITALIC) { csFontFamily += ",Italic"; } - m_pFont->LoadSubst(csFontFamily, TRUE, dwFlags, iWeight, 0, wCodePage, false); + m_pFont->LoadSubst(csFontFamily, true, dwFlags, iWeight, 0, wCodePage, false); if (!m_pFont->GetFace()) return false; return InitFont(); } -FX_BOOL CFGAS_GEFont::LoadFontInternal(const uint8_t* pBuffer, int32_t length) { +bool CFGAS_GEFont::LoadFontInternal(const uint8_t* pBuffer, int32_t length) { if (m_pFont) - return FALSE; + return false; m_pFont = new CFX_Font; if (!m_pFont->LoadEmbedded(pBuffer, length)) - return FALSE; + return false; return InitFont(); } -FX_BOOL CFGAS_GEFont::LoadFontInternal(IFX_Stream* pFontStream, - FX_BOOL bSaveStream) { +bool CFGAS_GEFont::LoadFontInternal(IFX_Stream* pFontStream, bool bSaveStream) { if (m_pFont || m_pFileRead || !pFontStream || pFontStream->GetLength() < 1) - return FALSE; + return false; if (bSaveStream) m_pStream.reset(pFontStream); - m_pFileRead.reset(FX_CreateFileRead(pFontStream, FALSE)); + m_pFileRead.reset(FX_CreateFileRead(pFontStream, false)); m_pFont = new CFX_Font; if (m_pFont->LoadFile(m_pFileRead.get())) return InitFont(); m_pFileRead.reset(); - return FALSE; + return false; } #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -FX_BOOL CFGAS_GEFont::LoadFontInternal(CFX_Font* pExternalFont) { +bool CFGAS_GEFont::LoadFontInternal(CFX_Font* pExternalFont) { if (m_pFont || !pExternalFont) - return FALSE; + return false; m_pFont = pExternalFont; m_bExternalFont = true; return InitFont(); } -FX_BOOL CFGAS_GEFont::LoadFontInternal( - std::unique_ptr pInternalFont) { +bool CFGAS_GEFont::LoadFontInternal(std::unique_ptr pInternalFont) { if (m_pFont || !pInternalFont) - return FALSE; + return false; m_pFont = pInternalFont.release(); m_bExternalFont = false; return InitFont(); } -FX_BOOL CFGAS_GEFont::InitFont() { +bool CFGAS_GEFont::InitFont() { if (!m_pFont) - return FALSE; + return false; if (!m_pFontEncoding) { m_pFontEncoding.reset(FX_CreateFontEncodingEx(m_pFont)); if (!m_pFontEncoding) - return FALSE; + return false; } if (!m_pCharWidthMap) m_pCharWidthMap.reset(new CFX_DiscreteArrayTemplate(1024)); @@ -264,7 +262,7 @@ FX_BOOL CFGAS_GEFont::InitFont() { if (!m_pBBoxMap) m_pBBoxMap.reset(new CFX_MapPtrToPtr(16)); - return TRUE; + return true; } CFGAS_GEFont* CFGAS_GEFont::Derive(uint32_t dwFontStyles, uint16_t wCodePage) { @@ -306,28 +304,28 @@ uint32_t CFGAS_GEFont::GetFontStyles() const { return dwStyles; } -FX_BOOL CFGAS_GEFont::GetCharWidth(FX_WCHAR wUnicode, - int32_t& iWidth, - bool bCharCode) { +bool CFGAS_GEFont::GetCharWidth(FX_WCHAR wUnicode, + int32_t& iWidth, + bool bCharCode) { return GetCharWidthInternal(wUnicode, iWidth, true, bCharCode); } -FX_BOOL CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode, - int32_t& iWidth, - bool bRecursive, - bool bCharCode) { +bool CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode, + int32_t& iWidth, + bool bRecursive, + bool bCharCode) { ASSERT(m_pCharWidthMap); iWidth = m_pCharWidthMap->GetAt(wUnicode, 0); if (iWidth == 65535) - return FALSE; + return false; if (iWidth > 0) - return TRUE; + return true; if (!m_pProvider || !m_pProvider->GetCharWidth(this, wUnicode, bCharCode, &iWidth)) { CFGAS_GEFont* pFont = nullptr; - int32_t iGlyph = GetGlyphIndex(wUnicode, TRUE, &pFont, bCharCode); + int32_t iGlyph = GetGlyphIndex(wUnicode, true, &pFont, bCharCode); if (iGlyph != 0xFFFF && pFont) { if (pFont == this) { iWidth = m_pFont->GetGlyphWidth(iGlyph); @@ -336,7 +334,7 @@ FX_BOOL CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode, } } else if (pFont->GetCharWidthInternal(wUnicode, iWidth, false, bCharCode)) { - return TRUE; + return true; } } else { iWidth = -1; @@ -346,22 +344,22 @@ FX_BOOL CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode, return iWidth > 0; } -FX_BOOL CFGAS_GEFont::GetCharBBox(FX_WCHAR wUnicode, - CFX_Rect& bbox, - FX_BOOL bCharCode) { - return GetCharBBoxInternal(wUnicode, bbox, TRUE, bCharCode); +bool CFGAS_GEFont::GetCharBBox(FX_WCHAR wUnicode, + CFX_Rect& bbox, + bool bCharCode) { + return GetCharBBoxInternal(wUnicode, bbox, true, bCharCode); } -FX_BOOL CFGAS_GEFont::GetCharBBoxInternal(FX_WCHAR wUnicode, - CFX_Rect& bbox, - FX_BOOL bRecursive, - FX_BOOL bCharCode) { +bool CFGAS_GEFont::GetCharBBoxInternal(FX_WCHAR wUnicode, + CFX_Rect& bbox, + bool bRecursive, + bool bCharCode) { ASSERT(m_pRectArray); ASSERT(m_pBBoxMap); void* pRect = nullptr; if (!m_pBBoxMap->Lookup((void*)(uintptr_t)wUnicode, pRect)) { CFGAS_GEFont* pFont = nullptr; - int32_t iGlyph = GetGlyphIndex(wUnicode, TRUE, &pFont, bCharCode); + int32_t iGlyph = GetGlyphIndex(wUnicode, true, &pFont, bCharCode); if (iGlyph != 0xFFFF && pFont) { if (pFont == this) { FX_RECT rtBBox; @@ -372,20 +370,20 @@ FX_BOOL CFGAS_GEFont::GetCharBBoxInternal(FX_WCHAR wUnicode, pRect = m_pRectArray->GetPtrAt(index); m_pBBoxMap->SetAt((void*)(uintptr_t)wUnicode, pRect); } - } else if (pFont->GetCharBBoxInternal(wUnicode, bbox, FALSE, bCharCode)) { - return TRUE; + } else if (pFont->GetCharBBoxInternal(wUnicode, bbox, false, bCharCode)) { + return true; } } } if (!pRect) - return FALSE; + return false; bbox = *static_cast(pRect); - return TRUE; + return true; } -FX_BOOL CFGAS_GEFont::GetBBox(CFX_Rect& bbox) { +bool CFGAS_GEFont::GetBBox(CFX_Rect& bbox) { FX_RECT rt(0, 0, 0, 0); - FX_BOOL bRet = m_pFont->GetBBox(rt); + bool bRet = m_pFont->GetBBox(rt); if (bRet) { bbox.left = rt.left; bbox.width = rt.Width(); @@ -400,13 +398,13 @@ int32_t CFGAS_GEFont::GetItalicAngle() const { } return m_pFont->GetSubstFont()->m_ItalicAngle; } -int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bCharCode) { - return GetGlyphIndex(wUnicode, TRUE, nullptr, bCharCode); +int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, bool bCharCode) { + return GetGlyphIndex(wUnicode, true, nullptr, bCharCode); } int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, - FX_BOOL bRecursive, + bool bRecursive, CFGAS_GEFont** ppFont, - FX_BOOL bCharCode) { + bool bCharCode) { ASSERT(m_pFontEncoding); int32_t iGlyphIndex = m_pFontEncoding->GlyphFromCharCode(wUnicode); if (iGlyphIndex > 0) { @@ -426,7 +424,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, auto it = m_FontMapper.find(wUnicode); CFGAS_GEFont* pFont = it != m_FontMapper.end() ? it->second : nullptr; if (pFont && pFont != this) { - iGlyphIndex = pFont->GetGlyphIndex(wUnicode, FALSE, nullptr, bCharCode); + iGlyphIndex = pFont->GetGlyphIndex(wUnicode, false, nullptr, bCharCode); if (iGlyphIndex != 0xFFFF) { int32_t i = m_SubstFonts.Find(pFont); if (i > -1) { @@ -457,7 +455,7 @@ int32_t CFGAS_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, m_FontMapper[wUnicode] = pFont; int32_t i = m_SubstFonts.GetSize(); m_SubstFonts.Add(pFont); - iGlyphIndex = pFont->GetGlyphIndex(wUnicode, FALSE, nullptr, bCharCode); + iGlyphIndex = pFont->GetGlyphIndex(wUnicode, false, nullptr, bCharCode); if (iGlyphIndex != 0xFFFF) { iGlyphIndex |= ((i + 1) << 24); if (ppFont) @@ -484,7 +482,7 @@ void CFGAS_GEFont::Reset() { m_pBBoxMap->RemoveAll(); } if (m_pRectArray) { - m_pRectArray->RemoveAll(FALSE); + m_pRectArray->RemoveAll(false); } } CFGAS_GEFont* CFGAS_GEFont::GetSubstFont(int32_t iGlyphIndex) const { diff --git a/xfa/fgas/font/fgas_gefont.h b/xfa/fgas/font/fgas_gefont.h index 7245e836a1..4ce61f3989 100644 --- a/xfa/fgas/font/fgas_gefont.h +++ b/xfa/fgas/font/fgas_gefont.h @@ -34,7 +34,7 @@ class CFGAS_GEFont { IFGAS_FontMgr* pFontMgr); static CFGAS_GEFont* LoadFont(IFX_Stream* pFontStream, IFGAS_FontMgr* pFontMgr, - FX_BOOL bSaveStream); + bool bSaveStream); #endif ~CFGAS_GEFont(); @@ -44,14 +44,12 @@ class CFGAS_GEFont { CFGAS_GEFont* Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0); void GetFamilyName(CFX_WideString& wsFamily) const; uint32_t GetFontStyles() const; - FX_BOOL GetCharWidth(FX_WCHAR wUnicode, int32_t& iWidth, bool bCharCode); - int32_t GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bCharCode = FALSE); + bool GetCharWidth(FX_WCHAR wUnicode, int32_t& iWidth, bool bCharCode); + int32_t GetGlyphIndex(FX_WCHAR wUnicode, bool bCharCode = false); int32_t GetAscent() const; int32_t GetDescent() const; - FX_BOOL GetCharBBox(FX_WCHAR wUnicode, - CFX_Rect& bbox, - FX_BOOL bCharCode = FALSE); - FX_BOOL GetBBox(CFX_Rect& bbox); + bool GetCharBBox(FX_WCHAR wUnicode, CFX_Rect& bbox, bool bCharCode = false); + bool GetBBox(CFX_Rect& bbox); int32_t GetItalicAngle() const; void Reset(); CFGAS_GEFont* GetSubstFont(int32_t iGlyphIndex) const; @@ -59,7 +57,7 @@ class CFGAS_GEFont { void SetFontProvider(CXFA_PDFFontMgr* pProvider) { m_pProvider = pProvider; } #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ void SetLogicalFontStyle(uint32_t dwLogFontStyle) { - m_bUseLogFontStyle = TRUE; + m_bUseLogFontStyle = true; m_dwLogFontStyle = dwLogFontStyle; } #endif @@ -69,30 +67,30 @@ class CFGAS_GEFont { CFGAS_GEFont(CFGAS_GEFont* src, uint32_t dwFontStyles); #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - FX_BOOL LoadFontInternal(const FX_WCHAR* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage); - FX_BOOL LoadFontInternal(const uint8_t* pBuffer, int32_t length); - FX_BOOL LoadFontInternal(IFX_Stream* pFontStream, FX_BOOL bSaveStream); + bool LoadFontInternal(const FX_WCHAR* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage); + bool LoadFontInternal(const uint8_t* pBuffer, int32_t length); + bool LoadFontInternal(IFX_Stream* pFontStream, bool bSaveStream); #endif - FX_BOOL LoadFontInternal(CFX_Font* pExternalFont); - FX_BOOL LoadFontInternal(std::unique_ptr pInternalFont); - FX_BOOL InitFont(); - FX_BOOL GetCharBBoxInternal(FX_WCHAR wUnicode, - CFX_Rect& bbox, - FX_BOOL bRecursive, - FX_BOOL bCharCode = FALSE); - FX_BOOL GetCharWidthInternal(FX_WCHAR wUnicode, - int32_t& iWidth, - bool bRecursive, - bool bCharCode); + bool LoadFontInternal(CFX_Font* pExternalFont); + bool LoadFontInternal(std::unique_ptr pInternalFont); + bool InitFont(); + bool GetCharBBoxInternal(FX_WCHAR wUnicode, + CFX_Rect& bbox, + bool bRecursive, + bool bCharCode = false); + bool GetCharWidthInternal(FX_WCHAR wUnicode, + int32_t& iWidth, + bool bRecursive, + bool bCharCode); int32_t GetGlyphIndex(FX_WCHAR wUnicode, - FX_BOOL bRecursive, + bool bRecursive, CFGAS_GEFont** ppFont, - FX_BOOL bCharCode = FALSE); + bool bCharCode = false); #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - FX_BOOL m_bUseLogFontStyle; + bool m_bUseLogFontStyle; uint32_t m_dwLogFontStyle; #endif CFX_Font* m_pFont; diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp index 646eb94696..d4907bb919 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.cpp +++ b/xfa/fgas/font/fgas_stdfontmgr.cpp @@ -37,7 +37,7 @@ CFGAS_StdFontMgrImp::CFGAS_StdFontMgrImp(FX_LPEnumAllFonts pEnumerator) } CFGAS_StdFontMgrImp::~CFGAS_StdFontMgrImp() { - m_FontFaces.RemoveAll(FALSE); + m_FontFaces.RemoveAll(false); m_CPFonts.RemoveAll(); m_FamilyFonts.RemoveAll(); m_UnicodeFonts.RemoveAll(); @@ -58,11 +58,11 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByCodePage( return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : nullptr; } FX_FONTDESCRIPTOR const* pFD = - FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage); + FindFont(pszFontFamily, dwFontStyles, true, wCodePage); if (!pFD) - pFD = FindFont(nullptr, dwFontStyles, TRUE, wCodePage); + pFD = FindFont(nullptr, dwFontStyles, true, wCodePage); if (!pFD) - pFD = FindFont(nullptr, dwFontStyles, FALSE, wCodePage); + pFD = FindFont(nullptr, dwFontStyles, false, wCodePage); if (!pFD) return nullptr; @@ -101,10 +101,10 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::GetDefFontByUnicode( return pFont ? LoadFont(pFont, dwFontStyles, pRet->wCodePage) : nullptr; FX_FONTDESCRIPTOR const* pFD = - FindFont(pszFontFamily, dwFontStyles, FALSE, pRet->wCodePage, + FindFont(pszFontFamily, dwFontStyles, false, pRet->wCodePage, pRet->wBitField, wUnicode); if (!pFD && pszFontFamily) { - pFD = FindFont(nullptr, dwFontStyles, FALSE, pRet->wCodePage, + pFD = FindFont(nullptr, dwFontStyles, false, pRet->wCodePage, pRet->wBitField, wUnicode); } if (!pFD) @@ -143,9 +143,9 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily, return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : nullptr; } FX_FONTDESCRIPTOR const* pFD = - FindFont(pszFontFamily, dwFontStyles, TRUE, wCodePage); + FindFont(pszFontFamily, dwFontStyles, true, wCodePage); if (!pFD) - pFD = FindFont(pszFontFamily, dwFontStyles, FALSE, wCodePage); + pFD = FindFont(pszFontFamily, dwFontStyles, false, wCodePage); if (!pFD) return nullptr; @@ -186,7 +186,7 @@ CFGAS_GEFont* CFGAS_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream, const FX_WCHAR* pszFontAlias, uint32_t dwFontStyles, uint16_t wCodePage, - FX_BOOL bSaveStream) { + bool bSaveStream) { ASSERT(pFontStream && pFontStream->GetLength() > 0); CFGAS_GEFont* pFont = nullptr; if (m_StreamFonts.Lookup((void*)pFontStream, (void*&)pFont)) { @@ -321,8 +321,7 @@ FX_FONTDESCRIPTOR const* FX_DefFontMatcher(FX_LPFONTMATCHPARAMS pParams, const CFX_FontDescriptors& fonts) { FX_FONTDESCRIPTOR const* pBestFont = nullptr; int32_t iBestSimilar = 0; - FX_BOOL bMatchStyle = - (pParams->dwMatchFlags & FX_FONTMATCHPARA_MacthStyle) > 0; + bool bMatchStyle = (pParams->dwMatchFlags & FX_FONTMATCHPARA_MacthStyle) > 0; int32_t iCount = fonts.GetSize(); for (int32_t i = 0; i < iCount; ++i) { FX_FONTDESCRIPTOR const* pFont = fonts.GetPtrAt(i); @@ -597,15 +596,15 @@ CFGAS_FontMgrImp::~CFGAS_FontMgrImp() { } } -FX_BOOL CFGAS_FontMgrImp::EnumFontsFromFontMapper() { +bool CFGAS_FontMgrImp::EnumFontsFromFontMapper() { CFX_FontMapper* pFontMapper = CFX_GEModule::Get()->GetFontMgr()->GetBuiltinMapper(); if (!pFontMapper) - return FALSE; + return false; IFX_SystemFontInfo* pSystemFontInfo = pFontMapper->GetSystemFontInfo(); if (!pSystemFontInfo) - return FALSE; + return false; pSystemFontInfo->EnumFontList(pFontMapper); for (int32_t i = 0; i < pFontMapper->GetFaceSize(); ++i) { @@ -620,12 +619,12 @@ FX_BOOL CFGAS_FontMgrImp::EnumFontsFromFontMapper() { pFontStream->Release(); } if (m_InstalledFonts.GetSize() == 0) - return FALSE; + return false; - return TRUE; + return true; } -FX_BOOL CFGAS_FontMgrImp::EnumFontsFromFiles() { +bool CFGAS_FontMgrImp::EnumFontsFromFiles() { CFX_GEModule::Get()->GetFontMgr()->InitFTLibrary(); FX_POSITION pos = m_pFontSource->GetStartPosition(); IFX_FileAccess* pFontSource = nullptr; @@ -642,13 +641,13 @@ FX_BOOL CFGAS_FontMgrImp::EnumFontsFromFiles() { pFontSource->Release(); } if (m_InstalledFonts.GetSize() == 0) - return FALSE; - return TRUE; + return false; + return true; } -FX_BOOL CFGAS_FontMgrImp::EnumFonts() { +bool CFGAS_FontMgrImp::EnumFonts() { if (EnumFontsFromFontMapper()) - return TRUE; + return true; return EnumFontsFromFiles(); } @@ -781,39 +780,38 @@ CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByUnicode( return nullptr; } -FX_BOOL CFGAS_FontMgrImp::VerifyUnicode(CFX_FontDescriptor* pDesc, - FX_WCHAR wcUnicode) { +bool CFGAS_FontMgrImp::VerifyUnicode(CFX_FontDescriptor* pDesc, + FX_WCHAR wcUnicode) { IFX_SeekableReadStream* pFileRead = CreateFontStream(pDesc->m_wsFaceName.UTF8Encode()); if (!pFileRead) - return FALSE; + return false; FXFT_Face pFace = LoadFace(pFileRead, pDesc->m_nFaceIndex); FT_Error retCharmap = FXFT_Select_Charmap(pFace, FXFT_ENCODING_UNICODE); FT_Error retIndex = FXFT_Get_Char_Index(pFace, wcUnicode); pFileRead->Release(); if (!pFace) - return FALSE; + return false; if (FXFT_Get_Face_External_Stream(pFace)) FXFT_Clear_Face_External_Stream(pFace); FXFT_Done_Face(pFace); return !retCharmap && retIndex; } -FX_BOOL CFGAS_FontMgrImp::VerifyUnicode(CFGAS_GEFont* pFont, - FX_WCHAR wcUnicode) { +bool CFGAS_FontMgrImp::VerifyUnicode(CFGAS_GEFont* pFont, FX_WCHAR wcUnicode) { if (!pFont) - return FALSE; + return false; FXFT_Face pFace = pFont->GetDevFont()->GetFace(); FXFT_CharMap charmap = FXFT_Get_Face_Charmap(pFace); if (FXFT_Select_Charmap(pFace, FXFT_ENCODING_UNICODE) != 0) - return FALSE; + return false; if (FXFT_Get_Char_Index(pFace, wcUnicode) == 0) { FXFT_Set_Charmap(pFace, charmap); - return FALSE; + return false; } - return TRUE; + return true; } CFGAS_GEFont* CFGAS_FontMgrImp::GetFontByLanguage( @@ -934,7 +932,7 @@ IFX_SeekableReadStream* CFGAS_FontMgrImp::CreateFontStream( uint8_t* pBuffer = FX_Alloc(uint8_t, dwFileSize + 1); dwFileSize = pSystemFontInfo->GetFontData(hFont, 0, pBuffer, dwFileSize); - return FX_CreateMemoryStream(pBuffer, dwFileSize, TRUE); + return FX_CreateMemoryStream(pBuffer, dwFileSize, true); } IFX_SeekableReadStream* CFGAS_FontMgrImp::CreateFontStream( diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h index fd7f9cd318..2c7a1a2fdd 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.h +++ b/xfa/fgas/font/fgas_stdfontmgr.h @@ -52,7 +52,7 @@ class CFGAS_StdFontMgrImp : public IFGAS_FontMgr { const FX_WCHAR* pszFontAlias = nullptr, uint32_t dwFontStyles = 0, uint16_t wCodePage = 0, - FX_BOOL bSaveStream = FALSE) override; + bool bSaveStream = false) override; CFGAS_GEFont* LoadFont(CFGAS_GEFont* pSrcFont, uint32_t dwFontStyles, uint16_t wCodePage = 0xFFFF) override; @@ -178,9 +178,9 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr { CFGAS_GEFont* LoadFont(const CFX_WideString& wsFaceName, int32_t iFaceIndex, int32_t* pFaceCount); - FX_BOOL EnumFonts(); - FX_BOOL EnumFontsFromFontMapper(); - FX_BOOL EnumFontsFromFiles(); + bool EnumFonts(); + bool EnumFontsFromFontMapper(); + bool EnumFontsFromFiles(); protected: void RegisterFace(FXFT_Face pFace, @@ -191,8 +191,8 @@ class CFGAS_FontMgrImp : public IFGAS_FontMgr { std::vector GetCharsets(FXFT_Face pFace) const; void GetUSBCSB(FXFT_Face pFace, uint32_t* USB, uint32_t* CSB); uint32_t GetFlags(FXFT_Face pFace); - FX_BOOL VerifyUnicode(CFX_FontDescriptor* pDesc, FX_WCHAR wcUnicode); - FX_BOOL VerifyUnicode(CFGAS_GEFont* pFont, FX_WCHAR wcUnicode); + bool VerifyUnicode(CFX_FontDescriptor* pDesc, FX_WCHAR wcUnicode); + bool VerifyUnicode(CFGAS_GEFont* pFont, FX_WCHAR wcUnicode); int32_t IsPartName(const CFX_WideString& Name1, const CFX_WideString& Name2); int32_t MatchFonts(CFX_FontDescriptorInfos& MatchedFonts, uint16_t wCodePage, -- cgit v1.2.3