diff options
Diffstat (limited to 'xfa/fgas')
-rw-r--r-- | xfa/fgas/font/fgas_font.h | 143 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_gefont.cpp | 52 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_gefont.h | 16 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_stdfontmgr.cpp | 188 | ||||
-rw-r--r-- | xfa/fgas/font/fgas_stdfontmgr.h | 154 | ||||
-rw-r--r-- | xfa/fgas/layout/fgas_rtfbreak.cpp | 6 | ||||
-rw-r--r-- | xfa/fgas/layout/fgas_rtfbreak.h | 8 | ||||
-rw-r--r-- | xfa/fgas/layout/fgas_textbreak.cpp | 6 | ||||
-rw-r--r-- | xfa/fgas/layout/fgas_textbreak.h | 8 | ||||
-rw-r--r-- | xfa/fgas/layout/fgas_unicode.h | 2 |
10 files changed, 300 insertions, 283 deletions
diff --git a/xfa/fgas/font/fgas_font.h b/xfa/fgas/font/fgas_font.h index 980538d612..43d7d7ff96 100644 --- a/xfa/fgas/font/fgas_font.h +++ b/xfa/fgas/font/fgas_font.h @@ -17,7 +17,7 @@ class CFX_FontSourceEnum_File; class CXFA_PDFFontMgr; -class IFX_Font; +class IFGAS_Font; class IFX_FontMgr; #define FX_FONTSTYLE_Normal 0x00 @@ -50,26 +50,27 @@ class IFX_FontMgr; #define FX_BOUNDINGSHAPE_Triangle 3 #define FX_BOUNDINGSHAPE_Diamond 4 -class IFX_Font { +class IFGAS_Font { public: - static IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage, - IFX_FontMgr* pFontMgr); - static IFX_Font* LoadFont(const uint8_t* pBuffer, - int32_t iLength, - IFX_FontMgr* pFontMgr); - static IFX_Font* LoadFont(const FX_WCHAR* pszFileName, IFX_FontMgr* pFontMgr); - static IFX_Font* LoadFont(IFX_Stream* pFontStream, - IFX_FontMgr* pFontMgr, - FX_BOOL bSaveStream = FALSE); - static IFX_Font* LoadFont(CFX_Font* pExtFont, - IFX_FontMgr* pFontMgr, - FX_BOOL bTakeOver = FALSE); - virtual ~IFX_Font() {} + static IFGAS_Font* LoadFont(const FX_WCHAR* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage, + IFX_FontMgr* pFontMgr); + static IFGAS_Font* LoadFont(const uint8_t* pBuffer, + int32_t iLength, + IFX_FontMgr* pFontMgr); + static IFGAS_Font* LoadFont(const FX_WCHAR* pszFileName, + IFX_FontMgr* pFontMgr); + static IFGAS_Font* LoadFont(IFX_Stream* pFontStream, + IFX_FontMgr* pFontMgr, + FX_BOOL bSaveStream = FALSE); + static IFGAS_Font* LoadFont(CFX_Font* pExtFont, + IFX_FontMgr* pFontMgr, + FX_BOOL bTakeOver = FALSE); + virtual ~IFGAS_Font() {} virtual void Release() = 0; - virtual IFX_Font* Retain() = 0; - virtual IFX_Font* Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0) = 0; + virtual IFGAS_Font* Retain() = 0; + virtual IFGAS_Font* Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0) = 0; virtual void GetFamilyName(CFX_WideString& wsFamily) const = 0; virtual uint32_t GetFontStyles() const = 0; virtual uint8_t GetCharSet() const = 0; @@ -86,7 +87,7 @@ class IFX_Font { virtual FX_BOOL GetBBox(CFX_Rect& bbox) = 0; virtual int32_t GetItalicAngle() const = 0; virtual void Reset() = 0; - virtual IFX_Font* GetSubstFont(int32_t iGlyphIndex) const = 0; + virtual IFGAS_Font* GetSubstFont(int32_t iGlyphIndex) const = 0; virtual void* GetDevFont() const = 0; virtual void SetFontProvider(CXFA_PDFFontMgr* pProvider) = 0; #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ @@ -149,37 +150,37 @@ class IFX_FontMgr { static IFX_FontMgr* Create(FX_LPEnumAllFonts pEnumerator); virtual ~IFX_FontMgr() {} virtual void Release() = 0; - virtual IFX_Font* GetDefFontByCodePage( + virtual IFGAS_Font* GetDefFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; - virtual IFX_Font* GetDefFontByCharset( + virtual IFGAS_Font* GetDefFontByCharset( uint8_t nCharset, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; - virtual IFX_Font* GetDefFontByUnicode( + virtual IFGAS_Font* GetDefFontByUnicode( FX_WCHAR wUnicode, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; - virtual IFX_Font* GetDefFontByLanguage( + virtual IFGAS_Font* GetDefFontByLanguage( uint16_t wLanguage, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; - virtual IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF) = 0; - virtual IFX_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength) = 0; - virtual IFX_Font* LoadFont(const FX_WCHAR* pszFileName) = 0; - virtual IFX_Font* LoadFont(IFX_Stream* pFontStream, - const FX_WCHAR* pszFontAlias = NULL, - uint32_t dwFontStyles = 0, - uint16_t wCodePage = 0, - FX_BOOL bSaveStream = FALSE) = 0; - virtual IFX_Font* LoadFont(IFX_Font* pSrcFont, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF) = 0; + virtual IFGAS_Font* LoadFont(const FX_WCHAR* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF) = 0; + virtual IFGAS_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength) = 0; + virtual IFGAS_Font* LoadFont(const FX_WCHAR* pszFileName) = 0; + virtual IFGAS_Font* LoadFont(IFX_Stream* pFontStream, + const FX_WCHAR* pszFontAlias = NULL, + uint32_t dwFontStyles = 0, + uint16_t wCodePage = 0, + FX_BOOL bSaveStream = FALSE) = 0; + virtual IFGAS_Font* LoadFont(IFGAS_Font* pSrcFont, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF) = 0; virtual void ClearFontCache() = 0; - virtual void RemoveFont(IFX_Font* pFont) = 0; + virtual void RemoveFont(IFGAS_Font* pFont) = 0; }; #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ @@ -189,53 +190,57 @@ class IFX_FontMgr { static IFX_FontMgr* Create(CFX_FontSourceEnum_File* pFontEnum); virtual ~IFX_FontMgr() {} virtual void Release() = 0; - virtual IFX_Font* GetDefFontByCodePage( + virtual IFGAS_Font* GetDefFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; - virtual IFX_Font* GetDefFontByCharset( + virtual IFGAS_Font* GetDefFontByCharset( uint8_t nCharset, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; - virtual IFX_Font* GetDefFontByUnicode( + virtual IFGAS_Font* GetDefFontByUnicode( FX_WCHAR wUnicode, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; - virtual IFX_Font* GetDefFontByLanguage( + virtual IFGAS_Font* GetDefFontByLanguage( uint16_t wLanguage, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) = 0; - virtual IFX_Font* GetFontByCodePage(uint16_t wCodePage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; - inline IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { + virtual IFGAS_Font* GetFontByCodePage( + uint16_t wCodePage, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = NULL) = 0; + inline IFGAS_Font* LoadFont(const FX_WCHAR* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { return GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily); } - virtual IFX_Font* GetFontByCharset(uint8_t nCharset, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; - virtual IFX_Font* GetFontByUnicode(FX_WCHAR wUnicode, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; - virtual IFX_Font* GetFontByLanguage(uint16_t wLanguage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) = 0; - virtual IFX_Font* LoadFont(const uint8_t* pBuffer, - int32_t iLength, - int32_t iFaceIndex, - int32_t* pFaceCount = NULL) = 0; - virtual IFX_Font* LoadFont(const FX_WCHAR* pszFileName, - int32_t iFaceIndex, - int32_t* pFaceCount = NULL) = 0; - virtual IFX_Font* LoadFont(IFX_Stream* pFontStream, - int32_t iFaceIndex, - int32_t* pFaceCount = NULL, - FX_BOOL bSaveStream = FALSE) = 0; + virtual IFGAS_Font* GetFontByCharset( + uint8_t nCharset, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFGAS_Font* GetFontByUnicode( + FX_WCHAR wUnicode, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFGAS_Font* GetFontByLanguage( + uint16_t wLanguage, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = NULL) = 0; + virtual IFGAS_Font* LoadFont(const uint8_t* pBuffer, + int32_t iLength, + int32_t iFaceIndex, + int32_t* pFaceCount = NULL) = 0; + virtual IFGAS_Font* LoadFont(const FX_WCHAR* pszFileName, + int32_t iFaceIndex, + int32_t* pFaceCount = NULL) = 0; + virtual IFGAS_Font* LoadFont(IFX_Stream* pFontStream, + int32_t iFaceIndex, + int32_t* pFaceCount = NULL, + FX_BOOL bSaveStream = FALSE) = 0; virtual void ClearFontCache() = 0; - virtual void RemoveFont(IFX_Font* pFont) = 0; + virtual void RemoveFont(IFGAS_Font* pFont) = 0; }; #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp index 5432e527d2..f7c7331275 100644 --- a/xfa/fgas/font/fgas_gefont.cpp +++ b/xfa/fgas/font/fgas_gefont.cpp @@ -10,10 +10,10 @@ #include "xfa/fgas/font/fgas_fontutils.h" #include "xfa/fxfa/include/xfa_fontmgr.h" -IFX_Font* IFX_Font::LoadFont(const FX_WCHAR* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage, - IFX_FontMgr* pFontMgr) { +IFGAS_Font* IFGAS_Font::LoadFont(const FX_WCHAR* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage, + IFX_FontMgr* pFontMgr) { #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (NULL != pFontMgr) { return pFontMgr->GetFontByCodePage(wCodePage, dwFontStyles, pszFontFamily); @@ -28,9 +28,9 @@ IFX_Font* IFX_Font::LoadFont(const FX_WCHAR* pszFontFamily, return pFont; #endif } -IFX_Font* IFX_Font::LoadFont(const uint8_t* pBuffer, - int32_t iLength, - IFX_FontMgr* pFontMgr) { +IFGAS_Font* IFGAS_Font::LoadFont(const uint8_t* pBuffer, + int32_t iLength, + IFX_FontMgr* pFontMgr) { #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (NULL != pFontMgr) { return pFontMgr->LoadFont(pBuffer, iLength, 0, NULL); @@ -45,8 +45,8 @@ IFX_Font* IFX_Font::LoadFont(const uint8_t* pBuffer, return pFont; #endif } -IFX_Font* IFX_Font::LoadFont(const FX_WCHAR* pszFileName, - IFX_FontMgr* pFontMgr) { +IFGAS_Font* IFGAS_Font::LoadFont(const FX_WCHAR* pszFileName, + IFX_FontMgr* pFontMgr) { #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (NULL != pFontMgr) { return pFontMgr->LoadFont(pszFileName, 0, NULL); @@ -61,9 +61,9 @@ IFX_Font* IFX_Font::LoadFont(const FX_WCHAR* pszFileName, return pFont; #endif } -IFX_Font* IFX_Font::LoadFont(IFX_Stream* pFontStream, - IFX_FontMgr* pFontMgr, - FX_BOOL bSaveStream) { +IFGAS_Font* IFGAS_Font::LoadFont(IFX_Stream* pFontStream, + IFX_FontMgr* pFontMgr, + FX_BOOL bSaveStream) { #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ if (NULL != pFontMgr) { return pFontMgr->LoadFont(pFontStream, 0, NULL); @@ -78,9 +78,9 @@ IFX_Font* IFX_Font::LoadFont(IFX_Stream* pFontStream, return pFont; #endif } -IFX_Font* IFX_Font::LoadFont(CFX_Font* pExtFont, - IFX_FontMgr* pFontMgr, - FX_BOOL bTakeOver) { +IFGAS_Font* IFGAS_Font::LoadFont(CFX_Font* pExtFont, + IFX_FontMgr* pFontMgr, + FX_BOOL bTakeOver) { CFX_GEFont* pFont = new CFX_GEFont(pFontMgr); if (!pFont->LoadFont(pExtFont, bTakeOver)) { pFont->Release(); @@ -170,7 +170,7 @@ void CFX_GEFont::Release() { delete this; } } -IFX_Font* CFX_GEFont::Retain() { +IFGAS_Font* CFX_GEFont::Retain() { ++m_iRefCount; return this; } @@ -312,7 +312,7 @@ FX_BOOL CFX_GEFont::InitFont() { return TRUE; } -IFX_Font* CFX_GEFont::Derive(uint32_t dwFontStyles, uint16_t wCodePage) { +IFGAS_Font* CFX_GEFont::Derive(uint32_t dwFontStyles, uint16_t wCodePage) { if (GetFontStyles() == dwFontStyles) { return Retain(); } @@ -376,10 +376,10 @@ FX_BOOL CFX_GEFont::GetCharWidth(FX_WCHAR wUnicode, if (iWidth < 1) { if (!m_pProvider || !m_pProvider->GetCharWidth(this, wUnicode, iWidth, bCharCode)) { - IFX_Font* pFont = NULL; + IFGAS_Font* pFont = NULL; int32_t iGlyph = GetGlyphIndex(wUnicode, TRUE, &pFont, bCharCode); if (iGlyph != 0xFFFF && pFont != NULL) { - if (pFont == (IFX_Font*)this) { + if (pFont == (IFGAS_Font*)this) { iWidth = m_pFont->GetGlyphWidth(iGlyph); if (iWidth < 0) { iWidth = -1; @@ -411,10 +411,10 @@ FX_BOOL CFX_GEFont::GetCharBBox(FX_WCHAR wUnicode, ASSERT(m_pBBoxMap != NULL); void* pRect = NULL; if (!m_pBBoxMap->Lookup((void*)(uintptr_t)wUnicode, pRect)) { - IFX_Font* pFont = NULL; + IFGAS_Font* pFont = NULL; int32_t iGlyph = GetGlyphIndex(wUnicode, TRUE, &pFont, bCharCode); if (iGlyph != 0xFFFF && pFont != NULL) { - if (pFont == (IFX_Font*)this) { + if (pFont == (IFGAS_Font*)this) { FX_RECT rtBBox; if (m_pFont->GetGlyphBBox(iGlyph, rtBBox)) { CFX_Rect rt; @@ -457,13 +457,13 @@ int32_t CFX_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bCharCode) { } int32_t CFX_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bRecursive, - IFX_Font** ppFont, + IFGAS_Font** ppFont, FX_BOOL bCharCode) { ASSERT(m_pFontEncoding != NULL); int32_t iGlyphIndex = m_pFontEncoding->GlyphFromCharCode(wUnicode); if (iGlyphIndex > 0) { if (ppFont != NULL) { - *ppFont = (IFX_Font*)this; + *ppFont = (IFGAS_Font*)this; } return iGlyphIndex; } @@ -476,7 +476,7 @@ int32_t CFX_GEFont::GetGlyphIndex(FX_WCHAR wUnicode, return 0xFFFF; } auto it = m_FontMapper.find(wUnicode); - IFX_Font* pFont = it != m_FontMapper.end() ? it->second : nullptr; + IFGAS_Font* pFont = it != m_FontMapper.end() ? it->second : nullptr; if (pFont && pFont != this) { iGlyphIndex = ((CFX_GEFont*)pFont)->GetGlyphIndex(wUnicode, FALSE, NULL, bCharCode); @@ -531,7 +531,7 @@ int32_t CFX_GEFont::GetDescent() const { void CFX_GEFont::Reset() { int32_t iCount = m_SubstFonts.GetSize(); for (int32_t i = 0; i < iCount; i++) { - IFX_Font* pFont = m_SubstFonts[i]; + IFGAS_Font* pFont = m_SubstFonts[i]; ((CFX_GEFont*)pFont)->Reset(); } if (m_pCharWidthMap != NULL) { @@ -544,7 +544,7 @@ void CFX_GEFont::Reset() { m_pRectArray->RemoveAll(); } } -IFX_Font* CFX_GEFont::GetSubstFont(int32_t iGlyphIndex) const { +IFGAS_Font* CFX_GEFont::GetSubstFont(int32_t iGlyphIndex) const { iGlyphIndex = ((uint32_t)iGlyphIndex) >> 24; return iGlyphIndex == 0 ? const_cast<CFX_GEFont*>(this) : m_SubstFonts[iGlyphIndex - 1]; diff --git a/xfa/fgas/font/fgas_gefont.h b/xfa/fgas/font/fgas_gefont.h index 8667bf9b0a..0ddfee9a61 100644 --- a/xfa/fgas/font/fgas_gefont.h +++ b/xfa/fgas/font/fgas_gefont.h @@ -16,15 +16,15 @@ class CXFA_PDFFontMgr; -class CFX_GEFont : public IFX_Font { +class CFX_GEFont : public IFGAS_Font { public: CFX_GEFont(const CFX_GEFont& src, uint32_t dwFontStyles); explicit CFX_GEFont(IFX_FontMgr* pFontMgr); ~CFX_GEFont(); - // IFX_Font: + // IFGAS_Font: virtual void Release(); - virtual IFX_Font* Retain(); + virtual IFGAS_Font* Retain(); FX_BOOL LoadFont(const FX_WCHAR* pszFontFamily, uint32_t dwFontStyles, uint16_t wCodePage); @@ -32,7 +32,7 @@ class CFX_GEFont : public IFX_Font { FX_BOOL LoadFont(const FX_WCHAR* pszFileName); FX_BOOL LoadFont(IFX_Stream* pFontStream, FX_BOOL bSaveStream); FX_BOOL LoadFont(CFX_Font* pExtFont, FX_BOOL bTakeOver = FALSE); - virtual IFX_Font* Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0); + virtual IFGAS_Font* Derive(uint32_t dwFontStyles, uint16_t wCodePage = 0); virtual void GetFamilyName(CFX_WideString& wsFamily) const; virtual uint32_t GetFontStyles() const; virtual uint8_t GetCharSet() const; @@ -48,7 +48,7 @@ class CFX_GEFont : public IFX_Font { virtual FX_BOOL GetBBox(CFX_Rect& bbox); virtual int32_t GetItalicAngle() const; virtual void Reset(); - virtual IFX_Font* GetSubstFont(int32_t iGlyphIndex) const; + virtual IFGAS_Font* GetSubstFont(int32_t iGlyphIndex) const; virtual void* GetDevFont() const { return (void*)m_pFont; } virtual void SetFontProvider(CXFA_PDFFontMgr* pProvider) { m_pProvider = pProvider; @@ -77,8 +77,8 @@ class CFX_GEFont : public IFX_Font { CFX_MapPtrToPtr* m_pBBoxMap; CXFA_PDFFontMgr* m_pProvider; uint16_t m_wCharSet; - CFX_ArrayTemplate<IFX_Font*> m_SubstFonts; - std::map<FX_WCHAR, IFX_Font*> m_FontMapper; + CFX_ArrayTemplate<IFGAS_Font*> m_SubstFonts; + std::map<FX_WCHAR, IFGAS_Font*> m_FontMapper; FX_BOOL InitFont(); FX_BOOL GetCharBBox(FX_WCHAR wUnicode, CFX_Rect& bbox, @@ -90,7 +90,7 @@ class CFX_GEFont : public IFX_Font { FX_BOOL bCharCode = FALSE); int32_t GetGlyphIndex(FX_WCHAR wUnicode, FX_BOOL bRecursive, - IFX_Font** ppFont, + IFGAS_Font** ppFont, FX_BOOL bCharCode = FALSE); }; diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp index 2f2f9a3ecb..3a24e4bb24 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.cpp +++ b/xfa/fgas/font/fgas_stdfontmgr.cpp @@ -43,12 +43,12 @@ CFX_StdFontMgrImp::~CFX_StdFontMgrImp() { m_Fonts[i]->Release(); } -IFX_Font* CFX_StdFontMgrImp::GetDefFontByCodePage( +IFGAS_Font* CFX_StdFontMgrImp::GetDefFontByCodePage( uint16_t wCodePage, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily) { uint32_t dwHash = FGAS_GetFontHashCode(wCodePage, dwFontStyles); - IFX_Font* pFont = NULL; + IFGAS_Font* pFont = NULL; if (m_CPFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) { return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : NULL; } @@ -60,7 +60,7 @@ IFX_Font* CFX_StdFontMgrImp::GetDefFontByCodePage( } } ASSERT(pFD); - pFont = IFX_Font::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this); + pFont = IFGAS_Font::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this); if (pFont) { m_Fonts.Add(pFont); m_CPFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); @@ -70,7 +70,7 @@ IFX_Font* CFX_StdFontMgrImp::GetDefFontByCodePage( } return NULL; } -IFX_Font* CFX_StdFontMgrImp::GetDefFontByCharset( +IFGAS_Font* CFX_StdFontMgrImp::GetDefFontByCharset( uint8_t nCharset, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily) { @@ -78,7 +78,7 @@ IFX_Font* CFX_StdFontMgrImp::GetDefFontByCharset( pszFontFamily); } -IFX_Font* CFX_StdFontMgrImp::GetDefFontByUnicode( +IFGAS_Font* CFX_StdFontMgrImp::GetDefFontByUnicode( FX_WCHAR wUnicode, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily) { @@ -88,7 +88,7 @@ IFX_Font* CFX_StdFontMgrImp::GetDefFontByUnicode( uint32_t dwHash = FGAS_GetFontFamilyHash(pszFontFamily, dwFontStyles, pRet->wBitField); - IFX_Font* pFont = nullptr; + IFGAS_Font* pFont = nullptr; if (m_UnicodeFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) return pFont ? LoadFont(pFont, dwFontStyles, pRet->wCodePage) : nullptr; @@ -104,7 +104,7 @@ IFX_Font* CFX_StdFontMgrImp::GetDefFontByUnicode( uint16_t wCodePage = FX_GetCodePageFromCharset(pFD->uCharSet); const FX_WCHAR* pFontFace = pFD->wsFontFace; - pFont = IFX_Font::LoadFont(pFontFace, dwFontStyles, wCodePage, this); + pFont = IFGAS_Font::LoadFont(pFontFace, dwFontStyles, wCodePage, this); if (pFont) { m_Fonts.Add(pFont); m_UnicodeFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); @@ -117,19 +117,19 @@ IFX_Font* CFX_StdFontMgrImp::GetDefFontByUnicode( return nullptr; } -IFX_Font* CFX_StdFontMgrImp::GetDefFontByLanguage( +IFGAS_Font* CFX_StdFontMgrImp::GetDefFontByLanguage( uint16_t wLanguage, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily) { return GetDefFontByCodePage(FX_GetDefCodePageByLanguage(wLanguage), dwFontStyles, pszFontFamily); } -IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { +IFGAS_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { uint32_t dwHash = FGAS_GetFontFamilyHash(pszFontFamily, dwFontStyles, wCodePage); - IFX_Font* pFont = NULL; + IFGAS_Font* pFont = NULL; if (m_FamilyFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) { return pFont ? LoadFont(pFont, dwFontStyles, wCodePage) : NULL; } @@ -144,7 +144,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily, if (wCodePage == 0xFFFF) { wCodePage = FX_GetCodePageFromCharset(pFD->uCharSet); } - pFont = IFX_Font::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this); + pFont = IFGAS_Font::LoadFont(pFD->wsFontFace, dwFontStyles, wCodePage, this); if (pFont) { m_Fonts.Add(pFont); m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); @@ -154,15 +154,16 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFontFamily, } return NULL; } -IFX_Font* CFX_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, int32_t iLength) { +IFGAS_Font* CFX_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, + int32_t iLength) { ASSERT(pBuffer && iLength > 0); - IFX_Font* pFont = NULL; + IFGAS_Font* pFont = NULL; if (m_BufferFonts.Lookup((void*)pBuffer, (void*&)pFont)) { if (pFont) { return pFont->Retain(); } } - pFont = IFX_Font::LoadFont(pBuffer, iLength, this); + pFont = IFGAS_Font::LoadFont(pBuffer, iLength, this); if (pFont) { m_Fonts.Add(pFont); m_BufferFonts.SetAt((void*)pBuffer, pFont); @@ -170,16 +171,16 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(const uint8_t* pBuffer, int32_t iLength) { } return NULL; } -IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFileName) { +IFGAS_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFileName) { ASSERT(pszFileName); uint32_t dwHash = FX_HashCode_GetW(pszFileName, false); - IFX_Font* pFont = NULL; + IFGAS_Font* pFont = NULL; if (m_FileFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont)) { if (pFont) { return pFont->Retain(); } } - pFont = IFX_Font::LoadFont(pszFileName, NULL); + pFont = IFGAS_Font::LoadFont(pszFileName, NULL); if (pFont) { m_Fonts.Add(pFont); m_FileFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); @@ -187,13 +188,13 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(const FX_WCHAR* pszFileName) { } return NULL; } -IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream, - const FX_WCHAR* pszFontAlias, - uint32_t dwFontStyles, - uint16_t wCodePage, - FX_BOOL bSaveStream) { +IFGAS_Font* CFX_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream, + const FX_WCHAR* pszFontAlias, + uint32_t dwFontStyles, + uint16_t wCodePage, + FX_BOOL bSaveStream) { ASSERT(pFontStream && pFontStream->GetLength() > 0); - IFX_Font* pFont = NULL; + IFGAS_Font* pFont = NULL; if (m_StreamFonts.Lookup((void*)pFontStream, (void*&)pFont)) { if (pFont) { if (pszFontAlias) { @@ -204,7 +205,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream, return LoadFont(pFont, dwFontStyles, wCodePage); } } - pFont = IFX_Font::LoadFont(pFontStream, this, bSaveStream); + pFont = IFGAS_Font::LoadFont(pFontStream, this, bSaveStream); if (pFont) { m_Fonts.Add(pFont); m_StreamFonts.SetAt((void*)pFontStream, (void*)pFont); @@ -217,9 +218,9 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Stream* pFontStream, } return NULL; } -IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Font* pSrcFont, - uint32_t dwFontStyles, - uint16_t wCodePage) { +IFGAS_Font* CFX_StdFontMgrImp::LoadFont(IFGAS_Font* pSrcFont, + uint32_t dwFontStyles, + uint16_t wCodePage) { ASSERT(pSrcFont); if (pSrcFont->GetFontStyles() == dwFontStyles) { return pSrcFont->Retain(); @@ -228,7 +229,7 @@ IFX_Font* CFX_StdFontMgrImp::LoadFont(IFX_Font* pSrcFont, (void*)(uintptr_t)wCodePage}; uint32_t dwHash = FX_HashCode_GetA( CFX_ByteStringC((uint8_t*)buffer, sizeof(buffer)), false); - IFX_Font* pFont = NULL; + IFGAS_Font* pFont = NULL; if (m_DeriveFonts.GetCount() > 0) { m_DeriveFonts.Lookup((void*)(uintptr_t)dwHash, (void*&)pFont); if (pFont) { @@ -253,7 +254,8 @@ void CFX_StdFontMgrImp::ClearFontCache() { m_Fonts[i]->Reset(); } -void CFX_StdFontMgrImp::RemoveFont(CFX_MapPtrToPtr& fontMap, IFX_Font* pFont) { +void CFX_StdFontMgrImp::RemoveFont(CFX_MapPtrToPtr& fontMap, + IFGAS_Font* pFont) { FX_POSITION pos = fontMap.GetStartPosition(); void* pKey; void* pFind; @@ -267,7 +269,7 @@ void CFX_StdFontMgrImp::RemoveFont(CFX_MapPtrToPtr& fontMap, IFX_Font* pFont) { break; } } -void CFX_StdFontMgrImp::RemoveFont(IFX_Font* pFont) { +void CFX_StdFontMgrImp::RemoveFont(IFGAS_Font* pFont) { RemoveFont(m_CPFonts, pFont); RemoveFont(m_FamilyFonts, pFont); RemoveFont(m_UnicodeFonts, pFont); @@ -629,7 +631,7 @@ void CFX_FontMgrImp::Release() { pos = m_Hash2Fonts.GetStartPosition(); while (pos) { uint32_t dwHash; - CFX_ArrayTemplate<IFX_Font*>* pFonts; + CFX_ArrayTemplate<IFGAS_Font*>* pFonts; m_Hash2Fonts.GetNextAssoc(pos, dwHash, pFonts); delete pFonts; } @@ -646,7 +648,7 @@ void CFX_FontMgrImp::Release() { pos = m_FileAccess2IFXFont.GetStartPosition(); while (pos) { uint32_t dwHash; - IFX_Font* pFont; + IFGAS_Font* pFont; m_FileAccess2IFXFont.GetNextAssoc(pos, dwHash, pFont); if (NULL != pFont) { pFont->Release(); @@ -654,42 +656,44 @@ void CFX_FontMgrImp::Release() { } pos = m_IFXFont2FileRead.GetStartPosition(); while (pos) { - IFX_Font* pFont; + IFGAS_Font* pFont; IFX_FileRead* pFileRead; m_IFXFont2FileRead.GetNextAssoc(pos, pFont, pFileRead); pFileRead->Release(); } delete this; } -IFX_Font* CFX_FontMgrImp::GetDefFontByCodePage(uint16_t wCodePage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily) { +IFGAS_Font* CFX_FontMgrImp::GetDefFontByCodePage( + uint16_t wCodePage, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) { return nullptr; } -IFX_Font* CFX_FontMgrImp::GetDefFontByCharset(uint8_t nCharset, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily) { +IFGAS_Font* CFX_FontMgrImp::GetDefFontByCharset(uint8_t nCharset, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) { return nullptr; } -IFX_Font* CFX_FontMgrImp::GetDefFontByUnicode(FX_WCHAR wUnicode, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily) { +IFGAS_Font* CFX_FontMgrImp::GetDefFontByUnicode(FX_WCHAR wUnicode, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) { return nullptr; } -IFX_Font* CFX_FontMgrImp::GetDefFontByLanguage(uint16_t wLanguage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily) { +IFGAS_Font* CFX_FontMgrImp::GetDefFontByLanguage( + uint16_t wLanguage, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) { return nullptr; } -IFX_Font* CFX_FontMgrImp::GetFontByCodePage(uint16_t wCodePage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily) { +IFGAS_Font* CFX_FontMgrImp::GetFontByCodePage(uint16_t wCodePage, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) { CFX_ByteString bsHash; bsHash.Format("%d, %d", wCodePage, dwFontStyles); bsHash += CFX_WideString(pszFontFamily).UTF8Encode(); uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false); - CFX_ArrayTemplate<IFX_Font*>* pFonts = nullptr; + CFX_ArrayTemplate<IFGAS_Font*>* pFonts = nullptr; if (m_Hash2Fonts.Lookup(dwHash, pFonts)) { if (!pFonts) return nullptr; @@ -699,7 +703,7 @@ IFX_Font* CFX_FontMgrImp::GetFontByCodePage(uint16_t wCodePage, } if (!pFonts) - pFonts = new CFX_ArrayTemplate<IFX_Font*>; + pFonts = new CFX_ArrayTemplate<IFGAS_Font*>; m_Hash2Fonts.SetAt(dwHash, pFonts); CFX_FontDescriptorInfos* sortedFonts = nullptr; @@ -713,7 +717,7 @@ IFX_Font* CFX_FontMgrImp::GetFontByCodePage(uint16_t wCodePage, return nullptr; CFX_FontDescriptor* pDesc = sortedFonts->GetAt(0).pFont; - IFX_Font* pFont = + IFGAS_Font* pFont = pDesc->m_pFileAccess ? LoadFont(pDesc->m_pFileAccess, pDesc->m_nFaceIndex, nullptr) : LoadFont(pDesc->m_wsFaceName, pDesc->m_nFaceIndex, nullptr); @@ -723,16 +727,16 @@ IFX_Font* CFX_FontMgrImp::GetFontByCodePage(uint16_t wCodePage, pFonts->Add(pFont); return pFont; } -IFX_Font* CFX_FontMgrImp::GetFontByCharset(uint8_t nCharset, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily) { +IFGAS_Font* CFX_FontMgrImp::GetFontByCharset(uint8_t nCharset, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) { return GetFontByCodePage(FX_GetCodePageFromCharset(nCharset), dwFontStyles, pszFontFamily); } -IFX_Font* CFX_FontMgrImp::GetFontByUnicode(FX_WCHAR wUnicode, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily) { - IFX_Font* pFont = nullptr; +IFGAS_Font* CFX_FontMgrImp::GetFontByUnicode(FX_WCHAR wUnicode, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) { + IFGAS_Font* pFont = nullptr; if (m_FailedUnicodes2NULL.Lookup(wUnicode, pFont)) return nullptr; const FGAS_FONTUSB* x = FGAS_GetUnicodeBitField(wUnicode); @@ -745,7 +749,7 @@ IFX_Font* CFX_FontMgrImp::GetFontByUnicode(FX_WCHAR wUnicode, bsHash.Format("%d, %d", wCodePage, dwFontStyles); bsHash += CFX_WideString(pszFontFamily).UTF8Encode(); uint32_t dwHash = FX_HashCode_GetA(bsHash.AsStringC(), false); - CFX_ArrayTemplate<IFX_Font*>* pFonts = nullptr; + CFX_ArrayTemplate<IFGAS_Font*>* pFonts = nullptr; if (m_Hash2Fonts.Lookup(dwHash, pFonts)) { if (!pFonts) return nullptr; @@ -755,7 +759,7 @@ IFX_Font* CFX_FontMgrImp::GetFontByUnicode(FX_WCHAR wUnicode, } } if (!pFonts) - pFonts = new CFX_ArrayTemplate<IFX_Font*>; + pFonts = new CFX_ArrayTemplate<IFGAS_Font*>; m_Hash2Fonts.SetAt(dwHash, pFonts); CFX_FontDescriptorInfos* sortedFonts = nullptr; if (!m_Hash2CandidateList.Lookup(dwHash, sortedFonts)) { @@ -803,7 +807,7 @@ FX_BOOL CFX_FontMgrImp::VerifyUnicode(CFX_FontDescriptor* pDesc, return !retCharmap && retIndex; } -FX_BOOL CFX_FontMgrImp::VerifyUnicode(IFX_Font* pFont, FX_WCHAR wcUnicode) { +FX_BOOL CFX_FontMgrImp::VerifyUnicode(IFGAS_Font* pFont, FX_WCHAR wcUnicode) { if (!pFont) return FALSE; @@ -819,17 +823,17 @@ FX_BOOL CFX_FontMgrImp::VerifyUnicode(IFX_Font* pFont, FX_WCHAR wcUnicode) { return TRUE; } -IFX_Font* CFX_FontMgrImp::GetFontByLanguage(uint16_t wLanguage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily) { +IFGAS_Font* CFX_FontMgrImp::GetFontByLanguage(uint16_t wLanguage, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily) { return GetFontByCodePage(FX_GetDefCodePageByLanguage(wLanguage), dwFontStyles, pszFontFamily); } -IFX_Font* CFX_FontMgrImp::LoadFont(const uint8_t* pBuffer, - int32_t iLength, - int32_t iFaceIndex, - int32_t* pFaceCount) { +IFGAS_Font* CFX_FontMgrImp::LoadFont(const uint8_t* pBuffer, + int32_t iLength, + int32_t iFaceIndex, + int32_t* pFaceCount) { void* Hash[2] = {(void*)(uintptr_t)pBuffer, (void*)(uintptr_t)iLength}; uint32_t dwHash = FX_HashCode_GetA(CFX_ByteStringC((uint8_t*)Hash, sizeof(Hash)), false); @@ -839,9 +843,9 @@ IFX_Font* CFX_FontMgrImp::LoadFont(const uint8_t* pBuffer, : nullptr; } -IFX_Font* CFX_FontMgrImp::LoadFont(const FX_WCHAR* pszFileName, - int32_t iFaceIndex, - int32_t* pFaceCount) { +IFGAS_Font* CFX_FontMgrImp::LoadFont(const FX_WCHAR* pszFileName, + int32_t iFaceIndex, + int32_t* pFaceCount) { CFX_ByteString bsHash; bsHash += CFX_WideString(pszFileName).UTF8Encode(); @@ -856,10 +860,10 @@ IFX_Font* CFX_FontMgrImp::LoadFont(const FX_WCHAR* pszFileName, : nullptr; } -IFX_Font* CFX_FontMgrImp::LoadFont(IFX_Stream* pFontStream, - int32_t iFaceIndex, - int32_t* pFaceCount, - FX_BOOL bSaveStream) { +IFGAS_Font* CFX_FontMgrImp::LoadFont(IFX_Stream* pFontStream, + int32_t iFaceIndex, + int32_t* pFaceCount, + FX_BOOL bSaveStream) { void* Hash[1] = {(void*)(uintptr_t)pFontStream}; uint32_t dwHash = FX_HashCode_GetA(CFX_ByteStringC((uint8_t*)Hash, sizeof(Hash)), false); @@ -870,12 +874,12 @@ IFX_Font* CFX_FontMgrImp::LoadFont(IFX_Stream* pFontStream, : nullptr; } -IFX_Font* CFX_FontMgrImp::LoadFont(IFX_FileAccess* pFontAccess, - int32_t iFaceIndex, - int32_t* pFaceCount, - FX_BOOL bWantCache) { +IFGAS_Font* CFX_FontMgrImp::LoadFont(IFX_FileAccess* pFontAccess, + int32_t iFaceIndex, + int32_t* pFaceCount, + FX_BOOL bWantCache) { uint32_t dwHash = 0; - IFX_Font* pFont = nullptr; + IFGAS_Font* pFont = nullptr; if (bWantCache) { CFX_ByteString bsHash; bsHash.Format("%d, %d", (uintptr_t)pFontAccess, iFaceIndex); @@ -901,7 +905,7 @@ IFX_Font* CFX_FontMgrImp::LoadFont(IFX_FileAccess* pFontAccess, pFontStream->Release(); return nullptr; } - pFont = IFX_Font::LoadFont(pInternalFont, this, TRUE); + pFont = IFGAS_Font::LoadFont(pInternalFont, this, TRUE); if (!pFont) { delete pInternalFont; pFontStream->Release(); @@ -917,9 +921,9 @@ IFX_Font* CFX_FontMgrImp::LoadFont(IFX_FileAccess* pFontAccess, return pFont; } -IFX_Font* CFX_FontMgrImp::LoadFont(const CFX_WideString& wsFaceName, - int32_t iFaceIndex, - int32_t* pFaceCount) { +IFGAS_Font* CFX_FontMgrImp::LoadFont(const CFX_WideString& wsFaceName, + int32_t iFaceIndex, + int32_t* pFaceCount) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); CFX_FontMapper* pFontMapper = pFontMgr->GetBuiltinMapper(); if (!pFontMapper) @@ -944,7 +948,7 @@ IFX_Font* CFX_FontMgrImp::LoadFont(const CFX_WideString& wsFaceName, return nullptr; } - IFX_Font* pFont = IFX_Font::LoadFont(pInternalFont, this, FALSE); + IFGAS_Font* pFont = IFGAS_Font::LoadFont(pInternalFont, this, FALSE); if (!pFont) { pFontStream->Release(); return nullptr; @@ -1208,7 +1212,7 @@ void CFX_FontMgrImp::ClearFontCache() { pos = m_FileAccess2IFXFont.GetStartPosition(); while (pos) { uint32_t dwHash; - IFX_Font* pFont; + IFGAS_Font* pFont; m_FileAccess2IFXFont.GetNextAssoc(pos, dwHash, pFont); if (NULL != pFont) { pFont->Release(); @@ -1216,13 +1220,13 @@ void CFX_FontMgrImp::ClearFontCache() { } pos = m_IFXFont2FileRead.GetStartPosition(); while (pos) { - IFX_Font* pFont; + IFGAS_Font* pFont; IFX_FileRead* pFileRead; m_IFXFont2FileRead.GetNextAssoc(pos, pFont, pFileRead); pFileRead->Release(); } } -void CFX_FontMgrImp::RemoveFont(IFX_Font* pEFont) { +void CFX_FontMgrImp::RemoveFont(IFGAS_Font* pEFont) { if (NULL == pEFont) { return; } @@ -1235,7 +1239,7 @@ void CFX_FontMgrImp::RemoveFont(IFX_Font* pEFont) { pos = m_FileAccess2IFXFont.GetStartPosition(); while (pos) { uint32_t dwHash; - IFX_Font* pCFont; + IFGAS_Font* pCFont; m_FileAccess2IFXFont.GetNextAssoc(pos, dwHash, pCFont); if (pCFont == pEFont) { m_FileAccess2IFXFont.RemoveKey(dwHash); @@ -1245,7 +1249,7 @@ void CFX_FontMgrImp::RemoveFont(IFX_Font* pEFont) { pos = m_Hash2Fonts.GetStartPosition(); while (pos) { uint32_t dwHash; - CFX_ArrayTemplate<IFX_Font*>* pFonts; + CFX_ArrayTemplate<IFGAS_Font*>* pFonts; m_Hash2Fonts.GetNextAssoc(pos, dwHash, pFonts); if (NULL != pFonts) { for (int32_t i = 0; i < pFonts->GetSize(); i++) { diff --git a/xfa/fgas/font/fgas_stdfontmgr.h b/xfa/fgas/font/fgas_stdfontmgr.h index caa662613d..0cbb7727a7 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.h +++ b/xfa/fgas/font/fgas_stdfontmgr.h @@ -25,48 +25,52 @@ class CFX_StdFontMgrImp : public IFX_FontMgr { // IFX_FontMgr: void Release() override { delete this; } - IFX_Font* GetDefFontByCodePage(uint16_t wCodePage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; - IFX_Font* GetDefFontByCharset(uint8_t nCharset, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; - IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; - IFX_Font* GetDefFontByLanguage(uint16_t wLanguage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; - IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF) override; - IFX_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength) override; - IFX_Font* LoadFont(const FX_WCHAR* pszFileName) override; - IFX_Font* LoadFont(IFX_Stream* pFontStream, - const FX_WCHAR* pszFontAlias = NULL, - uint32_t dwFontStyles = 0, - uint16_t wCodePage = 0, - FX_BOOL bSaveStream = FALSE) override; - IFX_Font* LoadFont(IFX_Font* pSrcFont, - uint32_t dwFontStyles, - uint16_t wCodePage = 0xFFFF) override; + IFGAS_Font* GetDefFontByCodePage( + uint16_t wCodePage, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = NULL) override; + IFGAS_Font* GetDefFontByCharset( + uint8_t nCharset, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = NULL) override; + IFGAS_Font* GetDefFontByUnicode( + FX_WCHAR wUnicode, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = NULL) override; + IFGAS_Font* GetDefFontByLanguage( + uint16_t wLanguage, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = NULL) override; + IFGAS_Font* LoadFont(const FX_WCHAR* pszFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF) override; + IFGAS_Font* LoadFont(const uint8_t* pBuffer, int32_t iLength) override; + IFGAS_Font* LoadFont(const FX_WCHAR* pszFileName) override; + IFGAS_Font* LoadFont(IFX_Stream* pFontStream, + const FX_WCHAR* pszFontAlias = NULL, + uint32_t dwFontStyles = 0, + uint16_t wCodePage = 0, + FX_BOOL bSaveStream = FALSE) override; + IFGAS_Font* LoadFont(IFGAS_Font* pSrcFont, + uint32_t dwFontStyles, + uint16_t wCodePage = 0xFFFF) override; void ClearFontCache() override; - void RemoveFont(IFX_Font* pFont) override; + void RemoveFont(IFGAS_Font* pFont) override; protected: - void RemoveFont(CFX_MapPtrToPtr& fontMap, IFX_Font* pFont); + void RemoveFont(CFX_MapPtrToPtr& fontMap, IFGAS_Font* pFont); FX_FONTDESCRIPTOR const* FindFont(const FX_WCHAR* pszFontFamily, uint32_t dwFontStyles, uint32_t dwMatchFlags, uint16_t wCodePage, uint32_t dwUSB = 999, FX_WCHAR wUnicode = 0); - IFX_Font* GetFont(FX_FONTDESCRIPTOR const* pFD, uint32_t dwFontStyles); + IFGAS_Font* GetFont(FX_FONTDESCRIPTOR const* pFD, uint32_t dwFontStyles); FX_LPEnumAllFonts m_pEnumerator; CFX_FontDescriptors m_FontFaces; - CFX_ArrayTemplate<IFX_Font*> m_Fonts; + CFX_ArrayTemplate<IFGAS_Font*> m_Fonts; CFX_MapPtrToPtr m_CPFonts; CFX_MapPtrToPtr m_FamilyFonts; CFX_MapPtrToPtr m_UnicodeFonts; @@ -151,47 +155,51 @@ class CFX_FontMgrImp : public IFX_FontMgr { // IFX_FontMgr: void Release() override; - IFX_Font* GetDefFontByCodePage(uint16_t wCodePage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; - IFX_Font* GetDefFontByCharset(uint8_t nCharset, + IFGAS_Font* GetDefFontByCodePage( + uint16_t wCodePage, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = NULL) override; + IFGAS_Font* GetDefFontByCharset( + uint8_t nCharset, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = NULL) override; + IFGAS_Font* GetDefFontByUnicode( + FX_WCHAR wUnicode, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = NULL) override; + IFGAS_Font* GetDefFontByLanguage( + uint16_t wLanguage, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = NULL) override; + IFGAS_Font* GetFontByCodePage(uint16_t wCodePage, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) override; - IFX_Font* GetDefFontByUnicode(FX_WCHAR wUnicode, + IFGAS_Font* GetFontByCharset(uint8_t nCharset, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = NULL) override; + IFGAS_Font* GetFontByUnicode(FX_WCHAR wUnicode, + uint32_t dwFontStyles, + const FX_WCHAR* pszFontFamily = NULL) override; + IFGAS_Font* GetFontByLanguage(uint16_t wLanguage, uint32_t dwFontStyles, const FX_WCHAR* pszFontFamily = NULL) override; - IFX_Font* GetDefFontByLanguage(uint16_t wLanguage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; - IFX_Font* GetFontByCodePage(uint16_t wCodePage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; - IFX_Font* GetFontByCharset(uint8_t nCharset, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; - IFX_Font* GetFontByUnicode(FX_WCHAR wUnicode, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; - IFX_Font* GetFontByLanguage(uint16_t wLanguage, - uint32_t dwFontStyles, - const FX_WCHAR* pszFontFamily = NULL) override; - IFX_Font* LoadFont(const uint8_t* pBuffer, - int32_t iLength, - int32_t iFaceIndex, - int32_t* pFaceCount) override; - IFX_Font* LoadFont(const FX_WCHAR* pszFileName, - int32_t iFaceIndex, - int32_t* pFaceCount) override; - IFX_Font* LoadFont(IFX_Stream* pFontStream, - int32_t iFaceIndex, - int32_t* pFaceCount, - FX_BOOL bSaveStream = FALSE) override; + IFGAS_Font* LoadFont(const uint8_t* pBuffer, + int32_t iLength, + int32_t iFaceIndex, + int32_t* pFaceCount) override; + IFGAS_Font* LoadFont(const FX_WCHAR* pszFileName, + int32_t iFaceIndex, + int32_t* pFaceCount) override; + IFGAS_Font* LoadFont(IFX_Stream* pFontStream, + int32_t iFaceIndex, + int32_t* pFaceCount, + FX_BOOL bSaveStream = FALSE) override; void ClearFontCache() override; - void RemoveFont(IFX_Font* pFont) override; + void RemoveFont(IFGAS_Font* pFont) override; - IFX_Font* LoadFont(const CFX_WideString& wsFaceName, - int32_t iFaceIndex, - int32_t* pFaceCount); + IFGAS_Font* LoadFont(const CFX_WideString& wsFaceName, + int32_t iFaceIndex, + int32_t* pFaceCount); FX_BOOL EnumFonts(); FX_BOOL EnumFontsFromFontMapper(); FX_BOOL EnumFontsFromFiles(); @@ -209,7 +217,7 @@ class CFX_FontMgrImp : public IFX_FontMgr { uint32_t GetFlags(FXFT_Face pFace); CFX_FontDescriptors m_InstalledFonts; FX_BOOL VerifyUnicode(CFX_FontDescriptor* pDesc, FX_WCHAR wcUnicode); - FX_BOOL VerifyUnicode(IFX_Font* pFont, FX_WCHAR wcUnicode); + FX_BOOL VerifyUnicode(IFGAS_Font* pFont, FX_WCHAR wcUnicode); int32_t IsPartName(const CFX_WideString& Name1, const CFX_WideString& Name2); int32_t MatchFonts(CFX_FontDescriptorInfos& MatchedFonts, uint16_t wCodePage, @@ -221,10 +229,10 @@ class CFX_FontMgrImp : public IFX_FontMgr { uint32_t dwFontStyles, const CFX_WideString& FontName, FX_WCHAR wcUnicode = 0xFFFE); - IFX_Font* LoadFont(IFX_FileAccess* pFontAccess, - int32_t iFaceIndex, - int32_t* pFaceCount, - FX_BOOL bWantCache = FALSE); + IFGAS_Font* LoadFont(IFX_FileAccess* pFontAccess, + int32_t iFaceIndex, + int32_t* pFaceCount, + FX_BOOL bWantCache = FALSE); FXFT_Face LoadFace(IFX_FileRead* pFontStream, int32_t iFaceIndex); IFX_FileRead* CreateFontStream(CFX_FontMapper* pFontMapper, IFX_SystemFontInfo* pSystemFontInfo, @@ -232,11 +240,11 @@ class CFX_FontMgrImp : public IFX_FontMgr { IFX_FileRead* CreateFontStream(const CFX_ByteString& bsFaceName); CFX_MapPtrTemplate<uint32_t, CFX_FontDescriptorInfos*> m_Hash2CandidateList; - CFX_MapPtrTemplate<uint32_t, CFX_ArrayTemplate<IFX_Font*>*> m_Hash2Fonts; + CFX_MapPtrTemplate<uint32_t, CFX_ArrayTemplate<IFGAS_Font*>*> m_Hash2Fonts; CFX_MapPtrTemplate<uint32_t, IFX_FileAccess*> m_Hash2FileAccess; - CFX_MapPtrTemplate<uint32_t, IFX_Font*> m_FileAccess2IFXFont; - CFX_MapPtrTemplate<IFX_Font*, IFX_FileRead*> m_IFXFont2FileRead; - CFX_MapPtrTemplate<FX_WCHAR, IFX_Font*> m_FailedUnicodes2NULL; + CFX_MapPtrTemplate<uint32_t, IFGAS_Font*> m_FileAccess2IFXFont; + CFX_MapPtrTemplate<IFGAS_Font*, IFX_FileRead*> m_IFXFont2FileRead; + CFX_MapPtrTemplate<FX_WCHAR, IFGAS_Font*> m_FailedUnicodes2NULL; CFX_FontSourceEnum_File* const m_pFontSource; }; #endif diff --git a/xfa/fgas/layout/fgas_rtfbreak.cpp b/xfa/fgas/layout/fgas_rtfbreak.cpp index 30a9c5a150..514c9f0925 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.cpp +++ b/xfa/fgas/layout/fgas_rtfbreak.cpp @@ -86,7 +86,7 @@ void CFX_RTFBreak::SetLayoutStyles(uint32_t dwLayoutStyles) { m_iRotation = m_iLineRotation + m_iCharRotation; m_iRotation %= 4; } -void CFX_RTFBreak::SetFont(IFX_Font* pFont) { +void CFX_RTFBreak::SetFont(IFGAS_Font* pFont) { if (pFont == NULL) { return; } @@ -1184,7 +1184,7 @@ int32_t CFX_RTFBreak::GetDisplayPos(const FX_RTFTEXTOBJ* pText, const FX_WCHAR* pStr = pText->pStr; int32_t* pWidths = pText->pWidths; int32_t iLength = pText->iLength - 1; - IFX_Font* pFont = pText->pFont; + IFGAS_Font* pFont = pText->pFont; uint32_t dwStyles = pText->dwLayoutStyles; CFX_RectF rtText(*pText->pRect); FX_BOOL bRTLPiece = FX_IsOdd(pText->iBidiLevel); @@ -1430,7 +1430,7 @@ int32_t CFX_RTFBreak::GetCharRects(const FX_RTFTEXTOBJ* pText, FX_FLOAT fFontSize = pText->fFontSize; int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); FX_FLOAT fScale = fFontSize / 1000.0f; - IFX_Font* pFont = pText->pFont; + IFGAS_Font* pFont = pText->pFont; if (pFont == NULL) { bCharBBox = FALSE; } diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h index 2979acb951..d2041615d0 100644 --- a/xfa/fgas/layout/fgas_rtfbreak.h +++ b/xfa/fgas/layout/fgas_rtfbreak.h @@ -14,7 +14,7 @@ #include "xfa/fgas/layout/fgas_textbreak.h" #include "xfa/fgas/layout/fgas_unicode.h" -class IFX_Font; +class IFGAS_Font; #define FX_RTFBREAKPOLICY_None 0x00 #define FX_RTFBREAKPOLICY_SpaceBreak 0x01 @@ -82,7 +82,7 @@ struct FX_RTFTEXTOBJ { const FX_WCHAR* pStr; int32_t* pWidths; int32_t iLength; - IFX_Font* pFont; + IFGAS_Font* pFont; FX_FLOAT fFontSize; uint32_t dwLayoutStyles; int32_t iCharRotation; @@ -250,7 +250,7 @@ class CFX_RTFBreak { void SetLineStartPos(FX_FLOAT fLinePos); uint32_t GetLayoutStyles() const { return m_dwLayoutStyles; } void SetLayoutStyles(uint32_t dwLayoutStyles); - void SetFont(IFX_Font* pFont); + void SetFont(IFGAS_Font* pFont); void SetFontSize(FX_FLOAT fFontSize); void SetTabWidth(FX_FLOAT fTabWidth); void AddPositionedTab(FX_FLOAT fTabPos); @@ -298,7 +298,7 @@ class CFX_RTFBreak { FX_BOOL m_bVertical; FX_BOOL m_bSingleLine; FX_BOOL m_bCharCode; - IFX_Font* m_pFont; + IFGAS_Font* m_pFont; int32_t m_iFontHeight; int32_t m_iFontSize; int32_t m_iTabWidth; diff --git a/xfa/fgas/layout/fgas_textbreak.cpp b/xfa/fgas/layout/fgas_textbreak.cpp index d30d105253..e09b5c8abf 100644 --- a/xfa/fgas/layout/fgas_textbreak.cpp +++ b/xfa/fgas/layout/fgas_textbreak.cpp @@ -93,7 +93,7 @@ void CFX_TxtBreak::SetLayoutStyles(uint32_t dwLayoutStyles) { m_iRotation = m_iLineRotation + m_iCharRotation; m_iRotation %= 4; } -void CFX_TxtBreak::SetFont(IFX_Font* pFont) { +void CFX_TxtBreak::SetFont(IFGAS_Font* pFont) { if (pFont == NULL) { return; } @@ -1174,7 +1174,7 @@ int32_t CFX_TxtBreak::GetDisplayPos(const FX_TXTRUN* pTxtRun, const FX_WCHAR* pStr = pTxtRun->wsStr.c_str(); int32_t* pWidths = pTxtRun->pWidths; int32_t iLength = pTxtRun->iLength - 1; - IFX_Font* pFont = pTxtRun->pFont; + IFGAS_Font* pFont = pTxtRun->pFont; uint32_t dwStyles = pTxtRun->dwStyles; CFX_RectF rtText(*pTxtRun->pRect); FX_BOOL bRTLPiece = @@ -1565,7 +1565,7 @@ int32_t CFX_TxtBreak::GetCharRects(const FX_TXTRUN* pTxtRun, FX_FLOAT fFontSize = pTxtRun->fFontSize; int32_t iFontSize = FXSYS_round(fFontSize * 20.0f); FX_FLOAT fScale = fFontSize / 1000.0f; - IFX_Font* pFont = pTxtRun->pFont; + IFGAS_Font* pFont = pTxtRun->pFont; if (pFont == NULL) { bCharBBox = FALSE; } diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h index 3c6810d774..01e688f15d 100644 --- a/xfa/fgas/layout/fgas_textbreak.h +++ b/xfa/fgas/layout/fgas_textbreak.h @@ -15,7 +15,7 @@ class CFX_Char; class CFX_TxtChar; class CFX_TxtPiece; -class IFX_Font; +class IFGAS_Font; class IFX_TxtAccess; #define FX_TXTBREAKPOLICY_None 0x00 @@ -99,7 +99,7 @@ struct FX_TXTRUN { CFX_WideString wsStr; int32_t* pWidths; int32_t iLength; - IFX_Font* pFont; + IFGAS_Font* pFont; FX_FLOAT fFontSize; uint32_t dwStyles; int32_t iHorizontalScale; @@ -228,7 +228,7 @@ class CFX_TxtBreak { void SetLinePos(FX_FLOAT fLinePos); uint32_t GetLayoutStyles() const { return m_dwLayoutStyles; } void SetLayoutStyles(uint32_t dwLayoutStyles); - void SetFont(IFX_Font* pFont); + void SetFont(IFGAS_Font* pFont); void SetFontSize(FX_FLOAT fFontSize); void SetTabWidth(FX_FLOAT fTabWidth, FX_BOOL bEquidistant); void SetDefaultChar(FX_WCHAR wch); @@ -302,7 +302,7 @@ class CFX_TxtBreak { FX_BOOL m_bCombText; int32_t m_iArabicContext; int32_t m_iCurArabicContext; - IFX_Font* m_pFont; + IFGAS_Font* m_pFont; int32_t m_iFontSize; FX_BOOL m_bEquidistant; int32_t m_iTabWidth; diff --git a/xfa/fgas/layout/fgas_unicode.h b/xfa/fgas/layout/fgas_unicode.h index 139547468c..463cb33bc6 100644 --- a/xfa/fgas/layout/fgas_unicode.h +++ b/xfa/fgas/layout/fgas_unicode.h @@ -20,7 +20,7 @@ void FX_TEXTLAYOUT_PieceSort(CFX_TPOArray& tpos, int32_t iStart, int32_t iEnd); typedef FX_BOOL (*FX_AdjustCharDisplayPos)(FX_WCHAR wch, FX_BOOL bMBCSCode, - IFX_Font* pFont, + IFGAS_Font* pFont, FX_FLOAT fFontSize, FX_BOOL bVertical, CFX_PointF& ptOffset); |