From a4fdfc5ed0e8d2e6acc52cc34eac42c6072f0ccc Mon Sep 17 00:00:00 2001 From: thestig Date: Tue, 7 Jun 2016 17:33:37 -0700 Subject: Replace IFGAS_Font with underlying concrete type Review-Url: https://codereview.chromium.org/2037563002 --- xfa/fxfa/app/xfa_ffwidgetacc.cpp | 2 +- xfa/fxfa/app/xfa_fontmgr.cpp | 56 +++++++++++++++++++++------------------- xfa/fxfa/app/xfa_fwltheme.cpp | 5 ++-- xfa/fxfa/app/xfa_fwltheme.h | 2 +- xfa/fxfa/app/xfa_textlayout.cpp | 4 +-- xfa/fxfa/app/xfa_textlayout.h | 6 ++--- 6 files changed, 39 insertions(+), 36 deletions(-) (limited to 'xfa/fxfa/app') diff --git a/xfa/fxfa/app/xfa_ffwidgetacc.cpp b/xfa/fxfa/app/xfa_ffwidgetacc.cpp index c440848941..1a579e222e 100644 --- a/xfa/fxfa/app/xfa_ffwidgetacc.cpp +++ b/xfa/fxfa/app/xfa_ffwidgetacc.cpp @@ -1517,7 +1517,7 @@ CXFA_WidgetLayoutData* CXFA_WidgetAcc::GetWidgetLayoutData() { return m_pLayoutData.get(); } -IFGAS_Font* CXFA_WidgetAcc::GetFDEFont() { +CFGAS_GEFont* CXFA_WidgetAcc::GetFDEFont() { CFX_WideStringC wsFontName = FX_WSTRC(L"Courier"); uint32_t dwFontStyle = 0; if (CXFA_Font font = GetFont()) { diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index ed93b16ad2..964c0352b8 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -12,6 +12,7 @@ #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "xfa/fgas/font/fgas_gefont.h" #include "xfa/fxfa/include/xfa_ffapp.h" #include "xfa/fxfa/include/xfa_ffdoc.h" @@ -1742,13 +1743,13 @@ CXFA_DefFontMgr::~CXFA_DefFontMgr() { m_CacheFonts[i]->Release(); } -IFGAS_Font* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { +CFGAS_GEFont* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, + const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { CFX_WideString wsFontName(wsFontFamily); IFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); - IFGAS_Font* pFont = + CFGAS_GEFont* pFont = pFDEFontMgr->LoadFont(wsFontName.c_str(), dwFontStyles, wCodePage); if (!pFont) { const XFA_FONTINFO* pCurFont = @@ -1787,12 +1788,13 @@ IFGAS_Font* CXFA_DefFontMgr::GetFont(CXFA_FFDoc* hDoc, return pFont; } -IFGAS_Font* CXFA_DefFontMgr::GetDefaultFont(CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { +CFGAS_GEFont* CXFA_DefFontMgr::GetDefaultFont( + CXFA_FFDoc* hDoc, + const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { IFGAS_FontMgr* pFDEFontMgr = hDoc->GetApp()->GetFDEFontMgr(); - IFGAS_Font* pFont = + CFGAS_GEFont* pFont = pFDEFontMgr->LoadFont(L"Arial Narrow", dwFontStyles, wCodePage); if (!pFont) pFont = @@ -1824,11 +1826,11 @@ CXFA_PDFFontMgr::~CXFA_PDFFontMgr() { pair.second->Release(); } } -IFGAS_Font* CXFA_PDFFontMgr::FindFont(CFX_ByteString strPsName, - FX_BOOL bBold, - FX_BOOL bItalic, - CPDF_Font** pDstPDFFont, - FX_BOOL bStrictMatch) { +CFGAS_GEFont* CXFA_PDFFontMgr::FindFont(CFX_ByteString strPsName, + FX_BOOL bBold, + FX_BOOL bItalic, + CPDF_Font** pDstPDFFont, + FX_BOOL bStrictMatch) { CPDF_Document* pDoc = m_pDoc->GetPDFDoc(); if (pDoc == NULL) { return NULL; @@ -1867,15 +1869,15 @@ IFGAS_Font* CXFA_PDFFontMgr::FindFont(CFX_ByteString strPsName, *pDstPDFFont = pPDFFont; return NULL; } - return IFGAS_Font::LoadFont(&pPDFFont->m_Font, pFDEFontMgr); + return CFGAS_GEFont::LoadFont(&pPDFFont->m_Font, pFDEFontMgr, FALSE); } return NULL; } -IFGAS_Font* CXFA_PDFFontMgr::GetFont(const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - CPDF_Font** pPDFFont, - FX_BOOL bStrictMatch) { +CFGAS_GEFont* CXFA_PDFFontMgr::GetFont(const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + CPDF_Font** pPDFFont, + FX_BOOL bStrictMatch) { uint32_t dwHashCode = FX_HashCode_GetW(wsFontFamily, false); CFX_ByteString strKey; strKey.Format("%u%u", dwHashCode, dwFontStyles); @@ -1887,7 +1889,7 @@ IFGAS_Font* CXFA_PDFFontMgr::GetFont(const CFX_WideStringC& wsFontFamily, FX_BOOL bBold = (dwFontStyles & FX_FONTSTYLE_Bold) == FX_FONTSTYLE_Bold; FX_BOOL bItalic = (dwFontStyles & FX_FONTSTYLE_Italic) == FX_FONTSTYLE_Italic; CFX_ByteString strFontName = PsNameToFontName(bsPsName, bBold, bItalic); - IFGAS_Font* pFont = + CFGAS_GEFont* pFont = FindFont(strFontName, bBold, bItalic, pPDFFont, bStrictMatch); if (pFont) m_FontMap[strKey] = pFont; @@ -1982,7 +1984,7 @@ FX_BOOL CXFA_PDFFontMgr::PsNameMatchDRFontName( } return TRUE; } -FX_BOOL CXFA_PDFFontMgr::GetCharWidth(IFGAS_Font* pFont, +FX_BOOL CXFA_PDFFontMgr::GetCharWidth(CFGAS_GEFont* pFont, FX_WCHAR wUnicode, int32_t& iWidth, FX_BOOL bCharCode) { @@ -2002,10 +2004,10 @@ CXFA_FontMgr::CXFA_FontMgr() {} CXFA_FontMgr::~CXFA_FontMgr() {} -IFGAS_Font* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc, - const CFX_WideStringC& wsFontFamily, - uint32_t dwFontStyles, - uint16_t wCodePage) { +CFGAS_GEFont* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc, + const CFX_WideStringC& wsFontFamily, + uint32_t dwFontStyles, + uint16_t wCodePage) { uint32_t dwHash = FX_HashCode_GetW(wsFontFamily, false); CFX_ByteString bsKey; bsKey.Format("%u%u%u", dwHash, dwFontStyles, wCodePage); @@ -2018,7 +2020,7 @@ IFGAS_Font* CXFA_FontMgr::GetFont(CXFA_FFDoc* hDoc, CXFA_PDFFontMgr* pMgr = it != m_PDFFontMgrMap.end() ? it->second.get() : nullptr; CPDF_Font* pPDFFont = nullptr; - IFGAS_Font* pFont = nullptr; + CFGAS_GEFont* pFont = nullptr; if (pMgr) { pFont = pMgr->GetFont(wsEnglishName.AsStringC(), dwFontStyles, &pPDFFont); if (pFont) diff --git a/xfa/fxfa/app/xfa_fwltheme.cpp b/xfa/fxfa/app/xfa_fwltheme.cpp index 0c8e346066..e2e1b29c08 100644 --- a/xfa/fxfa/app/xfa_fwltheme.cpp +++ b/xfa/fxfa/app/xfa_fwltheme.cpp @@ -8,6 +8,7 @@ #include "xfa/fde/tto/fde_textout.h" #include "xfa/fgas/crt/fgas_codepage.h" +#include "xfa/fgas/font/fgas_gefont.h" #include "xfa/fwl/basewidget/ifwl_barcode.h" #include "xfa/fwl/basewidget/ifwl_caret.h" #include "xfa/fwl/basewidget/ifwl_checkbox.h" @@ -78,8 +79,8 @@ FWL_Error CXFA_FWLTheme::Initialize() { m_pTextOut.reset(new CFDE_TextOut); for (size_t i = 0; !m_pCalendarFont && i < FX_ArraySize(g_FWLTheme_CalFonts); ++i) { - m_pCalendarFont = IFGAS_Font::LoadFont(g_FWLTheme_CalFonts[i], 0, 0, - m_pApp->GetFDEFontMgr()); + m_pCalendarFont = CFGAS_GEFont::LoadFont(g_FWLTheme_CalFonts[i], 0, 0, + m_pApp->GetFDEFontMgr()); } if (!m_pCalendarFont) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ diff --git a/xfa/fxfa/app/xfa_fwltheme.h b/xfa/fxfa/app/xfa_fwltheme.h index b73239c003..fdd12c37ba 100644 --- a/xfa/fxfa/app/xfa_fwltheme.h +++ b/xfa/fxfa/app/xfa_fwltheme.h @@ -81,7 +81,7 @@ class CXFA_FWLTheme final : public IFWL_ThemeProvider { std::unique_ptr m_pTextOut; FX_FLOAT m_fCapacity; uint32_t m_dwCapacity; - IFGAS_Font* m_pCalendarFont; + CFGAS_GEFont* m_pCalendarFont; CFX_WideString m_wsResource; CXFA_FFApp* m_pApp; CFX_RectF m_Rect; diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index c40e29c04b..4e23fc39f9 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -332,8 +332,8 @@ FX_BOOL CXFA_TextParser::IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const { } return FALSE; } -IFGAS_Font* CXFA_TextParser::GetFont(CXFA_TextProvider* pTextProvider, - IFDE_CSSComputedStyle* pStyle) const { +CFGAS_GEFont* CXFA_TextParser::GetFont(CXFA_TextProvider* pTextProvider, + IFDE_CSSComputedStyle* pStyle) const { CFX_WideStringC wsFamily = FX_WSTRC(L"Courier"); uint32_t dwStyle = 0; CXFA_Font font = pTextProvider->GetFontNode(); diff --git a/xfa/fxfa/app/xfa_textlayout.h b/xfa/fxfa/app/xfa_textlayout.h index a4bd9cede7..842c6ec731 100644 --- a/xfa/fxfa/app/xfa_textlayout.h +++ b/xfa/fxfa/app/xfa_textlayout.h @@ -95,8 +95,8 @@ class CXFA_TextParser { FX_BOOL IsSpaceRun(IFDE_CSSComputedStyle* pStyle) const; FX_BOOL GetTabstops(IFDE_CSSComputedStyle* pStyle, CXFA_TextTabstopsContext* pTabstopContext); - IFGAS_Font* GetFont(CXFA_TextProvider* pTextProvider, - IFDE_CSSComputedStyle* pStyle) const; + CFGAS_GEFont* GetFont(CXFA_TextProvider* pTextProvider, + IFDE_CSSComputedStyle* pStyle) const; FX_FLOAT GetFontSize(CXFA_TextProvider* pTextProvider, IFDE_CSSComputedStyle* pStyle) const; int32_t GetHorScale(CXFA_TextProvider* pTextProvider, @@ -259,7 +259,7 @@ class XFA_TextPiece : public CFX_Target { int32_t iUnderline; int32_t iPeriod; int32_t iLineThrough; - IFGAS_Font* pFont; + CFGAS_GEFont* pFont; FX_ARGB dwColor; FX_FLOAT fFontSize; CFX_RectF rtPiece; -- cgit v1.2.3