Encapsulate `CFX_SubstFont::m_bFlagMM`.

Mark the class member as private and provide getter/setter.

Bug: pdfium:1680
Change-Id: I7c7ef7d6a0fb3697ee1d8f2532fd809e59e72190
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/99190
Reviewed-by: Nigi <nigi@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/render/charposlist.cpp b/core/fpdfapi/render/charposlist.cpp
index 71de6cf..8b91291 100644
--- a/core/fpdfapi/render/charposlist.cpp
+++ b/core/fpdfapi/render/charposlist.cpp
@@ -95,7 +95,7 @@
 
     float scaling_factor = 1.0f;
     if (!font->IsEmbedded() && font->HasFontWidths() && !is_vertical_writing &&
-        !current_font->GetSubstFont()->m_bFlagMM) {
+        !current_font->GetSubstFont()->IsBuiltInGenericFont()) {
       int pdf_glyph_width = font->GetCharWidthF(char_code);
       int font_glyph_width =
           current_font->GetGlyphWidth(text_char_pos.m_GlyphIndex);
diff --git a/core/fxge/cfx_font.cpp b/core/fxge/cfx_font.cpp
index abfcf68..9caec4c 100644
--- a/core/fxge/cfx_font.cpp
+++ b/core/fxge/cfx_font.cpp
@@ -420,7 +420,7 @@
                             int weight) const {
   if (!m_Face)
     return 0;
-  if (m_pSubstFont && m_pSubstFont->m_bFlagMM)
+  if (m_pSubstFont && m_pSubstFont->IsBuiltInGenericFont())
     AdjustMMParams(glyph_index, dest_width, weight);
   int err =
       FT_Load_Glyph(m_Face->GetRec(), glyph_index,
@@ -702,7 +702,7 @@
       else
         ft_matrix.xy -= ft_matrix.xx * skew / 100;
     }
-    if (m_pSubstFont->m_bFlagMM)
+    if (m_pSubstFont->IsBuiltInGenericFont())
       AdjustMMParams(glyph_index, dest_width, m_pSubstFont->m_Weight);
   }
   ScopedFontTransform scoped_transform(m_Face, &ft_matrix);
@@ -712,7 +712,7 @@
     load_flags |= FT_LOAD_NO_HINTING;
   if (FT_Load_Glyph(m_Face->GetRec(), glyph_index, load_flags))
     return nullptr;
-  if (m_pSubstFont && !m_pSubstFont->m_bFlagMM &&
+  if (m_pSubstFont && !m_pSubstFont->IsBuiltInGenericFont() &&
       m_pSubstFont->m_Weight > 400) {
     uint32_t index = std::min<uint32_t>((m_pSubstFont->m_Weight - 400) / 10,
                                         kWeightPowArraySize - 1);
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index 6370949..f12b5e2 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -502,7 +502,7 @@
     return m_StandardFaces[base_font];
   }
 
-  subst_font->m_bFlagMM = true;
+  subst_font->SetIsBuiltInGenericFont();
   subst_font->m_ItalicAngle = italic_angle;
   if (weight)
     subst_font->m_Weight = weight;
diff --git a/core/fxge/cfx_glyphcache.cpp b/core/fxge/cfx_glyphcache.cpp
index f211e53..39d7f6c 100644
--- a/core/fxge/cfx_glyphcache.cpp
+++ b/core/fxge/cfx_glyphcache.cpp
@@ -136,7 +136,7 @@
       else
         ft_matrix.xy -= ft_matrix.xx * skew / 100;
     }
-    if (pSubstFont->m_bFlagMM) {
+    if (pSubstFont->IsBuiltInGenericFont()) {
       pFont->AdjustMMParams(glyph_index, dest_width,
                             pFont->GetSubstFont()->m_Weight);
     }
@@ -164,7 +164,7 @@
     weight = pSubstFont->m_WeightCJK;
   else
     weight = pSubstFont ? pSubstFont->m_Weight : 0;
-  if (pSubstFont && !pSubstFont->m_bFlagMM && weight > 400) {
+  if (pSubstFont && !pSubstFont->IsBuiltInGenericFont() && weight > 400) {
     uint32_t index = (weight - 400) / 10;
     pdfium::base::CheckedNumeric<signed long> level =
         CFX_Font::GetWeightLevel(pSubstFont->m_Charset, index);
diff --git a/core/fxge/cfx_substfont.h b/core/fxge/cfx_substfont.h
index ee01df0..fc6189b 100644
--- a/core/fxge/cfx_substfont.h
+++ b/core/fxge/cfx_substfont.h
@@ -20,13 +20,19 @@
 #endif
   void UseChromeSerif();
 
+  void SetIsBuiltInGenericFont() { m_bFlagMM = true; }
+  bool IsBuiltInGenericFont() const { return m_bFlagMM; }
+
   ByteString m_Family;
   FX_Charset m_Charset = FX_Charset::kANSI;
   int m_Weight = 0;
   int m_ItalicAngle = 0;
   int m_WeightCJK = 0;
+
   bool m_bSubstCJK = false;
   bool m_bItalicCJK = false;
+
+ private:
   bool m_bFlagMM = false;
 };
 
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index 47bb6e1..9d7b97c 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -1775,7 +1775,8 @@
   // to render the glyph without any adjustments.
   const CFX_SubstFont* subst_font = pFont->GetSubstFont();
   const int subst_font_weight =
-      (subst_font && subst_font->m_bFlagMM) ? subst_font->m_Weight : 0;
+      (subst_font && subst_font->IsBuiltInGenericFont()) ? subst_font->m_Weight
+                                                         : 0;
   for (const TextCharPos& cp : pCharPos) {
     const int glyph_width = pFont->GetGlyphWidth(
         cp.m_GlyphIndex, cp.m_FontCharWidth, subst_font_weight);