summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-09-14 23:28:46 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-09-14 23:28:46 +0000
commita94b40f73598b84063d121e29164d71b5d977fcc (patch)
treeed6f1c015d2d3ae27df2a64ce29551486a108200
parent3db36ef21df4187877f50212aec43ad865abb42c (diff)
downloadpdfium-a94b40f73598b84063d121e29164d71b5d977fcc.tar.xz
Use pdfium::Optional in CFGAS_GEFont.
Change-Id: I1fe90d94ed782f59745dc47e38cda561c5b5ac47 Reviewed-on: https://pdfium-review.googlesource.com/42512 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
-rw-r--r--xfa/fgas/font/cfgas_gefont.cpp4
-rw-r--r--xfa/fgas/font/cfgas_gefont.h5
2 files changed, 4 insertions, 5 deletions
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index 6f33eb50fe..45119b7a98 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -121,8 +121,8 @@ WideString CFGAS_GEFont::GetFamilyName() const {
uint32_t CFGAS_GEFont::GetFontStyles() const {
ASSERT(m_pFont);
- if (m_bUseLogFontStyle)
- return m_dwLogFontStyle;
+ if (m_dwLogFontStyle.has_value())
+ return m_dwLogFontStyle.value();
uint32_t dwStyles = 0;
auto* pSubstFont = m_pFont->GetSubstFont();
diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h
index 08164f7d5f..4c5d31c02d 100644
--- a/xfa/fgas/font/cfgas_gefont.h
+++ b/xfa/fgas/font/cfgas_gefont.h
@@ -15,6 +15,7 @@
#include "core/fxcrt/fx_memory.h"
#include "core/fxcrt/maybe_owned.h"
#include "core/fxcrt/retain_ptr.h"
+#include "third_party/base/optional.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#include "xfa/fgas/font/cfgas_pdffontmgr.h"
@@ -48,7 +49,6 @@ class CFGAS_GEFont final : public Retainable {
CFX_Font* GetDevFont() const { return m_pFont.Get(); }
void SetLogicalFontStyle(uint32_t dwLogFontStyle) {
- m_bUseLogFontStyle = true;
m_dwLogFontStyle = dwLogFontStyle;
}
@@ -70,8 +70,7 @@ class CFGAS_GEFont final : public Retainable {
bool bRecursive);
WideString GetFamilyName() const;
- bool m_bUseLogFontStyle = false;
- uint32_t m_dwLogFontStyle = 0;
+ Optional<uint32_t> m_dwLogFontStyle;
MaybeOwned<CFX_Font> m_pFont; // Must come before |m_pFontEncoding|.
CFGAS_FontMgr::ObservedPtr const m_pFontMgr;
std::unique_ptr<CFX_UnicodeEncodingEx> m_pFontEncoding;