summaryrefslogtreecommitdiff
path: root/xfa/fxfa/cxfa_fontmgr.cpp
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-09-18 14:23:18 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-18 18:40:16 +0000
commit275e260a6cd4a8e506ba974feb85ebcd926c1739 (patch)
tree2029b9158ec044764ceff122fe5fb5d0a3f123d1 /xfa/fxfa/cxfa_fontmgr.cpp
parent450fbeaaabf1ab340c1018de2e58f1950657517e (diff)
downloadpdfium-275e260a6cd4a8e506ba974feb85ebcd926c1739.tar.xz
Convert string class names
Automated using git grep & sed. Replace StringC classes with StringView classes. Remove the CFX_ prefix and put string classes in fxcrt namespace. Change AsStringC() to AsStringView(). Rename tests from TEST(fxcrt, *String*Foo) to TEST(*String*, Foo). Couple of tests needed to have their names regularlized. BUG=pdfium:894 Change-Id: I7ca038685c8d803795f3ed02545124f7a224c83d Reviewed-on: https://pdfium-review.googlesource.com/14151 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_fontmgr.cpp')
-rw-r--r--xfa/fxfa/cxfa_fontmgr.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/xfa/fxfa/cxfa_fontmgr.cpp b/xfa/fxfa/cxfa_fontmgr.cpp
index 81e296f8a4..b47ce6b21d 100644
--- a/xfa/fxfa/cxfa_fontmgr.cpp
+++ b/xfa/fxfa/cxfa_fontmgr.cpp
@@ -1700,8 +1700,7 @@ const XFA_FONTINFO g_XFAFontsMap[] = {
} // namespace
-CFX_WideString XFA_LocalFontNameToEnglishName(
- const CFX_WideStringC& wsLocalName) {
+WideString XFA_LocalFontNameToEnglishName(const WideStringView& wsLocalName) {
uint32_t dwLocalNameHash = FX_HashCode_GetW(wsLocalName, true);
const XFA_FONTINFO* pEnd = g_XFAFontsMap + FX_ArraySize(g_XFAFontsMap);
const XFA_FONTINFO* pFontInfo =
@@ -1711,15 +1710,15 @@ CFX_WideString XFA_LocalFontNameToEnglishName(
});
if (pFontInfo < pEnd && pFontInfo->dwFontNameHash == dwLocalNameHash)
return pFontInfo->pPsName;
- return CFX_WideString(wsLocalName);
+ return WideString(wsLocalName);
}
const XFA_FONTINFO* XFA_GetFontINFOByFontName(
- const CFX_WideStringC& wsFontName) {
- CFX_WideString wsFontNameTemp(wsFontName);
+ const WideStringView& wsFontName) {
+ WideString wsFontNameTemp(wsFontName);
wsFontNameTemp.Remove(L' ');
uint32_t dwCurFontNameHash =
- FX_HashCode_GetW(wsFontNameTemp.AsStringC(), true);
+ FX_HashCode_GetW(wsFontNameTemp.AsStringView(), true);
const XFA_FONTINFO* pEnd = g_XFAFontsMap + FX_ArraySize(g_XFAFontsMap);
const XFA_FONTINFO* pFontInfo =
std::lower_bound(g_XFAFontsMap, pEnd, dwCurFontNameHash,
@@ -1737,25 +1736,25 @@ CXFA_FontMgr::~CXFA_FontMgr() {}
CFX_RetainPtr<CFGAS_GEFont> CXFA_FontMgr::GetFont(
CXFA_FFDoc* hDoc,
- const CFX_WideStringC& wsFontFamily,
+ const WideStringView& wsFontFamily,
uint32_t dwFontStyles,
uint16_t wCodePage) {
uint32_t dwHash = FX_HashCode_GetW(wsFontFamily, false);
- CFX_ByteString bsKey;
+ ByteString bsKey;
bsKey.Format("%u%u%u", dwHash, dwFontStyles, wCodePage);
auto iter = m_FontMap.find(bsKey);
if (iter != m_FontMap.end())
return iter->second;
- CFX_WideString wsEnglishName = XFA_LocalFontNameToEnglishName(wsFontFamily);
+ WideString wsEnglishName = XFA_LocalFontNameToEnglishName(wsFontFamily);
auto it = m_PDFFontMgrMap.find(hDoc);
CXFA_PDFFontMgr* pMgr =
it != m_PDFFontMgrMap.end() ? it->second.get() : nullptr;
CPDF_Font* pPDFFont = nullptr;
CFX_RetainPtr<CFGAS_GEFont> pFont;
if (pMgr) {
- pFont =
- pMgr->GetFont(wsEnglishName.AsStringC(), dwFontStyles, &pPDFFont, true);
+ pFont = pMgr->GetFont(wsEnglishName.AsStringView(), dwFontStyles, &pPDFFont,
+ true);
if (pFont)
return pFont;
}
@@ -1764,7 +1763,7 @@ CFX_RetainPtr<CFGAS_GEFont> CXFA_FontMgr::GetFont(
if (!pFont && pMgr) {
pPDFFont = nullptr;
- pFont = pMgr->GetFont(wsEnglishName.AsStringC(), dwFontStyles, &pPDFFont,
+ pFont = pMgr->GetFont(wsEnglishName.AsStringView(), dwFontStyles, &pPDFFont,
false);
if (pFont)
return pFont;