diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp
index d3de612..753e7ea 100644
--- a/core/fpdfdoc/cpdf_variabletext.cpp
+++ b/core/fpdfdoc/cpdf_variabletext.cpp
@@ -191,7 +191,7 @@
   if (pWord->pWordProps)
     word.WordProps = *pWord->pWordProps;
   word.nFontIndex = m_pVT->GetWordFontIndex(*pWord);
-  word.fFontSize = m_pVT->GetWordFontSize(*pWord);
+  word.fFontSize = m_pVT->GetWordFontSize();
   return true;
 }
 
@@ -302,8 +302,7 @@
 
 CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace& place,
                                              uint16_t word,
-                                             int32_t charset,
-                                             const CPVT_WordProps* pWordProps) {
+                                             int32_t charset) {
   int32_t nTotalWords = GetTotalWords();
   if (m_nLimitChar > 0 && nTotalWords >= m_nLimitChar)
     return place;
@@ -318,10 +317,7 @@
   return AddWord(newplace, CPVT_WordInfo(word, charset, nFontIndex, nullptr));
 }
 
-CPVT_WordPlace CPDF_VariableText::InsertSection(
-    const CPVT_WordPlace& place,
-    const CPVT_SecProps* pSecProps,
-    const CPVT_WordProps* pWordProps) {
+CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace& place) {
   int32_t nTotalWords = GetTotalWords();
   if (m_nLimitChar > 0 && nTotalWords >= m_nLimitChar)
     return place;
@@ -365,7 +361,7 @@
           if (swText[i + 1] == 0x0A)
             i += 1;
 
-          wp = InsertSection(wp, nullptr, nullptr);
+          wp = InsertSection(wp);
         }
         break;
       case 0x0A:
@@ -373,13 +369,13 @@
           if (swText[i + 1] == 0x0D)
             i += 1;
 
-          wp = InsertSection(wp, nullptr, nullptr);
+          wp = InsertSection(wp);
         }
         break;
       case 0x09:
         word = 0x20;
       default:
-        wp = InsertWord(wp, word, FX_CHARSET_Default, nullptr);
+        wp = InsertWord(wp, word, FX_CHARSET_Default);
         break;
     }
     if (wp == oldwp)
@@ -447,7 +443,7 @@
       case 0x09:
         word = 0x20;
       default:
-        wp = InsertWord(wp, word, FX_CHARSET_Default, nullptr);
+        wp = InsertWord(wp, word, FX_CHARSET_Default);
         break;
     }
     nCharCount++;
@@ -780,7 +776,7 @@
   return m_rcPlate;
 }
 
-float CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo& WordInfo) {
+float CPDF_VariableText::GetWordFontSize() {
   return GetFontSize();
 }
 
@@ -803,15 +799,15 @@
 
 float CPDF_VariableText::GetWordWidth(const CPVT_WordInfo& WordInfo) {
   return GetWordWidth(GetWordFontIndex(WordInfo), WordInfo.Word, GetSubWord(),
-                      GetCharSpace(WordInfo), GetHorzScale(WordInfo),
-                      GetWordFontSize(WordInfo), WordInfo.fWordTail);
+                      GetCharSpace(), GetHorzScale(), GetWordFontSize(),
+                      WordInfo.fWordTail);
 }
 
-float CPDF_VariableText::GetLineAscent(const CPVT_SectionInfo& SecInfo) {
+float CPDF_VariableText::GetLineAscent() {
   return GetFontAscent(GetDefaultFontIndex(), GetFontSize());
 }
 
-float CPDF_VariableText::GetLineDescent(const CPVT_SectionInfo& SecInfo) {
+float CPDF_VariableText::GetLineDescent() {
   return GetFontDescent(GetDefaultFontIndex(), GetFontSize());
 }
 
@@ -834,33 +830,25 @@
 }
 
 float CPDF_VariableText::GetWordAscent(const CPVT_WordInfo& WordInfo) {
-  return GetFontAscent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo));
+  return GetFontAscent(GetWordFontIndex(WordInfo), GetWordFontSize());
 }
 
 float CPDF_VariableText::GetWordDescent(const CPVT_WordInfo& WordInfo) {
-  return GetFontDescent(GetWordFontIndex(WordInfo), GetWordFontSize(WordInfo));
+  return GetFontDescent(GetWordFontIndex(WordInfo), GetWordFontSize());
 }
 
