Remove "PDF_" prefix from some standalone font functions.

The prefix is not meaningful, so remove them and shorten function names.

Change-Id: I364a79aac511e0e113da188e4ce8e4ac7ff1af4a
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/91944
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index 203f01a..9cb9932 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -723,7 +723,7 @@
         return charcode ? static_cast<int>(charcode) : -1;
 
       int index = 0;
-      uint16_t name_unicode = PDF_UnicodeFromAdobeName(name);
+      uint16_t name_unicode = UnicodeFromAdobeName(name);
       if (!name_unicode)
         return charcode ? static_cast<int>(charcode) : -1;
 
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index be9db6b..3aac938 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -362,7 +362,7 @@
 
   const char* name = nullptr;
   if (base_encoding != FontEncoding::kBuiltin)
-    name = PDF_CharNameFromPredefinedCharSet(base_encoding, charcode);
+    name = CharNameFromPredefinedCharSet(base_encoding, charcode);
   if (!name)
     return nullptr;
 
diff --git a/core/fpdfapi/font/cpdf_fontencoding.cpp b/core/fpdfapi/font/cpdf_fontencoding.cpp
index 1d954d8..3f9a36f 100644
--- a/core/fpdfapi/font/cpdf_fontencoding.cpp
+++ b/core/fpdfapi/font/cpdf_fontencoding.cpp
@@ -1664,7 +1664,7 @@
 }
 
 CPDF_FontEncoding::CPDF_FontEncoding(FontEncoding predefined_encoding) {
-  const uint16_t* pSrc = PDF_UnicodesForPredefinedCharSet(predefined_encoding);
+  const uint16_t* pSrc = UnicodesForPredefinedCharSet(predefined_encoding);
   if (pSrc) {
     for (size_t i = 0; i < pdfium::size(m_Unicodes); i++)
       m_Unicodes[i] = pSrc[i];
@@ -1687,7 +1687,7 @@
 
   absl::optional<FontEncoding> predefined;
   for (FontEncoding cs : kEncodings) {
-    const uint16_t* pSrc = PDF_UnicodesForPredefinedCharSet(cs);
+    const uint16_t* pSrc = UnicodesForPredefinedCharSet(cs);
     bool match = true;
     for (size_t i = 0; i < pdfium::size(m_Unicodes); i++) {
       if (m_Unicodes[i] != pSrc[i]) {
@@ -1714,14 +1714,14 @@
     return pdfium::MakeRetain<CPDF_Name>(pPool, pName);
   }
   const uint16_t* pStandard =
-      PDF_UnicodesForPredefinedCharSet(FontEncoding::kWinAnsi);
+      UnicodesForPredefinedCharSet(FontEncoding::kWinAnsi);
   auto pDiff = pdfium::MakeRetain<CPDF_Array>();
   for (size_t i = 0; i < pdfium::size(m_Unicodes); i++) {
     if (pStandard[i] == m_Unicodes[i])
       continue;
 
     pDiff->AppendNew<CPDF_Number>(static_cast<int>(i));
-    pDiff->AppendNew<CPDF_Name>(PDF_AdobeNameFromUnicode(m_Unicodes[i]));
+    pDiff->AppendNew<CPDF_Name>(AdobeNameFromUnicode(m_Unicodes[i]));
   }
 
   auto pDict = pdfium::MakeRetain<CPDF_Dictionary>(pPool);
@@ -1755,7 +1755,7 @@
   return kMacRomanEncoding[charcode];
 }
 
-const uint16_t* PDF_UnicodesForPredefinedCharSet(FontEncoding encoding) {
+const uint16_t* UnicodesForPredefinedCharSet(FontEncoding encoding) {
   switch (encoding) {
     case FontEncoding::kBuiltin:
       return nullptr;
@@ -1778,8 +1778,8 @@
   }
 }
 
-const char* PDF_CharNameFromPredefinedCharSet(FontEncoding encoding,
-                                              uint8_t charcode) {
+const char* CharNameFromPredefinedCharSet(FontEncoding encoding,
+                                          uint8_t charcode) {
   if (encoding == FontEncoding::kPdfDoc) {
     if (charcode < kPDFDocEncodingTableFirstChar)
       return nullptr;
diff --git a/core/fpdfapi/font/cpdf_fontencoding.h b/core/fpdfapi/font/cpdf_fontencoding.h
index 3e7f64a..0e8d550 100644
--- a/core/fpdfapi/font/cpdf_fontencoding.h
+++ b/core/fpdfapi/font/cpdf_fontencoding.h
@@ -27,9 +27,9 @@
 uint32_t CharCodeFromUnicodeForFreetypeEncoding(int encoding, wchar_t unicode);
 wchar_t UnicodeFromAppleRomanCharCode(uint8_t charcode);
 
-const uint16_t* PDF_UnicodesForPredefinedCharSet(FontEncoding encoding);
-const char* PDF_CharNameFromPredefinedCharSet(FontEncoding encoding,
-                                              uint8_t charcode);
+const uint16_t* UnicodesForPredefinedCharSet(FontEncoding encoding);
+const char* CharNameFromPredefinedCharSet(FontEncoding encoding,
+                                          uint8_t charcode);
 
 class CPDF_Object;
 
diff --git a/core/fpdfapi/font/cpdf_truetypefont.cpp b/core/fpdfapi/font/cpdf_truetypefont.cpp
index d927913..a8f6ca9 100644
--- a/core/fpdfapi/font/cpdf_truetypefont.cpp
+++ b/core/fpdfapi/font/cpdf_truetypefont.cpp
@@ -78,7 +78,7 @@
             m_pFontFile ? FT_Get_Char_Index(face, charcode) : -1;
         continue;
       }
-      m_Encoding.SetUnicode(charcode, PDF_UnicodeFromAdobeName(name));
+      m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
       if (charmap_type == CharmapType::kMSSymbol) {
         m_GlyphIndex[charcode] = GetGlyphIndexForMSSymbol(face, charcode);
       } else if (m_Encoding.UnicodeFromCharCode(charcode)) {
@@ -125,7 +125,7 @@
           const char* name =
               GetAdobeCharName(base_encoding, m_CharNames, charcode);
           if (name)
-            m_Encoding.SetUnicode(charcode, PDF_UnicodeFromAdobeName(name));
+            m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
         }
       } else if (UseTTCharmapMacRoman(face)) {
         for (uint32_t charcode = 0; charcode < 256; charcode++) {
@@ -145,7 +145,7 @@
       return;
   }
   if (FXFT_Select_Charmap(face, FT_ENCODING_UNICODE) == 0) {
-    const uint16_t* pUnicodes = PDF_UnicodesForPredefinedCharSet(base_encoding);
+    const uint16_t* pUnicodes = UnicodesForPredefinedCharSet(base_encoding);
     for (uint32_t charcode = 0; charcode < 256; charcode++) {
       if (m_pFontFile) {
         m_Encoding.SetUnicode(charcode, charcode);
@@ -153,7 +153,7 @@
         const char* name =
             GetAdobeCharName(FontEncoding::kBuiltin, m_CharNames, charcode);
         if (name)
-          m_Encoding.SetUnicode(charcode, PDF_UnicodeFromAdobeName(name));
+          m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
         else if (pUnicodes)
           m_Encoding.SetUnicode(charcode, pUnicodes[charcode]);
       }
diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp
index 2799f89..dbd6a3d 100644
--- a/core/fpdfapi/font/cpdf_type1font.cpp
+++ b/core/fpdfapi/font/cpdf_type1font.cpp
@@ -172,7 +172,7 @@
       if (!name)
         continue;
 
-      m_Encoding.SetUnicode(charcode, PDF_UnicodeFromAdobeName(name));
+      m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
       m_GlyphIndex[charcode] = FT_Get_Char_Index(
           m_Font.GetFaceRec(), m_Encoding.UnicodeFromCharCode(charcode));
 #if BUILDFLAG(IS_APPLE)
@@ -202,7 +202,7 @@
         const char* name =
             GetAdobeCharName(m_BaseEncoding, m_CharNames, charcode);
         if (name) {
-          m_Encoding.SetUnicode(charcode, PDF_UnicodeFromAdobeName(name));
+          m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
           m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), name);
           SetExtGID(name, charcode);
         } else {
@@ -213,7 +213,7 @@
                             name_glyph, sizeof(name_glyph));
           name_glyph[kInternalTableSize - 1] = 0;
           const wchar_t unicode =
-              name_glyph[0] != 0 ? PDF_UnicodeFromAdobeName(name_glyph) : 0;
+              name_glyph[0] != 0 ? UnicodeFromAdobeName(name_glyph) : 0;
           m_Encoding.SetUnicode(charcode, unicode);
           SetExtGID(name_glyph, charcode);
         }
@@ -229,7 +229,7 @@
       if (!name)
         continue;
 
-      m_Encoding.SetUnicode(charcode, PDF_UnicodeFromAdobeName(name));
+      m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
       const char* pStrUnicode = GlyphNameRemap(name);
       if (pStrUnicode && FT_Get_Name_Index(m_Font.GetFaceRec(), name) == 0) {
         name = pStrUnicode;
@@ -259,7 +259,7 @@
       const char* name = GetAdobeCharName(m_BaseEncoding, m_CharNames,
                                           static_cast<uint32_t>(charcode));
       if (name) {
-        m_Encoding.SetUnicode(charcode, PDF_UnicodeFromAdobeName(name));
+        m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
         m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), name);
       } else {
         m_GlyphIndex[charcode] = FT_Get_Char_Index(
@@ -270,7 +270,7 @@
                             name_glyph, sizeof(name_glyph));
           name_glyph[kInternalTableSize - 1] = 0;
           const wchar_t unicode =
-              name_glyph[0] != 0 ? PDF_UnicodeFromAdobeName(name_glyph) : 0;
+              name_glyph[0] != 0 ? UnicodeFromAdobeName(name_glyph) : 0;
           m_Encoding.SetUnicode(charcode, unicode);
         }
       }
@@ -290,7 +290,7 @@
     if (!name)
       continue;
 
-    m_Encoding.SetUnicode(charcode, PDF_UnicodeFromAdobeName(name));
+    m_Encoding.SetUnicode(charcode, UnicodeFromAdobeName(name));
     m_GlyphIndex[charcode] = FT_Get_Name_Index(m_Font.GetFaceRec(), name);
     if (m_GlyphIndex[charcode] != 0)
       continue;
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp
index 3d2f5ea..677312c 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.cpp
+++ b/core/fpdfapi/page/cpdf_docpagedata.cpp
@@ -656,7 +656,7 @@
 
   const uint16_t* pUnicodes = kFX_CharsetUnicodes[i].m_pUnicodes;
   for (int j = 0; j < 128; j++) {
-    ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]);
+    ByteString name = AdobeNameFromUnicode(pUnicodes[j]);
     pArray->AppendNew<CPDF_Name>(name.IsEmpty() ? ".notdef" : name);
   }
   pBaseDict->SetNewFor<CPDF_Reference>("Encoding", GetDocument(),
diff --git a/core/fxge/fx_font.cpp b/core/fxge/fx_font.cpp
index 7a35280..c27e93b 100644
--- a/core/fxge/fx_font.cpp
+++ b/core/fxge/fx_font.cpp
@@ -139,11 +139,11 @@
   return 0;
 }
 
-wchar_t PDF_UnicodeFromAdobeName(const char* name) {
+wchar_t UnicodeFromAdobeName(const char* name) {
   return (wchar_t)(FXFT_unicode_from_adobe_name(name) & 0x7FFFFFFF);
 }
 
-ByteString PDF_AdobeNameFromUnicode(wchar_t unicode) {
+ByteString AdobeNameFromUnicode(wchar_t unicode) {
   char glyph_name[64];
   FXFT_adobe_name_from_unicode(glyph_name, unicode);
   return ByteString(glyph_name);
diff --git a/core/fxge/fx_font.h b/core/fxge/fx_font.h
index ecb539b..0402a3e 100644
--- a/core/fxge/fx_font.h
+++ b/core/fxge/fx_font.h
@@ -91,7 +91,7 @@
   return !!(family & FXFONT_FF_SCRIPT);
 }
 
-wchar_t PDF_UnicodeFromAdobeName(const char* name);
-ByteString PDF_AdobeNameFromUnicode(wchar_t unicode);
+wchar_t UnicodeFromAdobeName(const char* name);
+ByteString AdobeNameFromUnicode(wchar_t unicode);
 
 #endif  // CORE_FXGE_FX_FONT_H_
diff --git a/core/fxge/fx_font_unittest.cpp b/core/fxge/fx_font_unittest.cpp
index 9de3d56..b9cf7b4 100644
--- a/core/fxge/fx_font_unittest.cpp
+++ b/core/fxge/fx_font_unittest.cpp
@@ -12,25 +12,24 @@
 #include "testing/utils/path_service.h"
 #include "third_party/base/check.h"
 
-TEST(FXFontTest, PDF_UnicodeFromAdobeName) {
-  EXPECT_EQ(static_cast<wchar_t>(0x0000), PDF_UnicodeFromAdobeName("nonesuch"));
-  EXPECT_EQ(static_cast<wchar_t>(0x0000), PDF_UnicodeFromAdobeName(""));
-  EXPECT_EQ(static_cast<wchar_t>(0x00b6),
-            PDF_UnicodeFromAdobeName("paragraph"));
-  EXPECT_EQ(static_cast<wchar_t>(0x00d3), PDF_UnicodeFromAdobeName("Oacute"));
-  EXPECT_EQ(static_cast<wchar_t>(0x00fe), PDF_UnicodeFromAdobeName("thorn"));
-  EXPECT_EQ(static_cast<wchar_t>(0x0384), PDF_UnicodeFromAdobeName("tonos"));
-  EXPECT_EQ(static_cast<wchar_t>(0x2022), PDF_UnicodeFromAdobeName("bullet"));
+TEST(FXFontTest, UnicodeFromAdobeName) {
+  EXPECT_EQ(static_cast<wchar_t>(0x0000), UnicodeFromAdobeName("nonesuch"));
+  EXPECT_EQ(static_cast<wchar_t>(0x0000), UnicodeFromAdobeName(""));
+  EXPECT_EQ(static_cast<wchar_t>(0x00b6), UnicodeFromAdobeName("paragraph"));
+  EXPECT_EQ(static_cast<wchar_t>(0x00d3), UnicodeFromAdobeName("Oacute"));
+  EXPECT_EQ(static_cast<wchar_t>(0x00fe), UnicodeFromAdobeName("thorn"));
+  EXPECT_EQ(static_cast<wchar_t>(0x0384), UnicodeFromAdobeName("tonos"));
+  EXPECT_EQ(static_cast<wchar_t>(0x2022), UnicodeFromAdobeName("bullet"));
 }
 
-TEST(FXFontTest, PDF_AdobeNameFromUnicode) {
-  EXPECT_STREQ("", PDF_AdobeNameFromUnicode(0x0000).c_str());
-  EXPECT_STREQ("divide", PDF_AdobeNameFromUnicode(0x00f7).c_str());
-  EXPECT_STREQ("Lslash", PDF_AdobeNameFromUnicode(0x0141).c_str());
-  EXPECT_STREQ("tonos", PDF_AdobeNameFromUnicode(0x0384).c_str());
-  EXPECT_STREQ("afii57513", PDF_AdobeNameFromUnicode(0x0691).c_str());
-  EXPECT_STREQ("angkhankhuthai", PDF_AdobeNameFromUnicode(0x0e5a).c_str());
-  EXPECT_STREQ("Euro", PDF_AdobeNameFromUnicode(0x20ac).c_str());
+TEST(FXFontTest, AdobeNameFromUnicode) {
+  EXPECT_STREQ("", AdobeNameFromUnicode(0x0000).c_str());
+  EXPECT_STREQ("divide", AdobeNameFromUnicode(0x00f7).c_str());
+  EXPECT_STREQ("Lslash", AdobeNameFromUnicode(0x0141).c_str());
+  EXPECT_STREQ("tonos", AdobeNameFromUnicode(0x0384).c_str());
+  EXPECT_STREQ("afii57513", AdobeNameFromUnicode(0x0691).c_str());
+  EXPECT_STREQ("angkhankhuthai", AdobeNameFromUnicode(0x0e5a).c_str());
+  EXPECT_STREQ("Euro", AdobeNameFromUnicode(0x20ac).c_str());
 }
 
 TEST(FXFontTest, ReadFontNameFromMicrosoftEntries) {