Add some string constants to CPDF_SimpleFont

Comsolidate string constants used in subclasses.

Change-Id: Ic077a6de113128db9091d48d93fc046956e8ae77
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/129771
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Reviewed-by: Thomas Sepez <tsepez@google.com>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fpdfapi/font/cpdf_simplefont.h b/core/fpdfapi/font/cpdf_simplefont.h
index 23bd6ff..a7c7992 100644
--- a/core/fpdfapi/font/cpdf_simplefont.h
+++ b/core/fpdfapi/font/cpdf_simplefont.h
@@ -32,6 +32,9 @@
 
   bool HasFontWidths() const override;
 
+  static constexpr char kNotDef[] = ".notdef";
+  static constexpr char kSpace[] = "space";
+
  protected:
   static constexpr size_t kInternalTableSize = 256;
 
diff --git a/core/fpdfapi/font/cpdf_truetypefont.cpp b/core/fpdfapi/font/cpdf_truetypefont.cpp
index e3be907..255bead 100644
--- a/core/fpdfapi/font/cpdf_truetypefont.cpp
+++ b/core/fpdfapi/font/cpdf_truetypefont.cpp
@@ -101,7 +101,7 @@
           !name) {
         continue;
       }
-      if (UNSAFE_TODO(strcmp(name, ".notdef")) == 0) {
+      if (UNSAFE_TODO(strcmp(name, kNotDef)) == 0) {
         m_GlyphIndex[charcode] = face->GetCharIndex(32);
         continue;
       }
diff --git a/core/fpdfapi/font/cpdf_type1font.cpp b/core/fpdfapi/font/cpdf_type1font.cpp
index 2d3adb2..56c90c1 100644
--- a/core/fpdfapi/font/cpdf_type1font.cpp
+++ b/core/fpdfapi/font/cpdf_type1font.cpp
@@ -191,7 +191,7 @@
       CalcExtGID(charcode);
 #endif
       if (m_GlyphIndex[charcode] == 0 &&
-          UNSAFE_TODO(strcmp(name, ".notdef")) == 0) {
+          UNSAFE_TODO(strcmp(name, kNotDef)) == 0) {
         m_Encoding.SetUnicode(charcode, 0x20);
         m_GlyphIndex[charcode] = face->GetCharIndex(0x20);
 #if BUILDFLAG(IS_APPLE)
@@ -248,8 +248,8 @@
       if (m_GlyphIndex[charcode] != 0)
         continue;
 
-      if (UNSAFE_TODO(strcmp(name, ".notdef")) != 0 &&
-          UNSAFE_TODO(strcmp(name, "space")) != 0) {
+      if (UNSAFE_TODO(strcmp(name, kNotDef)) != 0 &&
+          UNSAFE_TODO(strcmp(name, kSpace)) != 0) {
         m_GlyphIndex[charcode] = face->GetCharIndex(
             bUnicode ? m_Encoding.UnicodeFromCharCode(charcode) : charcode);
         CalcExtGID(charcode);
@@ -301,8 +301,8 @@
     if (m_GlyphIndex[charcode] != 0)
       continue;
 
-    if (UNSAFE_TODO(strcmp(name, ".notdef")) != 0 &&
-        UNSAFE_TODO(strcmp(name, "space")) != 0) {
+    if (UNSAFE_TODO(strcmp(name, kNotDef)) != 0 &&
+        UNSAFE_TODO(strcmp(name, kSpace)) != 0) {
       m_GlyphIndex[charcode] =
           face->GetCharIndex(bUnicode ? m_Encoding.UnicodeFromCharCode(charcode)
                                       : static_cast<uint32_t>(charcode));