Tidy CBA_FontMap::Initialize().

- Fold it into the CBA_FontMap caller, which is the only caller, then it
  becomes obvious that a conditional always evaluates to true. Remove
  this level of nesting.
- Remove another level of nesting by combining an if-else block with the
  if-else block that contains it.

Change-Id: I3b4580238a8718a0a26fb15b99ca539342a972b8
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/79611
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfdoc/cba_fontmap.cpp b/core/fpdfdoc/cba_fontmap.cpp
index 8d81eb6..9781a03 100644
--- a/core/fpdfdoc/cba_fontmap.cpp
+++ b/core/fpdfdoc/cba_fontmap.cpp
@@ -72,7 +72,26 @@
                          CPDF_Dictionary* pAnnotDict,
                          const ByteString& sAPType)
     : m_pDocument(pDocument), m_pAnnotDict(pAnnotDict), m_sAPType(sAPType) {
-  Initialize();
+  int32_t nCharset = FX_CHARSET_Default;
+  m_pDefaultFont = GetAnnotDefaultFont(&m_sDefaultFontName);
+  if (m_pDefaultFont) {
+    const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont();
+    if (pSubstFont) {
+      nCharset = pSubstFont->m_Charset;
+    } else if (m_sDefaultFontName == "Wingdings" ||
+               m_sDefaultFontName == "Wingdings2" ||
+               m_sDefaultFontName == "Wingdings3" ||
+               m_sDefaultFontName == "Webdings") {
+      nCharset = FX_CHARSET_Symbol;
+    } else {
+      nCharset = FX_CHARSET_ANSI;
+    }
+    AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset);
+    AddFontToAnnotDict(m_pDefaultFont, m_sDefaultFontName);
+  }
+
+  if (nCharset != FX_CHARSET_ANSI)
+    GetFontIndex(CFX_Font::kDefaultAnsiFontName, FX_CHARSET_ANSI, false);
 }
 
 CBA_FontMap::~CBA_FontMap() = default;
@@ -151,32 +170,6 @@
   return FX_GetCharsetFromCodePage(FXSYS_GetACP());
 }
 
-void CBA_FontMap::Initialize() {
-  int32_t nCharset = FX_CHARSET_Default;
-
-  if (!m_pDefaultFont) {
-    m_pDefaultFont = GetAnnotDefaultFont(&m_sDefaultFontName);
-    if (m_pDefaultFont) {
-      if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont()) {
-        nCharset = pSubstFont->m_Charset;
-      } else {
-        if (m_sDefaultFontName == "Wingdings" ||
-            m_sDefaultFontName == "Wingdings2" ||
-            m_sDefaultFontName == "Wingdings3" ||
-            m_sDefaultFontName == "Webdings")
-          nCharset = FX_CHARSET_Symbol;
-        else
-          nCharset = FX_CHARSET_ANSI;
-      }
-      AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset);
-      AddFontToAnnotDict(m_pDefaultFont, m_sDefaultFontName);
-    }
-  }
-
-  if (nCharset != FX_CHARSET_ANSI)
-    GetFontIndex(CFX_Font::kDefaultAnsiFontName, FX_CHARSET_ANSI, false);
-}
-
 RetainPtr<CPDF_Font> CBA_FontMap::FindFontSameCharset(ByteString* sFontAlias,
                                                       int32_t nCharset) {
   if (m_pAnnotDict->GetNameFor(pdfium::annotation::kSubtype) != "Widget")