Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: xfa/fgas/font/fgas_gefont.cpp

Issue 2083943003: Use FXFONT defines in place of integers. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: build Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: xfa/fgas/font/fgas_gefont.cpp
diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp
index c07455556ce3e8fef5f521d16f2dc163139eed3f..55c57ff9bed95cd7ed75bcc2886c2675297c746f 100644
--- a/xfa/fgas/font/fgas_gefont.cpp
+++ b/xfa/fgas/font/fgas_gefont.cpp
@@ -83,8 +83,7 @@ CFGAS_GEFont::CFGAS_GEFont(IFGAS_FontMgr* pFontMgr)
m_pCharWidthMap(NULL),
m_pRectArray(NULL),
m_pBBoxMap(NULL),
- m_pProvider(NULL),
- m_wCharSet(0xFFFF) {
+ m_pProvider(NULL) {
}
CFGAS_GEFont::CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles)
@@ -103,8 +102,7 @@ CFGAS_GEFont::CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles)
m_pCharWidthMap(NULL),
m_pRectArray(NULL),
m_pBBoxMap(NULL),
- m_pProvider(NULL),
- m_wCharSet(0xFFFF) {
+ m_pProvider(NULL) {
ASSERT(src.m_pFont);
m_pFont = new CFX_Font;
m_pFont->LoadClone(src.m_pFont);
@@ -189,11 +187,6 @@ FX_BOOL CFGAS_GEFont::LoadFontInternal(const FX_WCHAR* pszFontFamily,
}
int32_t iWeight =
(dwFontStyles & FX_FONTSTYLE_Bold) ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL;
- uint16_t wCharSet = FX_GetCharsetFromCodePage(wCodePage);
- if (wCharSet == 0xFFFF) {
- wCharSet = FXSYS_GetACP();
- }
- m_wCharSet = wCharSet;
m_pFont = new CFX_Font;
if ((dwFlags & FXFONT_ITALIC) && (dwFlags & FXFONT_BOLD)) {
csFontFamily += ",BoldItalic";
@@ -203,23 +196,19 @@ FX_BOOL CFGAS_GEFont::LoadFontInternal(const FX_WCHAR* pszFontFamily,
csFontFamily += ",Italic";
}
m_pFont->LoadSubst(csFontFamily, TRUE, dwFlags, iWeight, 0, wCodePage);
- FX_BOOL bRet = m_pFont->GetFace() != nullptr;
- if (bRet) {
- bRet = InitFont();
- }
- return bRet;
+ if (!m_pFont->GetFace())
+ return false;
+ return InitFont();
}
FX_BOOL CFGAS_GEFont::LoadFontInternal(const uint8_t* pBuffer, int32_t length) {
- if (m_pFont) {
+ if (m_pFont)
return FALSE;
- }
+
m_pFont = new CFX_Font;
FX_BOOL bRet = m_pFont->LoadEmbedded(pBuffer, length);
dsinclair 2016/06/21 20:43:38 if (!m_pFont->LoadEmbedded(pBuffer, length)) ret
Lei Zhang 2016/06/21 20:46:36 Done.
- if (bRet) {
+ if (bRet)
bRet = InitFont();
- }
- m_wCharSet = 0xFFFF;
return bRet;
}
@@ -240,7 +229,6 @@ FX_BOOL CFGAS_GEFont::LoadFontInternal(IFX_Stream* pFontStream,
m_pFileRead->Release();
m_pFileRead = nullptr;
}
- m_wCharSet = 0xFFFF;
return bRet;
}
#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
@@ -251,7 +239,6 @@ FX_BOOL CFGAS_GEFont::LoadFontInternal(CFX_Font* pExtFont) {
}
m_pFont = pExtFont;
m_bExtFont = TRUE;
- m_wCharSet = 0xFFFF;
return InitFont();
}
@@ -272,21 +259,13 @@ FX_BOOL CFGAS_GEFont::InitFont() {
return TRUE;
}
+
CFGAS_GEFont* CFGAS_GEFont::Derive(uint32_t dwFontStyles, uint16_t wCodePage) {
- if (GetFontStyles() == dwFontStyles) {
+ if (GetFontStyles() == dwFontStyles)
return Retain();
- }
return new CFGAS_GEFont(*this, dwFontStyles);
}
-uint8_t CFGAS_GEFont::GetCharSet() const {
- if (m_wCharSet != 0xFFFF) {
- return (uint8_t)m_wCharSet;
- }
- if (!m_pFont->GetSubstFont()) {
- return FX_CHARSET_Default;
- }
- return m_pFont->GetSubstFont()->m_Charset;
-}
+
void CFGAS_GEFont::GetFamilyName(CFX_WideString& wsFamily) const {
if (!m_pFont->GetSubstFont() ||
m_pFont->GetSubstFont()->m_Family.GetLength() == 0) {

Powered by Google App Engine
This is Rietveld 408576698