diff options
Diffstat (limited to 'xfa/fgas/font')
-rw-r--r-- | xfa/fgas/font/cfgas_fontmgr.h | 4 | ||||
-rw-r--r-- | xfa/fgas/font/cfgas_gefont.cpp | 10 | ||||
-rw-r--r-- | xfa/fgas/font/cfgas_gefont.h | 3 |
3 files changed, 4 insertions, 13 deletions
diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h index dffdb8a665..23ab523e78 100644 --- a/xfa/fgas/font/cfgas_fontmgr.h +++ b/xfa/fgas/font/cfgas_fontmgr.h @@ -21,10 +21,6 @@ #include "third_party/freetype/include/freetype/fttypes.h" #include "xfa/fgas/crt/fgas_stream.h" -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ -#include "xfa/fgas/crt/fgas_utils.h" -#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - #define FX_FONTSTYLE_Normal 0x00 #define FX_FONTSTYLE_FixedPitch 0x01 #define FX_FONTSTYLE_Serif 0x02 diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp index a57962d084..2d5a927cde 100644 --- a/xfa/fgas/font/cfgas_gefont.cpp +++ b/xfa/fgas/font/cfgas_gefont.cpp @@ -216,10 +216,6 @@ bool CFGAS_GEFont::InitFont() { if (!m_pFontEncoding) return false; } - if (!m_pCharWidthMap) { - m_pCharWidthMap = - pdfium::MakeUnique<CFX_DiscreteArrayTemplate<uint16_t>>(1024); - } return true; } @@ -273,8 +269,8 @@ bool CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode, int32_t& iWidth, bool bRecursive, bool bCharCode) { - ASSERT(m_pCharWidthMap); - iWidth = m_pCharWidthMap->GetAt(wUnicode, 0); + auto it = m_CharWidthMap.find(wUnicode); + iWidth = it != m_CharWidthMap.end() ? it->second : 0; if (iWidth == 65535) return false; @@ -299,7 +295,7 @@ bool CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode, iWidth = -1; } } - m_pCharWidthMap->SetAtGrow(wUnicode, iWidth); + m_CharWidthMap[wUnicode] = iWidth; return iWidth > 0; } diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h index 2201721a93..0a8e7bad76 100644 --- a/xfa/fgas/font/cfgas_gefont.h +++ b/xfa/fgas/font/cfgas_gefont.h @@ -13,7 +13,6 @@ #include "core/fxcrt/cfx_retain_ptr.h" #include "core/fxcrt/fx_memory.h" -#include "xfa/fgas/crt/fgas_utils.h" #include "xfa/fgas/font/cfgas_fontmgr.h" #define FXFONT_SUBST_ITALIC 0x02 @@ -108,7 +107,7 @@ class CFGAS_GEFont : public CFX_Retainable { CFX_RetainPtr<IFGAS_Stream> m_pStream; CFX_RetainPtr<IFX_SeekableReadStream> m_pFileRead; std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding; - std::unique_ptr<CFX_DiscreteArrayTemplate<uint16_t>> m_pCharWidthMap; + std::map<FX_WCHAR, int32_t> m_CharWidthMap; std::map<FX_WCHAR, CFX_Rect> m_BBoxMap; CXFA_PDFFontMgr* m_pProvider; // not owned. std::vector<CFX_RetainPtr<CFGAS_GEFont>> m_SubstFonts; |