-float CPDF_VariableText::GetLineLeading(const CPVT_SectionInfo& SecInfo) {
+float CPDF_VariableText::GetLineLeading() {
   return m_fLineLeading;
 }
 
-float CPDF_VariableText::GetLineIndent(const CPVT_SectionInfo& SecInfo) {
+float CPDF_VariableText::GetLineIndent() {
   return 0.0f;
 }
 
-int32_t CPDF_VariableText::GetAlignment(const CPVT_SectionInfo& SecInfo) {
+int32_t CPDF_VariableText::GetAlignment() {
   return m_nAlignment;
 }
 
-float CPDF_VariableText::GetCharSpace(const CPVT_WordInfo& WordInfo) {
-  return m_fCharSpace;
-}
-
-int32_t CPDF_VariableText::GetHorzScale(const CPVT_WordInfo& WordInfo) {
-  return m_nHorzScale;
-}
-
 void CPDF_VariableText::ClearSectionRightWords(const CPVT_WordPlace& place) {
   CPVT_WordPlace wordplace = AdjustLineHeader(place, true);
   if (!pdfium::IndexInBounds(m_SectionArray, place.nSecIndex))
diff --git a/core/fpdfdoc/cpdf_variabletext.h b/core/fpdfdoc/cpdf_variabletext.h
index 2319df7..9daf56e 100644
--- a/core/fpdfdoc/cpdf_variabletext.h
+++ b/core/fpdfdoc/cpdf_variabletext.h
@@ -109,11 +109,8 @@
   void SetText(const WideString& text);
   CPVT_WordPlace InsertWord(const CPVT_WordPlace& place,
                             uint16_t word,
-                            int32_t charset,
-                            const CPVT_WordProps* pWordProps);
-  CPVT_WordPlace InsertSection(const CPVT_WordPlace& place,
-                               const CPVT_SecProps* pSecProps,
-                               const CPVT_WordProps* pWordProps);
+                            int32_t charset);
+  CPVT_WordPlace InsertSection(const CPVT_WordPlace& place);
   CPVT_WordPlace InsertText(const CPVT_WordPlace& place, const wchar_t* text);
   CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange);
   CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place);
@@ -165,8 +162,8 @@
   float GetFontAscent(int32_t nFontIndex, float fFontSize);
   float GetFontDescent(int32_t nFontIndex, float fFontSize);
   int32_t GetDefaultFontIndex();
-  float GetLineLeading(const CPVT_SectionInfo& SecInfo);
-  int32_t GetAlignment(const CPVT_SectionInfo& SecInfo);
+  float GetLineLeading();
+  int32_t GetAlignment();
   float GetWordWidth(const CPVT_WordInfo& WordInfo);
   float GetWordWidth(int32_t nFontIndex,
                      uint16_t Word,
@@ -179,9 +176,9 @@
   float GetWordDescent(const CPVT_WordInfo& WordInfo);
   float GetWordAscent(const CPVT_WordInfo& WordInfo, float fFontSize);
   float GetWordDescent(const CPVT_WordInfo& WordInfo, float fFontSize);
-  float GetLineAscent(const CPVT_SectionInfo& SecInfo);
-  float GetLineDescent(const CPVT_SectionInfo& SecInfo);
-  float GetLineIndent(const CPVT_SectionInfo& SecInfo);
+  float GetLineAscent();
+  float GetLineDescent();
+  float GetLineIndent();
 
  private:
   int32_t GetCharWidth(int32_t nFontIndex, uint16_t Word, uint16_t SubWord);
@@ -200,10 +197,8 @@
   bool SetWordInfo(const CPVT_WordPlace& place, const CPVT_WordInfo& wordinfo);
   bool GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo);
   bool GetSectionInfo(const CPVT_WordPlace& place, CPVT_SectionInfo& secinfo);
-  float GetWordFontSize(const CPVT_WordInfo& WordInfo);
+  float GetWordFontSize();
   int32_t GetWordFontIndex(const CPVT_WordInfo& WordInfo);
-  float GetCharSpace(const CPVT_WordInfo& WordInfo);
-  int32_t GetHorzScale(const CPVT_WordInfo& WordInfo);
 
   void ClearSectionRightWords(const CPVT_WordPlace& place);
 
diff --git a/core/fpdfdoc/csection.cpp b/core/fpdfdoc/csection.cpp
index 0c8c025..1f2bef4 100644
--- a/core/fpdfdoc/csection.cpp
+++ b/core/fpdfdoc/csection.cpp
@@ -133,7 +133,7 @@
   while (nLeft <= nRight) {
     CLine* pLine = m_LineArray[nMid].get();
     float fTop = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineAscent -
-                 m_pVT->GetLineLeading(m_SecInfo);
+                 m_pVT->GetLineLeading();
     float fBottom = pLine->m_LineInfo.fLineY - pLine->m_LineInfo.fLineDescent;
     if (IsFloatBigger(point.y, fTop))
       bUp = false;
diff --git a/core/fpdfdoc/ctypeset.cpp b/core/fpdfdoc/ctypeset.cpp
index 920ac03..856377e 100644
--- a/core/fpdfdoc/ctypeset.cpp
+++ b/core/fpdfdoc/ctypeset.cpp
@@ -191,10 +191,10 @@
   float fLineDescent =
       m_pVT->GetFontDescent(m_pVT->GetDefaultFontIndex(), m_pVT->GetFontSize());
   float x = 0.0f;
-  float y = m_pVT->GetLineLeading(m_pSection->m_SecInfo) + fLineAscent;
+  float y = m_pVT->GetLineLeading() + fLineAscent;
   int32_t nStart = 0;
   CLine* pLine = m_pSection->m_LineArray.front().get();
-  switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) {
+  switch (m_pVT->GetAlignment()) {
     case 0:
       pLine->m_LineInfo.fLineX = fNodeWidth * VARIABLETEXT_HALF;
       break;
@@ -289,9 +289,8 @@
   int32_t nCharIndex = 0;
   CPVT_LineInfo line;
   float fWordWidth = 0;
-  float fTypesetWidth = std::max(
-      m_pVT->GetPlateWidth() - m_pVT->GetLineIndent(m_pSection->m_SecInfo),
-      0.0f);
+  float fTypesetWidth =
+      std::max(m_pVT->GetPlateWidth() - m_pVT->GetLineIndent(), 0.0f);
   int32_t nTotalWords =
       pdfium::CollectionSize<int32_t>(m_pSection->m_WordArray);
   bool bOpened = false;
@@ -366,7 +365,7 @@
           line.fLineDescent = fLineDescent;
           m_pSection->AddLine(line);
         }
-        fMaxY += (fLineAscent + m_pVT->GetLineLeading(m_pSection->m_SecInfo));
+        fMaxY += (fLineAscent + m_pVT->GetLineLeading());
         fMaxY -= fLineDescent;
         fMaxX = std::max(fLineWidth, fMaxX);
         nLineHead = i;
@@ -392,14 +391,14 @@
         line.fLineDescent = fLineDescent;
         m_pSection->AddLine(line);
       }
-      fMaxY += (fLineAscent + m_pVT->GetLineLeading(m_pSection->m_SecInfo));
+      fMaxY += (fLineAscent + m_pVT->GetLineLeading());
       fMaxY -= fLineDescent;
       fMaxX = std::max(fLineWidth, fMaxX);
     }
   } else {
     if (bTypeset) {
-      fLineAscent = m_pVT->GetLineAscent(m_pSection->m_SecInfo);
-      fLineDescent = m_pVT->GetLineDescent(m_pSection->m_SecInfo);
+      fLineAscent = m_pVT->GetLineAscent();
+      fLineDescent = m_pVT->GetLineDescent();
     } else {
       fLineAscent =
           m_pVT->GetFontAscent(m_pVT->GetDefaultFontIndex(), fFontSize);
@@ -415,8 +414,7 @@
       line.fLineDescent = fLineDescent;
       m_pSection->AddLine(line);
     }
-    fMaxY += m_pVT->GetLineLeading(m_pSection->m_SecInfo) + fLineAscent -
-             fLineDescent;
+    fMaxY += m_pVT->GetLineLeading() + fLineAscent - fLineDescent;
   }
   m_rcRet = CPVT_FloatRect(0, 0, fMaxX, fMaxY);
 }
