summaryrefslogtreecommitdiff
path: root/core/fpdfapi/font
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-09-28 15:59:42 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-28 20:40:36 +0000
commit10e1f05a9e644cd954792bcd40ef787551cbd209 (patch)
treed203254a0a2c856a9b8ba5a0445a883c7072dd77 /core/fpdfapi/font
parentdd0e6e1eba14c76dedd4b4e55ab47406856c9a76 (diff)
downloadpdfium-10e1f05a9e644cd954792bcd40ef787551cbd209.tar.xz
Cleanup font defines
Use methods to match font information; cleanup some font code. Change-Id: Ib99c1e466e56723cb5d264d49e1caf9bbbc0daed Reviewed-on: https://pdfium-review.googlesource.com/15072 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/font')
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.cpp2
-rw-r--r--core/fpdfapi/font/cpdf_font.cpp2
-rw-r--r--core/fpdfapi/font/cpdf_simplefont.cpp6
-rw-r--r--core/fpdfapi/font/cpdf_truetypefont.cpp6
-rw-r--r--core/fpdfapi/font/cpdf_type1font.cpp6
5 files changed, 11 insertions, 11 deletions
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index 611afc0787..0140cc8a23 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -618,7 +618,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
#if _FX_PLATFORM_ != _FX_PLATFORM_APPLE_
return cid;
#else
- if (m_Flags & FXFONT_SYMBOLIC)
+ if (FontStyleIsSymbolic(m_Flags))
return cid;
WideString uni_str = UnicodeFromCharCode(charcode);
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index 9aaaa27b2e..12e5aaf3a8 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -375,7 +375,7 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
iBaseEncoding == PDFFONT_ENCODING_ZAPFDINGBATS) {
return;
}
- if ((m_Flags & FXFONT_SYMBOLIC) && m_BaseFont == "Symbol") {
+ if (FontStyleIsSymbolic(m_Flags) && m_BaseFont == "Symbol") {
if (!bTrueType)
iBaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL;
return;
diff --git a/core/fpdfapi/font/cpdf_simplefont.cpp b/core/fpdfapi/font/cpdf_simplefont.cpp
index ccf514db07..92965b0948 100644
--- a/core/fpdfapi/font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/font/cpdf_simplefont.cpp
@@ -134,7 +134,7 @@ bool CPDF_SimpleFont::LoadCommon() {
} else {
LoadSubstFont();
}
- if (!(m_Flags & FXFONT_SYMBOLIC))
+ if (!FontStyleIsSymbolic(m_Flags))
m_BaseEncoding = PDFFONT_ENCODING_STANDARD;
CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectFor("Encoding");
LoadPDFEncoding(pEncoding, m_BaseEncoding, &m_CharNames, !!m_pFontFile,
@@ -144,7 +144,7 @@ bool CPDF_SimpleFont::LoadCommon() {
if (!m_Font.GetFace())
return true;
- if (m_Flags & FXFONT_ALLCAP) {
+ if (FontStyleIsAllCaps(m_Flags)) {
unsigned char kLowercases[][2] = {{'a', 'z'}, {0xe0, 0xf6}, {0xf8, 0xfd}};
for (size_t range = 0; range < FX_ArraySize(kLowercases); ++range) {
const auto& lower = kLowercases[range];
@@ -166,7 +166,7 @@ bool CPDF_SimpleFont::LoadCommon() {
}
void CPDF_SimpleFont::LoadSubstFont() {
- if (!m_bUseFontWidth && !(m_Flags & FXFONT_FIXED_PITCH)) {
+ if (!m_bUseFontWidth && !FontStyleIsFixedPitch(m_Flags)) {
int width = 0, i;
for (i = 0; i < 256; i++) {
if (m_CharWidth[i] == 0 || m_CharWidth[i] == 0xffff)
diff --git a/core/fpdfapi/font/cpdf_truetypefont.cpp b/core/fpdfapi/font/cpdf_truetypefont.cpp
index a0542ecba4..91c238a1b4 100644
--- a/core/fpdfapi/font/cpdf_truetypefont.cpp
+++ b/core/fpdfapi/font/cpdf_truetypefont.cpp
@@ -41,7 +41,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
if (m_pFontFile && m_Font.GetFace()->num_charmaps > 0 &&
(baseEncoding == PDFFONT_ENCODING_MACROMAN ||
baseEncoding == PDFFONT_ENCODING_WINANSI) &&
- (m_Flags & FXFONT_SYMBOLIC)) {
+ FontStyleIsSymbolic(m_Flags)) {
bool bSupportWin = false;
bool bSupportMac = false;
for (int i = 0; i < FXFT_Get_Face_CharmapCount(m_Font.GetFace()); i++) {
@@ -64,7 +64,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
if (((baseEncoding == PDFFONT_ENCODING_MACROMAN ||
baseEncoding == PDFFONT_ENCODING_WINANSI) &&
m_CharNames.empty()) ||
- (m_Flags & FXFONT_NONSYMBOLIC)) {
+ FontStyleIsNonSymbolic(m_Flags)) {
if (!FXFT_Has_Glyph_Names(m_Font.GetFace()) &&
(!m_Font.GetFace()->num_charmaps || !m_Font.GetFace()->charmaps)) {
int nStartChar = m_pFontDict->GetIntegerFor("FirstChar");
@@ -83,7 +83,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
bool bMacRoman = false;
bool bMSSymbol = false;
if (!bMSUnicode) {
- if (m_Flags & FXFONT_NONSYMBOLIC) {
+ if (FontStyleIsNonSymbolic(m_Flags)) {
bMacRoman = FT_UseTTCharmap(m_Font.GetFace(), 1, 0);
bMSSymbol = !bMacRoman && FT_UseTTCharmap(m_Font.GetFace(), 3, 0);
} else {
diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp
index 296351fc82..9975943d9a 100644
--- a/core/fpdfapi/font/cpdf_type1font.cpp
+++ b/core/fpdfapi/font/cpdf_type1font.cpp
@@ -93,7 +93,7 @@ bool CPDF_Type1Font::Load() {
m_BaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL;
else if (m_Base14Font == 13)
m_BaseEncoding = PDFFONT_ENCODING_ZAPFDINGBATS;
- else if (m_Flags & FXFONT_NONSYMBOLIC)
+ else if (FontStyleIsNonSymbolic(m_Flags))
m_BaseEncoding = PDFFONT_ENCODING_STANDARD;
}
return LoadCommon();
@@ -188,7 +188,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
FT_UseType1Charmap(m_Font.GetFace());
#if _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
if (bCoreText) {
- if (m_Flags & FXFONT_SYMBOLIC) {
+ if (FontStyleIsSymbolic(m_Flags)) {
for (int charcode = 0; charcode < 256; charcode++) {
const char* name =
GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
@@ -255,7 +255,7 @@ void CPDF_Type1Font::LoadGlyphMap() {
return;
}
#endif // _FX_PLATFORM_ == _FX_PLATFORM_APPLE_
- if (m_Flags & FXFONT_SYMBOLIC) {
+ if (FontStyleIsSymbolic(m_Flags)) {
for (int charcode = 0; charcode < 256; charcode++) {
const char* name =
GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);