Rename some const g_foo globals to kFoo.
Make them constexpr when appropriate.
Bug: pdfium:1699
Change-Id: I79c686f9ef797c2f5b2bbedb6a4df5c113d44a62
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/83071
Reviewed-by: Daniel Hosseinian <dhoss@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 87c0491..d8b7b14 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -34,9 +34,10 @@
namespace {
-const uint16_t g_CharsetCPs[CIDSET_NUM_SETS] = {0, 936, 950, 932, 949, 1200};
+constexpr uint16_t kCharsetCodePages[CIDSET_NUM_SETS] = {0, 936, 950,
+ 932, 949, 1200};
-const struct CIDTransform {
+constexpr struct CIDTransform {
uint16_t cid;
uint8_t a;
uint8_t b;
@@ -44,7 +45,7 @@
uint8_t d;
uint8_t e;
uint8_t f;
-} g_Japan1_VertCIDs[] = {
+} kJapan1VerticalCIDs[] = {
{97, 129, 0, 0, 127, 55, 0}, {7887, 127, 0, 0, 127, 76, 89},
{7888, 127, 0, 0, 127, 79, 94}, {7889, 0, 129, 127, 0, 17, 127},
{7890, 0, 129, 127, 0, 17, 127}, {7891, 0, 129, 127, 0, 17, 127},
@@ -321,9 +322,9 @@
charcode = (charcode % 256) * 256 + (charcode / 256);
charsize = 2;
}
- int ret = FXSYS_MultiByteToWideChar(g_CharsetCPs[m_pCMap->GetCoding()], 0,
- reinterpret_cast<const char*>(&charcode),
- charsize, &unicode, 1);
+ int ret = FXSYS_MultiByteToWideChar(
+ kCharsetCodePages[m_pCMap->GetCoding()], 0,
+ reinterpret_cast<const char*>(&charcode), charsize, &unicode, 1);
return ret == 1 ? unicode : 0;
#else
if (!m_pCMap->GetEmbedMap())
@@ -365,7 +366,7 @@
#if defined(OS_WIN)
uint8_t buffer[32];
int ret = FXSYS_WideCharToMultiByte(
- g_CharsetCPs[m_pCMap->GetCoding()], 0, &unicode, 1,
+ kCharsetCodePages[m_pCMap->GetCoding()], 0, &unicode, 1,
reinterpret_cast<char*>(buffer), 4, nullptr, nullptr);
if (ret == 1)
return buffer[0];
@@ -816,7 +817,7 @@
safeStemV *= 5;
m_Font.LoadSubst(m_BaseFontName, !m_bType1, m_Flags,
safeStemV.ValueOrDefault(FXFONT_FW_NORMAL), m_ItalicAngle,
- g_CharsetCPs[m_Charset], IsVertWriting());
+ kCharsetCodePages[m_Charset], IsVertWriting());
}
// static
@@ -845,9 +846,9 @@
if (m_Charset != CIDSET_JAPAN1 || m_pFontFile)
return nullptr;
- const auto* pEnd = g_Japan1_VertCIDs + pdfium::size(g_Japan1_VertCIDs);
+ const auto* pEnd = kJapan1VerticalCIDs + pdfium::size(kJapan1VerticalCIDs);
const auto* pTransform = std::lower_bound(
- g_Japan1_VertCIDs, pEnd, cid,
+ kJapan1VerticalCIDs, pEnd, cid,
[](const CIDTransform& entry, uint16_t cid) { return entry.cid < cid; });
return (pTransform < pEnd && cid == pTransform->cid) ? &pTransform->a
: nullptr;
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp
index aa530b5..0ced183 100644
--- a/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -46,7 +46,7 @@
namespace {
-const uint8_t g_sRGBSamples1[] = {
+constexpr uint8_t kSRGBSamples1[] = {
0, 3, 6, 10, 13, 15, 18, 20, 22, 23, 25, 27, 28, 30, 31,
32, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 49, 50, 51, 52, 53, 53, 54, 55, 56, 56, 57, 58, 58,
@@ -62,7 +62,7 @@
116, 117, 117, 117, 118, 118, 118, 118, 119, 119, 119, 120,
};
-const uint8_t g_sRGBSamples2[] = {
+constexpr uint8_t kSRGBSamples2[] = {
120, 121, 122, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135,
136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 148, 149,
150, 151, 152, 153, 154, 155, 155, 156, 157, 158, 159, 159, 160, 161, 162,
@@ -405,8 +405,8 @@
colorComponent = pdfium::clamp(colorComponent, 0.0f, 1.0f);
int scale = std::max(static_cast<int>(colorComponent * 1023), 0);
if (scale < 192)
- return g_sRGBSamples1[scale] / 255.0f;
- return g_sRGBSamples2[scale / 4 - 48] / 255.0f;
+ return kSRGBSamples1[scale] / 255.0f;
+ return kSRGBSamples2[scale / 4 - 48] / 255.0f;
}
void XYZ_to_sRGB(float X, float Y, float Z, float* R, float* G, float* B) {
diff --git a/core/fpdfdoc/cpdf_dest.cpp b/core/fpdfdoc/cpdf_dest.cpp
index bb4e16a..016df00 100644
--- a/core/fpdfdoc/cpdf_dest.cpp
+++ b/core/fpdfdoc/cpdf_dest.cpp
@@ -20,14 +20,12 @@
// These arrays are indexed by the PDFDEST_VIEW_* constants.
// Last element is a sentinel.
-const char* const g_sZoomModes[] = {"Unknown", "XYZ", "Fit", "FitH",
- "FitV", "FitR", "FitB", "FitBH",
- "FitBV", nullptr};
+const char* const kZoomModes[] = {"Unknown", "XYZ", "Fit", "FitH", "FitV",
+ "FitR", "FitB", "FitBH", "FitBV", nullptr};
-const uint8_t g_sZoomModeMaxParamCount[] = {0, 3, 0, 1, 1, 4, 0, 1, 1, 0};
+constexpr uint8_t kZoomModeMaxParamCount[] = {0, 3, 0, 1, 1, 4, 0, 1, 1, 0};
-static_assert(pdfium::size(g_sZoomModes) ==
- pdfium::size(g_sZoomModeMaxParamCount),
+static_assert(pdfium::size(kZoomModes) == pdfium::size(kZoomModeMaxParamCount),
"Zoom mode count Mismatch");
} // namespace
@@ -75,8 +73,8 @@
return 0;
ByteString mode = pArray->GetString();
- for (int i = 1; g_sZoomModes[i]; ++i) {
- if (mode == g_sZoomModes[i])
+ for (int i = 1; kZoomModes[i]; ++i) {
+ if (mode == kZoomModes[i])
return i;
}
@@ -133,7 +131,7 @@
if (!m_pArray || m_pArray->size() < 2)
return 0;
- unsigned long maxParamsForFitType = g_sZoomModeMaxParamCount[GetZoomMode()];
+ unsigned long maxParamsForFitType = kZoomModeMaxParamCount[GetZoomMode()];
unsigned long numParamsInArray = m_pArray->size() - 2;
return std::min(maxParamsForFitType, numParamsInArray);
}
diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp
index 5cf15f2..acb8c35 100644
--- a/core/fpdftext/cpdf_textpage.cpp
+++ b/core/fpdftext/cpdf_textpage.cpp
@@ -34,9 +34,9 @@
constexpr float kDefaultFontSize = 1.0f;
constexpr float kSizeEpsilon = 0.01f;
-const uint16_t* const g_UnicodeData_Normalization_Maps[] = {
- g_UnicodeData_Normalization_Map2, g_UnicodeData_Normalization_Map3,
- g_UnicodeData_Normalization_Map4};
+const uint16_t* const kUnicodeDataNormalizationMaps[] = {
+ kUnicodeDataNormalizationMap2, kUnicodeDataNormalizationMap3,
+ kUnicodeDataNormalizationMap4};
float NormalizeThreshold(float threshold, int t1, int t2, int t3) {
DCHECK(t1 < t2);
@@ -78,18 +78,18 @@
std::vector<wchar_t, FxAllocAllocator<wchar_t>> GetUnicodeNormalization(
wchar_t wch) {
wch = wch & 0xFFFF;
- wchar_t wFind = g_UnicodeData_Normalization[wch];
+ wchar_t wFind = kUnicodeDataNormalization[wch];
if (!wFind)
return std::vector<wchar_t, FxAllocAllocator<wchar_t>>(1, wch);
if (wFind >= 0x8000) {
return std::vector<wchar_t, FxAllocAllocator<wchar_t>>(
- 1, g_UnicodeData_Normalization_Map1[wFind - 0x8000]);
+ 1, kUnicodeDataNormalizationMap1[wFind - 0x8000]);
}
wch = wFind & 0x0FFF;
wFind >>= 12;
- const uint16_t* pMap = g_UnicodeData_Normalization_Maps[wFind - 2] + wch;
+ const uint16_t* pMap = kUnicodeDataNormalizationMaps[wFind - 2] + wch;
if (wFind == 4)
wFind = static_cast<wchar_t>(*pMap++);
diff --git a/core/fpdftext/unicodenormalizationdata.cpp b/core/fpdftext/unicodenormalizationdata.cpp
index 7cbc2f7..9d26cbf 100644
--- a/core/fpdftext/unicodenormalizationdata.cpp
+++ b/core/fpdftext/unicodenormalizationdata.cpp
@@ -7,7 +7,7 @@
#include "core/fpdftext/unicodenormalizationdata.h"
#include "core/fxcrt/fx_system.h"
-const uint16_t g_UnicodeData_Normalization[65536] = {
+const uint16_t kUnicodeDataNormalization[65536] = {
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
@@ -7291,7 +7291,7 @@
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000};
-const uint16_t g_UnicodeData_Normalization_Map1[5376] = {
+const uint16_t kUnicodeDataNormalizationMap1[5376] = {
0x0066, 0x0053, 0x0053, 0x0059, 0x0020, 0x0308, 0x0061, 0x0052, 0x0304,
0x0032, 0x0033, 0x0301, 0x03BC, 0x0327, 0x0031, 0x006F, 0x0041, 0x0041,
0x0041, 0x0041, 0x0041, 0x0041, 0x0043, 0x0045, 0x0045, 0x0045, 0x0045,
@@ -7891,7 +7891,7 @@
0x00AC, 0x00AF, 0x00A6, 0x00A5, 0x20A9, 0x2502, 0x2190, 0x2191, 0x2192,
0x2193, 0x25A0, 0x25CB};
-const uint16_t g_UnicodeData_Normalization_Map2[1724] = {
+const uint16_t kUnicodeDataNormalizationMap2[1724] = {
0x004F, 0x0045, 0x0054, 0x004D, 0x006F, 0x0065, 0x0049, 0x004A, 0x0069,
0x006A, 0x004F, 0x0045, 0x006F, 0x0065, 0x0044, 0x017D, 0x0044, 0x017E,
0x0064, 0x017E, 0x004C, 0x004A, 0x004C, 0x006A, 0x006C, 0x006A, 0x004E,
@@ -8085,7 +8085,7 @@
0x0644, 0x0622, 0x0644, 0x0623, 0x0644, 0x0623, 0x0644, 0x0625, 0x0644,
0x0625, 0x0644, 0x0627, 0x0644, 0x0627};
-const uint16_t g_UnicodeData_Normalization_Map3[1164] = {
+const uint16_t kUnicodeDataNormalizationMap3[1164] = {
0x0031, 0x002F, 0x0034, 0x0031, 0x002F, 0x0032, 0x0033, 0x002F, 0x0034,
0x002E, 0x002E, 0x002E, 0x2032, 0x2032, 0x2032, 0x2035, 0x2035, 0x2035,
0x0061, 0x002F, 0x0063, 0x0061, 0x002F, 0x0073, 0x0063, 0x002F, 0x006F,
@@ -8217,7 +8217,7 @@
0x0646, 0x062C, 0x064A, 0x0635, 0x0644, 0x06D2, 0x0642, 0x0644, 0x06D2,
0x0635, 0x0644, 0x0649};
-const uint16_t g_UnicodeData_Normalization_Map4[488] = {
+const uint16_t kUnicodeDataNormalizationMap4[488] = {
0x0004, 0x2032, 0x2032, 0x2032, 0x2032, 0x0004, 0x0031, 0x002F, 0x0031,
0x0030, 0x0004, 0x0056, 0x0049, 0x0049, 0x0049, 0x0004, 0x0076, 0x0069,
0x0069, 0x0069, 0x0004, 0x0028, 0x0031, 0x0030, 0x0029, 0x0004, 0x0028,
diff --git a/core/fpdftext/unicodenormalizationdata.h b/core/fpdftext/unicodenormalizationdata.h
index 39ee552..a8c1969 100644
--- a/core/fpdftext/unicodenormalizationdata.h
+++ b/core/fpdftext/unicodenormalizationdata.h
@@ -9,10 +9,10 @@
#include <stdint.h>
-extern const uint16_t g_UnicodeData_Normalization[];
-extern const uint16_t g_UnicodeData_Normalization_Map1[];
-extern const uint16_t g_UnicodeData_Normalization_Map2[];
-extern const uint16_t g_UnicodeData_Normalization_Map3[];
-extern const uint16_t g_UnicodeData_Normalization_Map4[];
+extern const uint16_t kUnicodeDataNormalization[];
+extern const uint16_t kUnicodeDataNormalizationMap1[];
+extern const uint16_t kUnicodeDataNormalizationMap2[];
+extern const uint16_t kUnicodeDataNormalizationMap3[];
+extern const uint16_t kUnicodeDataNormalizationMap4[];
#endif // CORE_FPDFTEXT_UNICODENORMALIZATIONDATA_H_
diff --git a/core/fxcrt/cfx_datetime.cpp b/core/fxcrt/cfx_datetime.cpp
index fcf9eb0..1b51ada 100644
--- a/core/fxcrt/cfx_datetime.cpp
+++ b/core/fxcrt/cfx_datetime.cpp
@@ -18,16 +18,16 @@
namespace {
-const uint8_t g_FXDaysPerMonth[12] = {31, 28, 31, 30, 31, 30,
- 31, 31, 30, 31, 30, 31};
-const uint8_t g_FXDaysPerLeapMonth[12] = {31, 29, 31, 30, 31, 30,
- 31, 31, 30, 31, 30, 31};
-const int32_t g_FXDaysBeforeMonth[12] = {0, 31, 59, 90, 120, 151,
- 181, 212, 243, 273, 304, 334};
-const int32_t g_FXDaysBeforeLeapMonth[12] = {0, 31, 60, 91, 121, 152,
- 182, 213, 244, 274, 305, 335};
-const int32_t g_FXDaysPerYear = 365;
-const int32_t g_FXDaysPerLeapYear = 366;
+constexpr uint8_t kDaysPerMonth[12] = {31, 28, 31, 30, 31, 30,
+ 31, 31, 30, 31, 30, 31};
+constexpr uint8_t kDaysPerLeapMonth[12] = {31, 29, 31, 30, 31, 30,
+ 31, 31, 30, 31, 30, 31};
+constexpr int32_t kDaysBeforeMonth[12] = {0, 31, 59, 90, 120, 151,
+ 181, 212, 243, 273, 304, 334};
+constexpr int32_t kDaysBeforeLeapMonth[12] = {0, 31, 60, 91, 121, 152,
+ 182, 213, 244, 274, 305, 335};
+constexpr int32_t kDaysPerYear = 365;
+constexpr int32_t kDaysPerLeapYear = 366;
int32_t DaysBeforeMonthInYear(int32_t iYear, uint8_t iMonth) {
DCHECK(iYear != 0);
@@ -35,13 +35,13 @@
DCHECK(iMonth <= 12);
const int32_t* p =
- FX_IsLeapYear(iYear) ? g_FXDaysBeforeLeapMonth : g_FXDaysBeforeMonth;
+ FX_IsLeapYear(iYear) ? kDaysBeforeLeapMonth : kDaysBeforeMonth;
return p[iMonth - 1];
}
int32_t DaysInYear(int32_t iYear) {
DCHECK(iYear != 0);
- return FX_IsLeapYear(iYear) ? g_FXDaysPerLeapYear : g_FXDaysPerYear;
+ return FX_IsLeapYear(iYear) ? kDaysPerLeapYear : kDaysPerYear;
}
int64_t DateToDays(int32_t iYear,
@@ -87,8 +87,7 @@
DCHECK(iMonth >= 1);
DCHECK(iMonth <= 12);
- const uint8_t* p =
- FX_IsLeapYear(iYear) ? g_FXDaysPerLeapMonth : g_FXDaysPerMonth;
+ const uint8_t* p = FX_IsLeapYear(iYear) ? kDaysPerLeapMonth : kDaysPerMonth;
return p[iMonth - 1];
}
diff --git a/core/fxcrt/xml/cfx_xmlparser.cpp b/core/fxcrt/xml/cfx_xmlparser.cpp
index 59f7716..5f28388 100644
--- a/core/fxcrt/xml/cfx_xmlparser.cpp
+++ b/core/fxcrt/xml/cfx_xmlparser.cpp
@@ -40,7 +40,7 @@
bool bStartChar;
};
-const FX_XMLNAMECHAR g_XMLNameChars[] = {
+constexpr FX_XMLNAMECHAR kXMLNameChars[] = {
{L'-', L'.', false}, {L'0', L'9', false}, {L':', L':', false},
{L'A', L'Z', true}, {L'_', L'_', true}, {L'a', L'z', true},
{0xB7, 0xB7, false}, {0xC0, 0xD6, true}, {0xD8, 0xF6, true},
@@ -55,9 +55,9 @@
// static
bool CFX_XMLParser::IsXMLNameChar(wchar_t ch, bool bFirstChar) {
auto* it = std::lower_bound(
- std::begin(g_XMLNameChars), std::end(g_XMLNameChars), ch,
+ std::begin(kXMLNameChars), std::end(kXMLNameChars), ch,
[](const FX_XMLNAMECHAR& arg, wchar_t ch) { return arg.wEnd < ch; });
- return it != std::end(g_XMLNameChars) && ch >= it->wStart &&
+ return it != std::end(kXMLNameChars) && ch >= it->wStart &&
(!bFirstChar || it->bStartChar);
}
diff --git a/core/fxge/cfx_fontmapper.cpp b/core/fxge/cfx_fontmapper.cpp
index afe9a89..0a22470 100644
--- a/core/fxge/cfx_fontmapper.cpp
+++ b/core/fxge/cfx_fontmapper.cpp
@@ -54,7 +54,7 @@
CFX_FontMapper::StandardFont m_Index;
};
-const AltFontName g_AltFontNames[] = {
+constexpr AltFontName kAltFontNames[] = {
{"Arial", CFX_FontMapper::kHelvetica},
{"Arial,Bold", CFX_FontMapper::kHelveticaBold},
{"Arial,BoldItalic", CFX_FontMapper::kHelveticaBoldOblique},
@@ -151,7 +151,7 @@
const char* m_pFontFamily; // Raw, POD struct.
};
-const AltFontFamily g_AltFontFamilies[] = {
+constexpr AltFontFamily kAltFontFamilies[] = {
{"AGaramondPro", "Adobe Garamond Pro"},
{"BankGothicBT-Medium", "BankGothic Md BT"},
{"ForteMT", "Forte"},
@@ -189,7 +189,7 @@
*fontName = "FreeStyleScript";
return;
}
- for (const auto& alternate : g_AltFontFamilies) {
+ for (const auto& alternate : kAltFontFamilies) {
if (fontName->Contains(alternate.m_pFontName)) {
*fontName = alternate.m_pFontFamily;
return;
@@ -821,9 +821,9 @@
// static
Optional<CFX_FontMapper::StandardFont> CFX_FontMapper::GetStandardFontName(
ByteString* name) {
- const auto* end = std::end(g_AltFontNames);
+ const auto* end = std::end(kAltFontNames);
const auto* found =
- std::lower_bound(std::begin(g_AltFontNames), end, name->c_str(),
+ std::lower_bound(std::begin(kAltFontNames), end, name->c_str(),
[](const AltFontName& element, const char* name) {
return FXSYS_stricmp(element.m_pName, name) < 0;
});
diff --git a/core/fxge/cfx_fontmgr.cpp b/core/fxge/cfx_fontmgr.cpp
index e0ff166..6cab19f 100644
--- a/core/fxge/cfx_fontmgr.cpp
+++ b/core/fxge/cfx_fontmgr.cpp
@@ -25,26 +25,26 @@
uint32_t m_dwSize;
};
-const BuiltinFont g_FoxitFonts[14] = {
- {g_FoxitFixedFontData, 17597},
- {g_FoxitFixedBoldFontData, 18055},
- {g_FoxitFixedBoldItalicFontData, 19151},
- {g_FoxitFixedItalicFontData, 18746},
- {g_FoxitSansFontData, 15025},
- {g_FoxitSansBoldFontData, 16344},
- {g_FoxitSansBoldItalicFontData, 16418},
- {g_FoxitSansItalicFontData, 16339},
- {g_FoxitSerifFontData, 19469},
- {g_FoxitSerifBoldFontData, 19395},
- {g_FoxitSerifBoldItalicFontData, 20733},
- {g_FoxitSerifItalicFontData, 21227},
- {g_FoxitSymbolFontData, 16729},
- {g_FoxitDingbatsFontData, 29513},
+constexpr BuiltinFont kFoxitFonts[14] = {
+ {kFoxitFixedFontData, 17597},
+ {kFoxitFixedBoldFontData, 18055},
+ {kFoxitFixedBoldItalicFontData, 19151},
+ {kFoxitFixedItalicFontData, 18746},
+ {kFoxitSansFontData, 15025},
+ {kFoxitSansBoldFontData, 16344},
+ {kFoxitSansBoldItalicFontData, 16418},
+ {kFoxitSansItalicFontData, 16339},
+ {kFoxitSerifFontData, 19469},
+ {kFoxitSerifBoldFontData, 19395},
+ {kFoxitSerifBoldItalicFontData, 20733},
+ {kFoxitSerifItalicFontData, 21227},
+ {kFoxitSymbolFontData, 16729},
+ {kFoxitDingbatsFontData, 29513},
};
-const BuiltinFont g_MMFonts[2] = {
- {g_FoxitSerifMMFontData, 113417},
- {g_FoxitSansMMFontData, 66919},
+const BuiltinFont kMMFonts[2] = {
+ {kFoxitSerifMMFontData, 113417},
+ {kFoxitSansMMFontData, 66919},
};
ByteString KeyNameFromFace(const ByteString& face_name,
@@ -162,14 +162,14 @@
// static
Optional<pdfium::span<const uint8_t>> CFX_FontMgr::GetBuiltinFont(
size_t index) {
- if (index < pdfium::size(g_FoxitFonts)) {
- return pdfium::make_span(g_FoxitFonts[index].m_pFontData,
- g_FoxitFonts[index].m_dwSize);
+ if (index < pdfium::size(kFoxitFonts)) {
+ return pdfium::make_span(kFoxitFonts[index].m_pFontData,
+ kFoxitFonts[index].m_dwSize);
}
- size_t mm_index = index - pdfium::size(g_FoxitFonts);
- if (mm_index < pdfium::size(g_MMFonts)) {
- return pdfium::make_span(g_MMFonts[mm_index].m_pFontData,
- g_MMFonts[mm_index].m_dwSize);
+ size_t mm_index = index - pdfium::size(kFoxitFonts);
+ if (mm_index < pdfium::size(kMMFonts)) {
+ return pdfium::make_span(kMMFonts[mm_index].m_pFontData,
+ kMMFonts[mm_index].m_dwSize);
}
return pdfium::nullopt;
}
diff --git a/core/fxge/fontdata/chromefontdata/FoxitDingbats.cpp b/core/fxge/fontdata/chromefontdata/FoxitDingbats.cpp
index 75088ce..fa603ac 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitDingbats.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitDingbats.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitDingbatsFontData[29513] = {
+const unsigned char kFoxitDingbatsFontData[29513] = {
0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x11, 0x43, 0x68, 0x72,
0x6f, 0x6d, 0x44, 0x69, 0x6e, 0x67, 0x62, 0x61, 0x74, 0x73, 0x4f, 0x54,
0x46, 0x0, 0x1, 0x1, 0x1, 0x25, 0xf8, 0x10, 0x0, 0xf8, 0xe4, 0x1,
diff --git a/core/fxge/fontdata/chromefontdata/FoxitFixed.cpp b/core/fxge/fontdata/chromefontdata/FoxitFixed.cpp
index 61c0857..31d0537 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitFixed.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitFixed.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitFixedFontData[17597] = {
+const unsigned char kFoxitFixedFontData[17597] = {
0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0xe, 0x43, 0x68, 0x72,
0x6f, 0x6d, 0x46, 0x69, 0x78, 0x65, 0x64, 0x4f, 0x54, 0x46, 0x0, 0x1,
0x1, 0x1, 0x23, 0xf8, 0x10, 0x0, 0xf8, 0x2a, 0x1, 0xf8, 0x2b, 0x2,
diff --git a/core/fxge/fontdata/chromefontdata/FoxitFixedBold.cpp b/core/fxge/fontdata/chromefontdata/FoxitFixedBold.cpp
index c1494f5..1337e50 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitFixedBold.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitFixedBold.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitFixedBoldFontData[18055] = {
+const unsigned char kFoxitFixedBoldFontData[18055] = {
0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x13, 0x43, 0x68, 0x72,
0x6f, 0x6d, 0x46, 0x69, 0x78, 0x65, 0x64, 0x4f, 0x54, 0x46, 0x2d, 0x42,
0x6f, 0x6c, 0x64, 0x0, 0x1, 0x1, 0x1, 0x24, 0xf8, 0x10, 0x0, 0xf8,
diff --git a/core/fxge/fontdata/chromefontdata/FoxitFixedBoldItalic.cpp b/core/fxge/fontdata/chromefontdata/FoxitFixedBoldItalic.cpp
index c9509e6..ef3152d 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitFixedBoldItalic.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitFixedBoldItalic.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitFixedBoldItalicFontData[19151] = {
+const unsigned char kFoxitFixedBoldItalicFontData[19151] = {
0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x19, 0x43, 0x68, 0x72,
0x6f, 0x6d, 0x46, 0x69, 0x78, 0x65, 0x64, 0x4f, 0x54, 0x46, 0x2d, 0x42,
0x6f, 0x6c, 0x64, 0x49, 0x74, 0x61, 0x6c, 0x69, 0x63, 0x0, 0x1, 0x1,
diff --git a/core/fxge/fontdata/chromefontdata/FoxitFixedItalic.cpp b/core/fxge/fontdata/chromefontdata/FoxitFixedItalic.cpp
index 7fe9f63..3a37d54 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitFixedItalic.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitFixedItalic.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitFixedItalicFontData[18746] = {
+const unsigned char kFoxitFixedItalicFontData[18746] = {
0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x15, 0x43, 0x68, 0x72,
0x6f, 0x6d, 0x46, 0x69, 0x78, 0x65, 0x64, 0x4f, 0x54, 0x46, 0x2d, 0x49,
0x74, 0x61, 0x6c, 0x69, 0x63, 0x0, 0x1, 0x1, 0x1, 0x23, 0xf8, 0x10,
diff --git a/core/fxge/fontdata/chromefontdata/FoxitSans.cpp b/core/fxge/fontdata/chromefontdata/FoxitSans.cpp
index 16da03e..df1e3e1 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitSans.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitSans.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitSansFontData[15025] = {
+const unsigned char kFoxitSansFontData[15025] = {
0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0xd, 0x43, 0x68, 0x72,
0x6f, 0x6d, 0x53, 0x61, 0x6e, 0x73, 0x4f, 0x54, 0x46, 0x0, 0x1, 0x1,
0x1, 0x24, 0xf8, 0x10, 0x0, 0xf8, 0x1c, 0x1, 0xf8, 0x1d, 0x2, 0xf8,
diff --git a/core/fxge/fontdata/chromefontdata/FoxitSansBold.cpp b/core/fxge/fontdata/chromefontdata/FoxitSansBold.cpp
index 10a63a5..427eae7 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitSansBold.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitSansBold.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitSansBoldFontData[16344] = {
+const unsigned char kFoxitSansBoldFontData[16344] = {
0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x12, 0x43, 0x68, 0x72,
0x6f, 0x6d, 0x53, 0x61, 0x6e, 0x73, 0x4f, 0x54, 0x46, 0x2d, 0x42, 0x6f,
0x6c, 0x64, 0x0, 0x1, 0x1, 0x1, 0x24, 0xf8, 0x10, 0x0, 0xf8, 0x1c,
diff --git a/core/fxge/fontdata/chromefontdata/FoxitSansBoldItalic.cpp b/core/fxge/fontdata/chromefontdata/FoxitSansBoldItalic.cpp
index 054976c..03e20fa 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitSansBoldItalic.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitSansBoldItalic.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitSansBoldItalicFontData[16418] = {
+const unsigned char kFoxitSansBoldItalicFontData[16418] = {
0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x17, 0x43, 0x68, 0x72,
0x6f, 0x6d, 0x53, 0x61, 0x6e, 0x73, 0x50, 0x53, 0x2d, 0x42, 0x6f, 0x6c,
0x64, 0x49, 0x74, 0x61, 0x6c, 0x69, 0x63, 0x0, 0x1, 0x1, 0x1, 0x27,
diff --git a/core/fxge/fontdata/chromefontdata/FoxitSansItalic.cpp b/core/fxge/fontdata/chromefontdata/FoxitSansItalic.cpp
index 2912e16..d1243c4 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitSansItalic.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitSansItalic.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitSansItalicFontData[16339] = {
+const unsigned char kFoxitSansItalicFontData[16339] = {
0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x14, 0x43, 0x68, 0x72,
0x6f, 0x6d, 0x53, 0x61, 0x6e, 0x73, 0x4f, 0x54, 0x46, 0x2d, 0x49, 0x74,
0x61, 0x6c, 0x69, 0x63, 0x0, 0x1, 0x1, 0x1, 0x27, 0xf8, 0x10, 0x0,
diff --git a/core/fxge/fontdata/chromefontdata/FoxitSansMM.cpp b/core/fxge/fontdata/chromefontdata/FoxitSansMM.cpp
index 7f540ae..5a0a3ee 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitSansMM.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitSansMM.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitSansMMFontData[66919] = {
+const unsigned char kFoxitSansMMFontData[66919] = {
0x80, 0x01, 0xD2, 0x29, 0x00, 0x00, 0x25, 0x21, 0x50, 0x53, 0x2D, 0x41,
0x64, 0x6F, 0x62, 0x65, 0x46, 0x6F, 0x6E, 0x74, 0x2D, 0x31, 0x2E, 0x30,
0x3A, 0x20, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x65, 0x53, 0x61, 0x6E, 0x73,
diff --git a/core/fxge/fontdata/chromefontdata/FoxitSerif.cpp b/core/fxge/fontdata/chromefontdata/FoxitSerif.cpp
index 5fa276d..2775db3 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitSerif.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitSerif.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitSerifFontData[19469] = {
+const unsigned char kFoxitSerifFontData[19469] = {
0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0xe, 0x43, 0x68, 0x72,
0x6f, 0x6d, 0x53, 0x65, 0x72, 0x69, 0x66, 0x4f, 0x54, 0x46, 0x0, 0x1,
0x1, 0x1, 0x26, 0xf8, 0x10, 0x0, 0xf8, 0x1c, 0x1, 0xf8, 0x1d, 0x2,
diff --git a/core/fxge/fontdata/chromefontdata/FoxitSerifBold.cpp b/core/fxge/fontdata/chromefontdata/FoxitSerifBold.cpp
index 2875863..515f772 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitSerifBold.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitSerifBold.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitSerifBoldFontData[19395] = {
+const unsigned char kFoxitSerifBoldFontData[19395] = {
0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x13, 0x43, 0x68, 0x72,
0x6f, 0x6d, 0x53, 0x65, 0x72, 0x69, 0x66, 0x4f, 0x54, 0x46, 0x2d, 0x42,
0x6f, 0x6c, 0x64, 0x0, 0x1, 0x1, 0x1, 0x26, 0xf8, 0x10, 0x0, 0xf8,
diff --git a/core/fxge/fontdata/chromefontdata/FoxitSerifBoldItalic.cpp b/core/fxge/fontdata/chromefontdata/FoxitSerifBoldItalic.cpp
index 159e535..e9fa635 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitSerifBoldItalic.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitSerifBoldItalic.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitSerifBoldItalicFontData[20733] = {
+const unsigned char kFoxitSerifBoldItalicFontData[20733] = {
0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x19, 0x43, 0x68, 0x72,
0x6f, 0x6d, 0x53, 0x65, 0x72, 0x69, 0x66, 0x4f, 0x54, 0x46, 0x2d, 0x42,
0x6f, 0x6c, 0x64, 0x49, 0x74, 0x61, 0x6c, 0x69, 0x63, 0x0, 0x1, 0x1,
diff --git a/core/fxge/fontdata/chromefontdata/FoxitSerifItalic.cpp b/core/fxge/fontdata/chromefontdata/FoxitSerifItalic.cpp
index eec32d7..5a16014 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitSerifItalic.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitSerifItalic.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitSerifItalicFontData[21227] = {
+const unsigned char kFoxitSerifItalicFontData[21227] = {
0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0x15, 0x43, 0x68, 0x72,
0x6f, 0x6d, 0x53, 0x65, 0x72, 0x69, 0x66, 0x4f, 0x54, 0x46, 0x2d, 0x49,
0x74, 0x61, 0x6c, 0x69, 0x63, 0x0, 0x1, 0x1, 0x1, 0x2a, 0xf8, 0x10,
diff --git a/core/fxge/fontdata/chromefontdata/FoxitSerifMM.cpp b/core/fxge/fontdata/chromefontdata/FoxitSerifMM.cpp
index 4195e9c..939b4d0 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitSerifMM.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitSerifMM.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitSerifMMFontData[113417] = {
+const unsigned char kFoxitSerifMMFontData[113417] = {
0x80, 0x01, 0xD6, 0x29, 0x00, 0x00, 0x25, 0x21, 0x50, 0x53, 0x2D, 0x41,
0x64, 0x6F, 0x62, 0x65, 0x46, 0x6F, 0x6E, 0x74, 0x2D, 0x31, 0x2E, 0x30,
0x3A, 0x20, 0x43, 0x68, 0x72, 0x6f, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x69,
diff --git a/core/fxge/fontdata/chromefontdata/FoxitSymbol.cpp b/core/fxge/fontdata/chromefontdata/FoxitSymbol.cpp
index 37ce309..81364be 100644
--- a/core/fxge/fontdata/chromefontdata/FoxitSymbol.cpp
+++ b/core/fxge/fontdata/chromefontdata/FoxitSymbol.cpp
@@ -6,7 +6,7 @@
#include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
-const unsigned char g_FoxitSymbolFontData[16729] = {
+const unsigned char kFoxitSymbolFontData[16729] = {
0x1, 0x0, 0x4, 0x2, 0x0, 0x1, 0x1, 0x1, 0xf, 0x43, 0x68, 0x72,
0x6f, 0x6d, 0x53, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x4f, 0x54, 0x46, 0x0,
0x1, 0x1, 0x1, 0x26, 0xf8, 0x10, 0x0, 0xf8, 0xad, 0x1, 0xf8, 0xae,
diff --git a/core/fxge/fontdata/chromefontdata/chromefontdata.h b/core/fxge/fontdata/chromefontdata/chromefontdata.h
index cbd1ad2..3d7b217 100644
--- a/core/fxge/fontdata/chromefontdata/chromefontdata.h
+++ b/core/fxge/fontdata/chromefontdata/chromefontdata.h
@@ -7,21 +7,21 @@
#ifndef CORE_FXGE_FONTDATA_CHROMEFONTDATA_CHROMEFONTDATA_H_
#define CORE_FXGE_FONTDATA_CHROMEFONTDATA_CHROMEFONTDATA_H_
-extern const unsigned char g_FoxitFixedItalicFontData[18746];
-extern const unsigned char g_FoxitFixedFontData[17597];
-extern const unsigned char g_FoxitSansItalicFontData[16339];
-extern const unsigned char g_FoxitSansFontData[15025];
-extern const unsigned char g_FoxitSerifItalicFontData[21227];
-extern const unsigned char g_FoxitSerifFontData[19469];
-extern const unsigned char g_FoxitFixedBoldItalicFontData[19151];
-extern const unsigned char g_FoxitFixedBoldFontData[18055];
-extern const unsigned char g_FoxitSansBoldItalicFontData[16418];
-extern const unsigned char g_FoxitSansBoldFontData[16344];
-extern const unsigned char g_FoxitSerifBoldItalicFontData[20733];
-extern const unsigned char g_FoxitSerifBoldFontData[19395];
-extern const unsigned char g_FoxitSymbolFontData[16729];
-extern const unsigned char g_FoxitDingbatsFontData[29513];
-extern const unsigned char g_FoxitSerifMMFontData[113417];
-extern const unsigned char g_FoxitSansMMFontData[66919];
+extern const unsigned char kFoxitFixedItalicFontData[18746];
+extern const unsigned char kFoxitFixedFontData[17597];
+extern const unsigned char kFoxitSansItalicFontData[16339];
+extern const unsigned char kFoxitSansFontData[15025];
+extern const unsigned char kFoxitSerifItalicFontData[21227];
+extern const unsigned char kFoxitSerifFontData[19469];
+extern const unsigned char kFoxitFixedBoldItalicFontData[19151];
+extern const unsigned char kFoxitFixedBoldFontData[18055];
+extern const unsigned char kFoxitSansBoldItalicFontData[16418];
+extern const unsigned char kFoxitSansBoldFontData[16344];
+extern const unsigned char kFoxitSerifBoldItalicFontData[20733];
+extern const unsigned char kFoxitSerifBoldFontData[19395];
+extern const unsigned char kFoxitSymbolFontData[16729];
+extern const unsigned char kFoxitDingbatsFontData[29513];
+extern const unsigned char kFoxitSerifMMFontData[113417];
+extern const unsigned char kFoxitSansMMFontData[66919];
#endif // CORE_FXGE_FONTDATA_CHROMEFONTDATA_CHROMEFONTDATA_H_