Remove experimental FPDFTextObj_GetFontName() API.

FPDFFont_GetFontName() does the same thing.

FPDFTextObj_GetFontName(text_object, ...) can be replaced with:

FPDF_FONT font_object = FPDFTextObj_GetFont(text_object);
FPDFFont_GetFontName(font_object, ...);

Change-Id: I0e34add47759948413d5e4ca1ff2c03c1c815378
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/85276
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index 6642c50..f198ee5 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -2490,34 +2490,6 @@
   }
 }
 
-TEST_F(FPDFEditEmbedderTest, GetTextFontName) {
-  ASSERT_TRUE(OpenDocument("text_font.pdf"));
-  FPDF_PAGE page = LoadPage(0);
-  ASSERT_TRUE(page);
-  ASSERT_EQ(1, FPDFPage_CountObjects(page));
-
-  // FPDFTextObj_GetFontName() positive testing.
-  FPDF_PAGEOBJECT text = FPDFPage_GetObject(page, 0);
-  unsigned long size = FPDFTextObj_GetFontName(text, nullptr, 0);
-  const char kExpectedFontName[] = "Liberation Serif";
-  ASSERT_EQ(sizeof(kExpectedFontName), size);
-  std::vector<char> font_name(size);
-  ASSERT_EQ(size, FPDFTextObj_GetFontName(text, font_name.data(), size));
-  ASSERT_STREQ(kExpectedFontName, font_name.data());
-
-  // FPDFTextObj_GetFontName() negative testing.
-  ASSERT_EQ(0U, FPDFTextObj_GetFontName(nullptr, nullptr, 0));
-
-  font_name.resize(2);
-  font_name[0] = 'x';
-  font_name[1] = '\0';
-  size = FPDFTextObj_GetFontName(text, font_name.data(), font_name.size());
-  ASSERT_EQ(sizeof(kExpectedFontName), size);
-  ASSERT_EQ(std::string("x"), std::string(font_name.data()));
-
-  UnloadPage(page);
-}
-
 TEST_F(FPDFEditEmbedderTest, TextFontProperties) {
   // bad object tests
   EXPECT_FALSE(FPDFTextObj_GetFont(nullptr));
diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
index 9c81d0f..31b58f6 100644
--- a/fpdfsdk/fpdf_edittext.cpp
+++ b/fpdfsdk/fpdf_edittext.cpp
@@ -564,24 +564,6 @@
 }
 
 FPDF_EXPORT unsigned long FPDF_CALLCONV
-FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text,
-                        char* buffer,
-                        unsigned long length) {
-  CPDF_TextObject* pTextObj = CPDFTextObjectFromFPDFPageObject(text);
-  if (!pTextObj)
-    return 0;
-
-  RetainPtr<CPDF_Font> pPdfFont = pTextObj->GetFont();
-  CFX_Font* pFont = pPdfFont->GetFont();
-  ByteString name = pFont->GetFamilyName();
-  unsigned long dwStringLen = name.GetLength() + 1;
-  if (buffer && length >= dwStringLen)
-    memcpy(buffer, name.c_str(), dwStringLen);
-
-  return dwStringLen;
-}
-
-FPDF_EXPORT unsigned long FPDF_CALLCONV
 FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
                     FPDF_TEXTPAGE text_page,
                     FPDF_WCHAR* buffer,
diff --git a/fpdfsdk/fpdf_view_c_api_test.c b/fpdfsdk/fpdf_view_c_api_test.c
index b434ae4..44ff624 100644
--- a/fpdfsdk/fpdf_view_c_api_test.c
+++ b/fpdfsdk/fpdf_view_c_api_test.c
@@ -245,7 +245,6 @@
     CHK(FPDFPath_MoveTo);
     CHK(FPDFPath_SetDrawMode);
     CHK(FPDFTextObj_GetFont);
-    CHK(FPDFTextObj_GetFontName);
     CHK(FPDFTextObj_GetFontSize);
     CHK(FPDFTextObj_GetText);
     CHK(FPDFTextObj_GetTextRenderMode);
diff --git a/public/fpdf_edit.h b/public/fpdf_edit.h
index 19e19c2..f800bc7 100644
--- a/public/fpdf_edit.h
+++ b/public/fpdf_edit.h
@@ -1199,24 +1199,6 @@
 FPDFTextObj_SetTextRenderMode(FPDF_PAGEOBJECT text,
                               FPDF_TEXT_RENDERMODE render_mode);
 
-// Experimental API.
-// Get the font name of a text object.
-//
-// text             - the handle to the text object.
-// buffer           - the address of a buffer that receives the font name.
-// length           - the size, in bytes, of |buffer|.
-//
-// Returns the number of bytes in the font name (including the trailing NUL
-// character) on success, 0 on error.
-//
-// Regardless of the platform, the |buffer| is always in UTF-8 encoding.
-// If |length| is less than the returned length, or |buffer| is NULL, |buffer|
-// will not be modified.
-FPDF_EXPORT unsigned long FPDF_CALLCONV
-FPDFTextObj_GetFontName(FPDF_PAGEOBJECT text,
-                        char* buffer,
-                        unsigned long length);
-
 // Get the text of a text object.
 //
 // text_object      - the handle to the text object.