summaryrefslogtreecommitdiff
path: root/xfa/fgas/font/cfgas_gefont.cpp
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-09-28 11:51:24 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-28 20:39:56 +0000
commitdd0e6e1eba14c76dedd4b4e55ab47406856c9a76 (patch)
tree36f27e3ec86b5c376d51bcd753cbdfbe3402e6c7 /xfa/fgas/font/cfgas_gefont.cpp
parent58418a24debb15019ec71eca193eff02c2a4846c (diff)
downloadpdfium-dd0e6e1eba14c76dedd4b4e55ab47406856c9a76.tar.xz
Cleanup font defines
This CL removes duplicate defines between XFA and core. Several OR'd values have been coverted into individual booleans to make the code clearer. Change-Id: Ic32a71c711cffd9a0cf1136e5a22f0502e085c39 Reviewed-on: https://pdfium-review.googlesource.com/15071 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fgas/font/cfgas_gefont.cpp')
-rw-r--r--xfa/fgas/font/cfgas_gefont.cpp44
1 files changed, 16 insertions, 28 deletions
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index 58b1381a38..f364e6c506 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -85,9 +85,9 @@ CFGAS_GEFont::CFGAS_GEFont(const RetainPtr<CFGAS_GEFont>& src,
m_pFont->SetSubstFont(std::unique_ptr<CFX_SubstFont>(pSubst));
}
pSubst->m_Weight =
- (dwFontStyles & FX_FONTSTYLE_Bold) ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL;
- if (dwFontStyles & FX_FONTSTYLE_Italic)
- pSubst->m_SubstFlags |= FXFONT_SUBST_ITALIC;
+ (dwFontStyles & FXFONT_BOLD) ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL;
+ if (dwFontStyles & FXFONT_ITALIC)
+ pSubst->m_bFlagItalic = true;
InitFont();
}
@@ -105,31 +105,19 @@ bool CFGAS_GEFont::LoadFontInternal(const wchar_t* pszFontFamily,
ByteString csFontFamily;
if (pszFontFamily)
csFontFamily = ByteString::FromUnicode(pszFontFamily);
- uint32_t dwFlags = 0;
- if (dwFontStyles & FX_FONTSTYLE_FixedPitch)
- dwFlags |= FXFONT_FIXED_PITCH;
- if (dwFontStyles & FX_FONTSTYLE_Serif)
- dwFlags |= FXFONT_SERIF;
- if (dwFontStyles & FX_FONTSTYLE_Symbolic)
- dwFlags |= FXFONT_SYMBOLIC;
- if (dwFontStyles & FX_FONTSTYLE_Script)
- dwFlags |= FXFONT_SCRIPT;
- if (dwFontStyles & FX_FONTSTYLE_Italic)
- dwFlags |= FXFONT_ITALIC;
- if (dwFontStyles & FX_FONTSTYLE_Bold)
- dwFlags |= FXFONT_BOLD;
- if (dwFontStyles & FX_FONTSTYLE_ExactMatch)
- dwFlags |= FXFONT_EXACTMATCH;
+
int32_t iWeight =
- (dwFontStyles & FX_FONTSTYLE_Bold) ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL;
+ (dwFontStyles & FXFONT_BOLD) ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL;
m_pFont = new CFX_Font;
- if ((dwFlags & FXFONT_ITALIC) && (dwFlags & FXFONT_BOLD))
+ if ((dwFontStyles & FXFONT_ITALIC) && (dwFontStyles & FXFONT_BOLD))
csFontFamily += ",BoldItalic";
- else if (dwFlags & FXFONT_BOLD)
+ else if (dwFontStyles & FXFONT_BOLD)
csFontFamily += ",Bold";
- else if (dwFlags & FXFONT_ITALIC)
+ else if (dwFontStyles & FXFONT_ITALIC)
csFontFamily += ",Italic";
- m_pFont->LoadSubst(csFontFamily, true, dwFlags, iWeight, 0, wCodePage, false);
+
+ m_pFont->LoadSubst(csFontFamily, true, dwFontStyles, iWeight, 0, wCodePage,
+ false);
if (!m_pFont->GetFace())
return false;
return InitFont();
@@ -195,14 +183,14 @@ uint32_t CFGAS_GEFont::GetFontStyles() const {
auto* pSubstFont = m_pFont->GetSubstFont();
if (pSubstFont) {
if (pSubstFont->m_Weight == FXFONT_FW_BOLD)
- dwStyles |= FX_FONTSTYLE_Bold;
- if (pSubstFont->m_SubstFlags & FXFONT_SUBST_ITALIC)
- dwStyles |= FX_FONTSTYLE_Italic;
+ dwStyles |= FXFONT_BOLD;
+ if (pSubstFont->m_bFlagItalic)
+ dwStyles |= FXFONT_ITALIC;
} else {
if (m_pFont->IsBold())
- dwStyles |= FX_FONTSTYLE_Bold;
+ dwStyles |= FXFONT_BOLD;
if (m_pFont->IsItalic())
- dwStyles |= FX_FONTSTYLE_Italic;
+ dwStyles |= FXFONT_ITALIC;
}
return dwStyles;
}