@@ -426,9 +424,9 @@
   ASSERT(m_pSection);
   float fMinX = 0.0f, fMinY = 0.0f, fMaxX = 0.0f, fMaxY = 0.0f;
   float fPosX = 0.0f, fPosY = 0.0f;
-  float fLineIndent = m_pVT->GetLineIndent(m_pSection->m_SecInfo);
+  float fLineIndent = m_pVT->GetLineIndent();
   float fTypesetWidth = std::max(m_pVT->GetPlateWidth() - fLineIndent, 0.0f);
-  switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) {
+  switch (m_pVT->GetAlignment()) {
     default:
     case 0:
       fMinX = 0.0f;
@@ -449,7 +447,7 @@
     m_pSection->m_SecInfo.nTotalLine = nTotalLines;
     for (int32_t l = 0; l < nTotalLines; l++) {
       CLine* pLine = m_pSection->m_LineArray[l].get();
-      switch (m_pVT->GetAlignment(m_pSection->m_SecInfo)) {
+      switch (m_pVT->GetAlignment()) {
         default:
         case 0:
           fPosX = 0;
@@ -463,7 +461,7 @@
           break;
       }
       fPosX += fLineIndent;
-      fPosY += m_pVT->GetLineLeading(m_pSection->m_SecInfo);
+      fPosY += m_pVT->GetLineLeading();
       fPosY += pLine->m_LineInfo.fLineAscent;
       pLine->m_LineInfo.fLineX = fPosX - fMinX;
       pLine->m_LineInfo.fLineY = fPosY - fMinY;
diff --git a/fpdfsdk/pwl/cpwl_edit_impl.cpp b/fpdfsdk/pwl/cpwl_edit_impl.cpp
index 7d8c0c3..7da5cdd 100644
--- a/fpdfsdk/pwl/cpwl_edit_impl.cpp
+++ b/fpdfsdk/pwl/cpwl_edit_impl.cpp
@@ -1535,8 +1535,8 @@
     return false;
 
   m_pVT->UpdateWordPlace(m_wpCaret);
-  SetCaret(m_pVT->InsertWord(m_wpCaret, word,
-                             GetCharSetFromUnicode(word, charset), pWordProps));
+  SetCaret(
+      m_pVT->InsertWord(m_wpCaret, word, GetCharSetFromUnicode(word, charset)));
   m_SelState.Set(m_wpCaret, m_wpCaret);
   if (m_wpCaret == m_wpOldCaret)
     return false;
@@ -1562,7 +1562,7 @@
     return false;
 
   m_pVT->UpdateWordPlace(m_wpCaret);
-  SetCaret(m_pVT->InsertSection(m_wpCaret, pSecProps, pWordProps));
+  SetCaret(m_pVT->InsertSection(m_wpCaret));
   m_SelState.Set(m_wpCaret, m_wpCaret);
   if (m_wpCaret == m_wpOldCaret)
     return false;
@@ -1846,18 +1846,18 @@
       uint16_t word = sText[i];
       switch (word) {
         case 0x0D:
-          wp = m_pVT->InsertSection(wp, nullptr, nullptr);
+          wp = m_pVT->InsertSection(wp);
           if (i + 1 < sz && sText[i + 1] == 0x0A)
             i++;
           break;
         case 0x0A:
-          wp = m_pVT->InsertSection(wp, nullptr, nullptr);
+          wp = m_pVT->InsertSection(wp);
           break;
         case 0x09:
           word = 0x20;
         default:
-          wp = m_pVT->InsertWord(wp, word, GetCharSetFromUnicode(word, charset),
-                                 nullptr);
+          wp =
+              m_pVT->InsertWord(wp, word, GetCharSetFromUnicode(word, charset));
           break;
       }
     }
