Fix FPDFFont_GetBaseFontName() behavior with Type1 fonts

Use the correct internal font API to fetch /BaseFont. Then update the
test that was returning the wrong results.

Bug: 353746891
Change-Id: I5119e48d5a8541af6440a83eee003e04e763b9b5
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/122571
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Tom Sepez <tsepez@google.com>
diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp
index f6a5bec..3bdd76d 100644
--- a/fpdfsdk/fpdf_edit_embeddertest.cpp
+++ b/fpdfsdk/fpdf_edit_embeddertest.cpp
@@ -3118,8 +3118,7 @@
     FPDF_FONT font = FPDFTextObj_GetFont(page_object);
     ASSERT_TRUE(font);
     size_t size = FPDFFont_GetBaseFontName(font, nullptr, 0);
-    // TODO(crbug.com/353746891): Should be Times-Roman.
-    const char kExpectedFontName[] = "Tinos-Regular";
+    const char kExpectedFontName[] = "Times-Roman";
     ASSERT_EQ(sizeof(kExpectedFontName), size);
     std::vector<char> font_name(size);
     ASSERT_EQ(size, FPDFFont_GetBaseFontName(font, font_name.data(), size));
@@ -3131,8 +3130,7 @@
     FPDF_FONT font = FPDFTextObj_GetFont(page_object);
     ASSERT_TRUE(font);
     size_t size = FPDFFont_GetBaseFontName(font, nullptr, 0);
-    // TODO(crbug.com/353746891): Should be Helvetica.
-    const char kExpectedFontName[] = "Arimo-Regular";
+    const char kExpectedFontName[] = "Helvetica";
     ASSERT_EQ(sizeof(kExpectedFontName), size);
     std::vector<char> font_name(size);
     ASSERT_EQ(size, FPDFFont_GetBaseFontName(font, font_name.data(), size));
diff --git a/fpdfsdk/fpdf_edittext.cpp b/fpdfsdk/fpdf_edittext.cpp
index 18e5b04..4c6ce82 100644
--- a/fpdfsdk/fpdf_edittext.cpp
+++ b/fpdfsdk/fpdf_edittext.cpp
@@ -859,7 +859,7 @@
 
   // SAFETY: required from caller.
   auto result_span = UNSAFE_BUFFERS(SpanFromFPDFApiArgs(buffer, length));
-  ByteString name = cfont->GetFont()->GetBaseFontName();
+  ByteString name = cfont->GetBaseFontName();
   pdfium::span<const char> name_span = name.span_with_terminator();
   fxcrt::try_spancpy(result_span, name_span);
   return name_span.size();