Add enum FontStyle
Replace a set of #defines with an enum.
Bug: 42270078
Change-Id: I2ec35d09e469a9f763b061f2cd12b42ee2a0e272
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/126951
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index 5debeb3..cf6437a 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -149,7 +149,7 @@
}
void CPDF_Font::LoadFontDescriptor(const CPDF_Dictionary* pFontDesc) {
- m_Flags = pFontDesc->GetIntegerFor("Flags", FXFONT_NONSYMBOLIC);
+ m_Flags = pFontDesc->GetIntegerFor("Flags", pdfium::kFontStyleNonSymbolic);
int ItalicAngle = 0;
bool bExistItalicAngle = false;
if (pFontDesc->KeyExist("ItalicAngle")) {
@@ -157,7 +157,7 @@
bExistItalicAngle = true;
}
if (ItalicAngle < 0) {
- m_Flags |= FXFONT_ITALIC;
+ m_Flags |= pdfium::kFontStyleItalic;
m_ItalicAngle = ItalicAngle;
}
bool bExistStemV = false;
diff --git a/core/fpdfapi/font/cpdf_simplefont.cpp b/core/fpdfapi/font/cpdf_simplefont.cpp
index ce99662..08d2157 100644
--- a/core/fpdfapi/font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/font/cpdf_simplefont.cpp
@@ -280,7 +280,7 @@
}
}
if (i == kInternalTableSize && width) {
- m_Flags |= FXFONT_FIXED_PITCH;
+ m_Flags |= pdfium::kFontStyleFixedPitch;
}
}
diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp
index 49e5d87..126a9e0 100644
--- a/core/fpdfapi/font/cpdf_type1font.cpp
+++ b/core/fpdfapi/font/cpdf_type1font.cpp
@@ -101,9 +101,9 @@
if (pFontDesc && pFontDesc->KeyExist("Flags")) {
m_Flags = pFontDesc->GetIntegerFor("Flags");
} else if (IsSymbolicFont()) {
- m_Flags = FXFONT_SYMBOLIC;
+ m_Flags = pdfium::kFontStyleSymbolic;
} else {
- m_Flags = FXFONT_NONSYMBOLIC;
+ m_Flags = pdfium::kFontStyleNonSymbolic;
}
if (IsFixedFont()) {
std::fill(std::begin(m_CharWidth), std::end(m_CharWidth), 600);
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp
index 0d0cfd0..d6830a5 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.cpp
+++ b/core/fpdfapi/page/cpdf_docpagedata.cpp
@@ -105,20 +105,26 @@
bool script,
bool symbolic) {
int flags = 0;
- if (bold)
- flags |= FXFONT_FORCE_BOLD;
- if (italic)
- flags |= FXFONT_ITALIC;
- if (fixedPitch)
- flags |= FXFONT_FIXED_PITCH;
- if (serif)
- flags |= FXFONT_SERIF;
- if (script)
- flags |= FXFONT_SCRIPT;
- if (symbolic)
- flags |= FXFONT_SYMBOLIC;
- else
- flags |= FXFONT_NONSYMBOLIC;
+ if (bold) {
+ flags |= pdfium::kFontStyleForceBold;
+ }
+ if (italic) {
+ flags |= pdfium::kFontStyleItalic;
+ }
+ if (fixedPitch) {
+ flags |= pdfium::kFontStyleFixedPitch;
+ }
+ if (serif) {
+ flags |= pdfium::kFontStyleSerif;
+ }
+ if (script) {
+ flags |= pdfium::kFontStyleScript;
+ }
+ if (symbolic) {
+ flags |= pdfium::kFontStyleSymbolic;
+ } else {
+ flags |= pdfium::kFontStyleNonSymbolic;
+ }
return flags;
}
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index 23bbb97..32ec3a0 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -406,13 +406,13 @@
const ByteString& file) {
uint32_t style = 0;
if (face->IsBold()) {
- style |= FXFONT_FORCE_BOLD;
+ style |= pdfium::kFontStyleForceBold;
}
if (face->IsItalic()) {
- style |= FXFONT_ITALIC;
+ style |= pdfium::kFontStyleItalic;
}
if (face->IsFixedWidth()) {
- style |= FXFONT_FIXED_PITCH;
+ style |= pdfium::kFontStyleFixedPitch;
}
uint32_t charset = SKIACHARSET_Default;
@@ -420,7 +420,7 @@
face->GetOs2CodePageRange();
if (code_page_range.has_value()) {
if (code_page_range.value()[0] & (1 << 31)) {
- style |= FXFONT_SYMBOLIC;
+ style |= pdfium::kFontStyleSymbolic;
}
charset |= SkiaGetFaceCharset(code_page_range.value()[0]);
}
@@ -429,7 +429,7 @@
if (panose.has_value() && panose.value()[0] == 2) {
uint8_t serif = panose.value()[1];
if ((serif > 1 && serif < 10) || serif > 13) {
- style |= FXFONT_SERIF;
+ style |= pdfium::kFontStyleSerif;
}
}
diff --git a/core/fxge/android/cfx_androidfontinfo.cpp b/core/fxge/android/cfx_androidfontinfo.cpp
index 0154b92..c2b293a 100644
--- a/core/fxge/android/cfx_androidfontinfo.cpp
+++ b/core/fxge/android/cfx_androidfontinfo.cpp
@@ -36,20 +36,26 @@
FX_Charset charset,
int pitch_family,
const ByteString& face) {
- if (!m_pFontMgr)
+ if (!m_pFontMgr) {
return nullptr;
+ }
uint32_t dwStyle = 0;
- if (weight >= 700)
- dwStyle |= FXFONT_FORCE_BOLD;
- if (bItalic)
- dwStyle |= FXFONT_ITALIC;
- if (FontFamilyIsFixedPitch(pitch_family))
- dwStyle |= FXFONT_FIXED_PITCH;
- if (FontFamilyIsScript(pitch_family))
- dwStyle |= FXFONT_SCRIPT;
- if (FontFamilyIsRoman(pitch_family))
- dwStyle |= FXFONT_SERIF;
+ if (weight >= 700) {
+ dwStyle |= pdfium::kFontStyleForceBold;
+ }
+ if (bItalic) {
+ dwStyle |= pdfium::kFontStyleItalic;
+ }
+ if (FontFamilyIsFixedPitch(pitch_family)) {
+ dwStyle |= pdfium::kFontStyleFixedPitch;
+ }
+ if (FontFamilyIsScript(pitch_family)) {
+ dwStyle |= pdfium::kFontStyleScript;
+ }
+ if (FontFamilyIsRoman(pitch_family)) {
+ dwStyle |= pdfium::kFontStyleSerif;
+ }
return m_pFontMgr->CreateFont(face.AsStringView(), charset, dwStyle);
}
diff --git a/core/fxge/cfx_folderfontinfo.cpp b/core/fxge/cfx_folderfontinfo.cpp
index 04f2d1d..cda0141 100644
--- a/core/fxge/cfx_folderfontinfo.cpp
+++ b/core/fxge/cfx_folderfontinfo.cpp
@@ -287,12 +287,15 @@
m_pMapper->AddInstalledFont(facename, FX_Charset::kANSI);
pInfo->m_Charsets |= CHARSET_FLAG_ANSI;
pInfo->m_Styles = 0;
- if (style.Contains("Bold"))
- pInfo->m_Styles |= FXFONT_FORCE_BOLD;
- if (style.Contains("Italic") || style.Contains("Oblique"))
- pInfo->m_Styles |= FXFONT_ITALIC;
- if (facename.Contains("Serif"))
- pInfo->m_Styles |= FXFONT_SERIF;
+ if (style.Contains("Bold")) {
+ pInfo->m_Styles |= pdfium::kFontStyleForceBold;
+ }
+ if (style.Contains("Italic") || style.Contains("Oblique")) {
+ pInfo->m_Styles |= pdfium::kFontStyleItalic;
+ }
+ if (facename.Contains("Serif")) {
+ pInfo->m_Styles |= pdfium::kFontStyleSerif;
+ }
m_FontList[facename] = std::move(pInfo);
}
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index fbf7084..83e8c95 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -211,11 +211,11 @@
};
constexpr FX_FontStyle kFontStyles[] = {
- {"Regular", 7, FXFONT_NORMAL},
- {"Reg", 3, FXFONT_NORMAL},
- {"BoldItalic", 10, FXFONT_FORCE_BOLD | FXFONT_ITALIC},
- {"Italic", 6, FXFONT_ITALIC},
- {"Bold", 4, FXFONT_FORCE_BOLD},
+ {"Regular", 7, pdfium::kFontStyleNormal},
+ {"Reg", 3, pdfium::kFontStyleNormal},
+ {"BoldItalic", 10, pdfium::kFontStyleForceBold | pdfium::kFontStyleItalic},
+ {"Italic", 6, pdfium::kFontStyleItalic},
+ {"Bold", 4, pdfium::kFontStyleForceBold},
};
const FX_FontStyle* GetStyleType(ByteStringView font_name,
@@ -256,7 +256,7 @@
*is_style_available = true;
parsed_style = style_result->style;
} else {
- parsed_style = FXFONT_NORMAL;
+ parsed_style = pdfium::kFontStyleNormal;
}
if (FontStyleIsForceBold(parsed_style)) {
@@ -265,18 +265,18 @@
*weight = pdfium::kFontWeightExtraBold;
} else {
*weight = pdfium::kFontWeightBold;
- *style |= FXFONT_FORCE_BOLD;
+ *style |= pdfium::kFontStyleForceBold;
}
is_first_item = false;
}
if (FontStyleIsItalic(parsed_style) && FontStyleIsForceBold(parsed_style)) {
- *style |= FXFONT_ITALIC;
+ *style |= pdfium::kFontStyleItalic;
} else if (FontStyleIsItalic(parsed_style)) {
if (!is_first_item)
return true;
- *style |= FXFONT_ITALIC;
+ *style |= pdfium::kFontStyleItalic;
break;
}
i += buf.GetLength() + 1;
@@ -293,11 +293,13 @@
uint32_t GetStyleFromBaseFont(int base_font) {
int pos = base_font % 4;
- uint32_t style = FXFONT_NORMAL;
- if (pos == 1 || pos == 2)
- style |= FXFONT_FORCE_BOLD;
- if (pos / 2)
- style |= FXFONT_ITALIC;
+ uint32_t style = pdfium::kFontStyleNormal;
+ if (pos == 1 || pos == 2) {
+ style |= pdfium::kFontStyleForceBold;
+ }
+ if (pos / 2) {
+ style |= pdfium::kFontStyleItalic;
+ }
return style;
}
@@ -620,7 +622,7 @@
pitch_family = GetPitchFamilyFromBaseFont(base_font);
} else {
base_font = kNumStandardFonts;
- nStyle = FXFONT_NORMAL;
+ nStyle = pdfium::kFontStyleNormal;
if (!has_comma) {
std::optional<size_t> pos = family.ReverseFind('-');
if (pos.has_value()) {
@@ -690,7 +692,7 @@
}
} else {
italic_angle = 0;
- if (nStyle == FXFONT_NORMAL) {
+ if (nStyle == pdfium::kFontStyleNormal) {
weight = pdfium::kFontWeightNormal;
}
}
@@ -735,7 +737,8 @@
subst_font);
}
#endif
- return FindSubstFont(family, is_truetype, flags & ~FXFONT_SYMBOLIC, weight,
+ return FindSubstFont(family, is_truetype,
+ flags & ~pdfium::kFontStyleSymbolic, weight,
italic_angle, FX_CodePage::kDefANSI, subst_font);
}
diff --git a/core/fxge/fx_font.h b/core/fxge/fx_font.h
index 7d871f2..e892731 100644
--- a/core/fxge/fx_font.h
+++ b/core/fxge/fx_font.h
@@ -17,6 +17,21 @@
namespace pdfium {
+// Defined in ISO 32000-1:2008 spec, table 123.
+// Defined in ISO 32000-2:2020 spec, table 121.
+enum FontStyle {
+ kFontStyleNormal = 0,
+ kFontStyleFixedPitch = 1 << 0,
+ kFontStyleSerif = 1 << 1,
+ kFontStyleSymbolic = 1 << 2,
+ kFontStyleScript = 1 << 3,
+ kFontStyleNonSymbolic = 1 << 5,
+ kFontStyleItalic = 1 << 6,
+ kFontStyleAllCap = 1 << 16,
+ kFontStyleSmallCap = 1 << 17,
+ kFontStyleForceBold = 1 << 18,
+};
+
// Font weight values that are in use.
enum FontWeight {
kFontWeightExtraLight = 100,
@@ -32,18 +47,6 @@
#define FXFONT_FF_ROMAN (1 << 4)
#define FXFONT_FF_SCRIPT (4 << 4)
-/* Font styles as defined in PDF 1.7 Table 5.20 */
-#define FXFONT_NORMAL (0)
-#define FXFONT_FIXED_PITCH (1 << 0)
-#define FXFONT_SERIF (1 << 1)
-#define FXFONT_SYMBOLIC (1 << 2)
-#define FXFONT_SCRIPT (1 << 3)
-#define FXFONT_NONSYMBOLIC (1 << 5)
-#define FXFONT_ITALIC (1 << 6)
-#define FXFONT_ALLCAP (1 << 16)
-#define FXFONT_SMALLCAP (1 << 17)
-#define FXFONT_FORCE_BOLD (1 << 18)
-
/* Other font flags */
#define FXFONT_USEEXTERNATTR 0x80000
@@ -66,28 +69,28 @@
size_t GetTTCIndex(pdfium::span<const uint8_t> pFontData, size_t font_offset);
inline bool FontStyleIsForceBold(uint32_t style) {
- return !!(style & FXFONT_FORCE_BOLD);
+ return !!(style & pdfium::kFontStyleForceBold);
}
inline bool FontStyleIsItalic(uint32_t style) {
- return !!(style & FXFONT_ITALIC);
+ return !!(style & pdfium::kFontStyleItalic);
}
inline bool FontStyleIsFixedPitch(uint32_t style) {
- return !!(style & FXFONT_FIXED_PITCH);
+ return !!(style & pdfium::kFontStyleFixedPitch);
}
inline bool FontStyleIsSymbolic(uint32_t style) {
- return !!(style & FXFONT_SYMBOLIC);
+ return !!(style & pdfium::kFontStyleSymbolic);
}
inline bool FontStyleIsNonSymbolic(uint32_t style) {
- return !!(style & FXFONT_NONSYMBOLIC);
+ return !!(style & pdfium::kFontStyleNonSymbolic);
}
inline bool FontStyleIsAllCaps(uint32_t style) {
- return !!(style & FXFONT_ALLCAP);
+ return !!(style & pdfium::kFontStyleAllCap);
}
inline bool FontStyleIsSerif(uint32_t style) {
- return !!(style & FXFONT_SERIF);
+ return !!(style & pdfium::kFontStyleSerif);
}
inline bool FontStyleIsScript(uint32_t style) {
- return !!(style & FXFONT_SCRIPT);
+ return !!(style & pdfium::kFontStyleScript);
}
inline bool FontFamilyIsFixedPitch(uint32_t family) {
diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
index ed0d4a6..23c8c3d 100644
--- a/fpdfsdk/fpdf_edittext.cpp
+++ b/fpdfsdk/fpdf_edittext.cpp
@@ -135,19 +135,19 @@
font_descriptor_dict->SetNewFor<CPDF_Name>("FontName", font_name);
int flags = 0;
if (font->GetFace()->IsFixedWidth()) {
- flags |= FXFONT_FIXED_PITCH;
+ flags |= pdfium::kFontStyleFixedPitch;
}
if (font_name.Contains("Serif"))
- flags |= FXFONT_SERIF;
+ flags |= pdfium::kFontStyleSerif;
if (font->GetFace()->IsItalic()) {
- flags |= FXFONT_ITALIC;
+ flags |= pdfium::kFontStyleItalic;
}
if (font->GetFace()->IsBold()) {
- flags |= FXFONT_FORCE_BOLD;
+ flags |= pdfium::kFontStyleForceBold;
}
// TODO(npm): How do I know if a font is symbolic, script, allcap, smallcap?
- flags |= FXFONT_NONSYMBOLIC;
+ flags |= pdfium::kFontStyleNonSymbolic;
font_descriptor_dict->SetNewFor<CPDF_Number>("Flags", flags);
FX_RECT bbox = font->GetBBox().value_or(FX_RECT());
diff --git a/fpdfsdk/fpdf_text_embeddertest.cpp b/fpdfsdk/fpdf_text_embeddertest.cpp
index 16f4095..1d626f4 100644
--- a/fpdfsdk/fpdf_text_embeddertest.cpp
+++ b/fpdfsdk/fpdf_text_embeddertest.cpp
@@ -956,7 +956,7 @@
FPDFText_GetFontInfo(textpage.get(), i, nullptr, 0, &flags);
static constexpr unsigned long expected_length = sizeof(kExpectedFontName1);
ASSERT_EQ(expected_length, length);
- EXPECT_EQ(FXFONT_NONSYMBOLIC, flags);
+ EXPECT_EQ(pdfium::kFontStyleNonSymbolic, flags);
font_name.resize(length);
std::fill(font_name.begin(), font_name.end(), 'a');
flags = -1;
@@ -964,7 +964,7 @@
FPDFText_GetFontInfo(textpage.get(), i, font_name.data(),
font_name.size(), &flags));
EXPECT_STREQ(kExpectedFontName1, font_name.data());
- EXPECT_EQ(FXFONT_NONSYMBOLIC, flags);
+ EXPECT_EQ(pdfium::kFontStyleNonSymbolic, flags);
}
// If the size of the buffer is not large enough, the buffer should remain
// unchanged.
@@ -994,7 +994,7 @@
FPDFText_GetFontInfo(textpage.get(), i, nullptr, 0, &flags);
static constexpr unsigned long expected_length = sizeof(kExpectedFontName2);
ASSERT_EQ(expected_length, length);
- EXPECT_EQ(FXFONT_NONSYMBOLIC, flags);
+ EXPECT_EQ(pdfium::kFontStyleNonSymbolic, flags);
font_name.resize(length);
std::fill(font_name.begin(), font_name.end(), 'a');
flags = -1;
@@ -1002,7 +1002,7 @@
FPDFText_GetFontInfo(textpage.get(), i, font_name.data(),
font_name.size(), &flags));
EXPECT_STREQ(kExpectedFontName2, font_name.data());
- EXPECT_EQ(FXFONT_NONSYMBOLIC, flags);
+ EXPECT_EQ(pdfium::kFontStyleNonSymbolic, flags);
}
// Now try some out of bounds indices and null pointers to make sure we do not
diff --git a/xfa/fgas/font/cfgas_defaultfontmanager.cpp b/xfa/fgas/font/cfgas_defaultfontmanager.cpp
index 6472a78..b1016f0 100644
--- a/xfa/fgas/font/cfgas_defaultfontmanager.cpp
+++ b/xfa/fgas/font/cfgas_defaultfontmanager.cpp
@@ -33,10 +33,10 @@
uint32_t dwStyle = 0;
// TODO(dsinclair): Why doesn't this check the other flags?
if (FontStyleIsForceBold(dwFontStyles)) {
- dwStyle |= FXFONT_FORCE_BOLD;
+ dwStyle |= pdfium::kFontStyleForceBold;
}
if (FontStyleIsItalic(dwFontStyles)) {
- dwStyle |= FXFONT_ITALIC;
+ dwStyle |= pdfium::kFontStyleItalic;
}
ByteStringView replace_view(pCurFont->pReplaceFont);
while (!replace_view.IsEmpty()) {
diff --git a/xfa/fgas/font/cfgas_fontmgr.cpp b/xfa/fgas/font/cfgas_fontmgr.cpp
index 308b975..48ec7d0 100644
--- a/xfa/fgas/font/cfgas_fontmgr.cpp
+++ b/xfa/fgas/font/cfgas_fontmgr.cpp
@@ -163,15 +163,19 @@
uint32_t GetGdiFontStyles(const LOGFONTW& lf) {
uint32_t dwStyles = 0;
- if ((lf.lfPitchAndFamily & 0x03) == FIXED_PITCH)
- dwStyles |= FXFONT_FIXED_PITCH;
+ if ((lf.lfPitchAndFamily & 0x03) == FIXED_PITCH) {
+ dwStyles |= pdfium::kFontStyleFixedPitch;
+ }
uint8_t nFamilies = lf.lfPitchAndFamily & 0xF0;
- if (nFamilies == FF_ROMAN)
- dwStyles |= FXFONT_SERIF;
- if (nFamilies == FF_SCRIPT)
- dwStyles |= FXFONT_SCRIPT;
- if (lf.lfCharSet == SYMBOL_CHARSET)
- dwStyles |= FXFONT_SYMBOLIC;
+ if (nFamilies == FF_ROMAN) {
+ dwStyles |= pdfium::kFontStyleSerif;
+ }
+ if (nFamilies == FF_SCRIPT) {
+ dwStyles |= pdfium::kFontStyleScript;
+ }
+ if (lf.lfCharSet == SYMBOL_CHARSET) {
+ dwStyles |= pdfium::kFontStyleSymbolic;
+ }
return dwStyles;
}
@@ -458,26 +462,26 @@
uint32_t GetFlags(const RetainPtr<CFX_Face>& face) {
uint32_t flags = 0;
if (face->IsBold()) {
- flags |= FXFONT_FORCE_BOLD;
+ flags |= pdfium::kFontStyleForceBold;
}
if (face->IsItalic()) {
- flags |= FXFONT_ITALIC;
+ flags |= pdfium::kFontStyleItalic;
}
if (face->IsFixedWidth()) {
- flags |= FXFONT_FIXED_PITCH;
+ flags |= pdfium::kFontStyleFixedPitch;
}
std::optional<std::array<uint32_t, 2>> code_page_range =
face->GetOs2CodePageRange();
if (code_page_range.has_value() && (code_page_range.value()[0] & (1 << 31))) {
- flags |= FXFONT_SYMBOLIC;
+ flags |= pdfium::kFontStyleSymbolic;
}
std::optional<std::array<uint8_t, 2>> panose = face->GetOs2Panose();
if (panose.has_value() && panose.value()[0] == 2) {
uint8_t serif = panose.value()[1];
if ((serif > 1 && serif < 10) || serif > 13) {
- flags |= FXFONT_SERIF;
+ flags |= pdfium::kFontStyleSerif;
}
}
return flags;
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index 13f3542..dae2004 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -141,14 +141,14 @@
auto* pSubstFont = m_pFont->GetSubstFont();
if (pSubstFont) {
if (pSubstFont->m_Weight == pdfium::kFontWeightBold) {
- dwStyles |= FXFONT_FORCE_BOLD;
+ dwStyles |= pdfium::kFontStyleForceBold;
}
} else {
if (m_pFont->IsBold()) {
- dwStyles |= FXFONT_FORCE_BOLD;
+ dwStyles |= pdfium::kFontStyleForceBold;
}
if (m_pFont->IsItalic()) {
- dwStyles |= FXFONT_ITALIC;
+ dwStyles |= pdfium::kFontStyleItalic;
}
}
return dwStyles;
diff --git a/xfa/fxfa/cxfa_textparser.cpp b/xfa/fxfa/cxfa_textparser.cpp
index 1c1b8d2..4ab7d3b 100644
--- a/xfa/fxfa/cxfa_textparser.cpp
+++ b/xfa/fxfa/cxfa_textparser.cpp
@@ -344,10 +344,12 @@
CXFA_Font* font = pTextProvider->GetFontIfExists();
if (font) {
wsFamily = font->GetTypeface();
- if (font->IsBold())
- dwStyle |= FXFONT_FORCE_BOLD;
- if (font->IsItalic())
- dwStyle |= FXFONT_FORCE_BOLD;
+ if (font->IsBold()) {
+ dwStyle |= pdfium::kFontStyleForceBold;
+ }
+ if (font->IsItalic()) {
+ dwStyle |= pdfium::kFontStyleForceBold;
+ }
}
if (pStyle) {
@@ -358,10 +360,10 @@
dwStyle = 0;
if (pStyle->GetFontWeight() > pdfium::kFontWeightNormal) {
- dwStyle |= FXFONT_FORCE_BOLD;
+ dwStyle |= pdfium::kFontStyleForceBold;
}
if (pStyle->GetFontStyle() == CFX_CSSFontStyle::Italic) {
- dwStyle |= FXFONT_ITALIC;
+ dwStyle |= pdfium::kFontStyleItalic;
}
}
diff --git a/xfa/fxfa/parser/cxfa_node.cpp b/xfa/fxfa/parser/cxfa_node.cpp
index 1b8547c..893cd9e 100644
--- a/xfa/fxfa/parser/cxfa_node.cpp
+++ b/xfa/fxfa/parser/cxfa_node.cpp
@@ -3931,10 +3931,12 @@
uint32_t dwFontStyle = 0;
CXFA_Font* font = GetFontIfExists();
if (font) {
- if (font->IsBold())
- dwFontStyle |= FXFONT_FORCE_BOLD;
- if (font->IsItalic())
- dwFontStyle |= FXFONT_ITALIC;
+ if (font->IsBold()) {
+ dwFontStyle |= pdfium::kFontStyleForceBold;
+ }
+ if (font->IsItalic()) {
+ dwFontStyle |= pdfium::kFontStyleItalic;
+ }
wsFontName = font->GetTypeface();
}