summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_font
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-09-15 10:15:32 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-15 10:15:32 -0700
commit38fd84428a1ea007a043be0b7d9b289e47aa5da0 (patch)
tree2bae09e8ae60d6d86e451eb7fa212f7aa9d899a8 /core/fpdfapi/fpdf_font
parent41d6bbe3d413e7854be89142b70c42a89e315cba (diff)
downloadpdfium-38fd84428a1ea007a043be0b7d9b289e47aa5da0.tar.xz
Rename dictionary set and get methods
This Cl makes the Get and Set methods consistenly use {G|S}et<Type>For. BUG=pdfium:596 Review-Url: https://codereview.chromium.org/2334323005
Diffstat (limited to 'core/fpdfapi/fpdf_font')
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_cidfont.cpp30
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_font.cpp40
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp4
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_simplefont.cpp12
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp2
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_type1font.cpp4
-rw-r--r--core/fpdfapi/fpdf_font/cpdf_type3font.cpp16
7 files changed, 54 insertions, 54 deletions
diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
index df087810f8..d0549a8fac 100644
--- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp
@@ -323,12 +323,12 @@ uint32_t CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
}
FX_BOOL CPDF_CIDFont::Load() {
- if (m_pFontDict->GetStringBy("Subtype") == "TrueType") {
+ if (m_pFontDict->GetStringFor("Subtype") == "TrueType") {
LoadGB2312();
return TRUE;
}
- CPDF_Array* pFonts = m_pFontDict->GetArrayBy("DescendantFonts");
+ CPDF_Array* pFonts = m_pFontDict->GetArrayFor("DescendantFonts");
if (!pFonts || pFonts->GetCount() != 1)
return FALSE;
@@ -336,7 +336,7 @@ FX_BOOL CPDF_CIDFont::Load() {
if (!pCIDFontDict)
return FALSE;
- m_BaseFont = pCIDFontDict->GetStringBy("BaseFont");
+ m_BaseFont = pCIDFontDict->GetStringFor("BaseFont");
if ((m_BaseFont.Compare("CourierStd") == 0 ||
m_BaseFont.Compare("CourierStd-Bold") == 0 ||
m_BaseFont.Compare("CourierStd-BoldOblique") == 0 ||
@@ -344,15 +344,15 @@ FX_BOOL CPDF_CIDFont::Load() {
!IsEmbedded()) {
m_bAdobeCourierStd = true;
}
- CPDF_Dictionary* pFontDesc = pCIDFontDict->GetDictBy("FontDescriptor");
+ CPDF_Dictionary* pFontDesc = pCIDFontDict->GetDictFor("FontDescriptor");
if (pFontDesc)
LoadFontDescriptor(pFontDesc);
- CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectBy("Encoding");
+ CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectFor("Encoding");
if (!pEncoding)
return FALSE;
- CFX_ByteString subtype = pCIDFontDict->GetStringBy("Subtype");
+ CFX_ByteString subtype = pCIDFontDict->GetStringFor("Subtype");
m_bType1 = (subtype == "CIDFontType0");
CPDF_CMapManager& manager = GetFontGlobals()->m_CMapManager;
@@ -374,10 +374,10 @@ FX_BOOL CPDF_CIDFont::Load() {
m_Charset = m_pCMap->m_Charset;
if (m_Charset == CIDSET_UNKNOWN) {
- CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDictBy("CIDSystemInfo");
+ CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDictFor("CIDSystemInfo");
if (pCIDInfo) {
m_Charset =
- CharsetFromOrdering(pCIDInfo->GetStringBy("Ordering").AsStringC());
+ CharsetFromOrdering(pCIDInfo->GetStringFor("Ordering").AsStringC());
}
}
if (m_Charset != CIDSET_UNKNOWN) {
@@ -391,15 +391,15 @@ FX_BOOL CPDF_CIDFont::Load() {
else
FT_UseCIDCharmap(m_Font.GetFace(), m_pCMap->m_Coding);
}
- m_DefaultWidth = pCIDFontDict->GetIntegerBy("DW", 1000);
- CPDF_Array* pWidthArray = pCIDFontDict->GetArrayBy("W");
+ m_DefaultWidth = pCIDFontDict->GetIntegerFor("DW", 1000);
+ CPDF_Array* pWidthArray = pCIDFontDict->GetArrayFor("W");
if (pWidthArray)
LoadMetricsArray(pWidthArray, m_WidthList, 1);
if (!IsEmbedded())
LoadSubstFont();
if (m_pFontFile || (GetSubstFont()->m_SubstFlags & FXFONT_SUBST_EXACT)) {
- CPDF_Object* pmap = pCIDFontDict->GetDirectObjectBy("CIDToGIDMap");
+ CPDF_Object* pmap = pCIDFontDict->GetDirectObjectFor("CIDToGIDMap");
if (pmap) {
if (CPDF_Stream* pStream = pmap->AsStream()) {
m_pStreamAcc.reset(new CPDF_StreamAcc);
@@ -418,11 +418,11 @@ FX_BOOL CPDF_CIDFont::Load() {
CheckFontMetrics();
if (IsVertWriting()) {
- pWidthArray = pCIDFontDict->GetArrayBy("W2");
+ pWidthArray = pCIDFontDict->GetArrayFor("W2");
if (pWidthArray) {
LoadMetricsArray(pWidthArray, m_VertMetrics, 3);
}
- CPDF_Array* pDefaultArray = pCIDFontDict->GetArrayBy("DW2");
+ CPDF_Array* pDefaultArray = pCIDFontDict->GetArrayFor("DW2");
if (pDefaultArray) {
m_DefaultVY = pDefaultArray->GetIntegerAt(0);
m_DefaultW1 = pDefaultArray->GetIntegerAt(1);
@@ -832,8 +832,8 @@ FX_FLOAT CPDF_CIDFont::CIDTransformToFloat(uint8_t ch) {
}
void CPDF_CIDFont::LoadGB2312() {
- m_BaseFont = m_pFontDict->GetStringBy("BaseFont");
- CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor");
+ m_BaseFont = m_pFontDict->GetStringFor("BaseFont");
+ CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictFor("FontDescriptor");
if (pFontDesc)
LoadFontDescriptor(pFontDesc);
diff --git a/core/fpdfapi/fpdf_font/cpdf_font.cpp b/core/fpdfapi/fpdf_font/cpdf_font.cpp
index 4747093ac4..d3f8664cd3 100644
--- a/core/fpdfapi/fpdf_font/cpdf_font.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_font.cpp
@@ -163,11 +163,11 @@ uint32_t CPDF_Font::CharCodeFromUnicode(FX_WCHAR unicode) const {
}
void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) {
- m_Flags = pFontDesc->GetIntegerBy("Flags", PDFFONT_NONSYMBOLIC);
+ m_Flags = pFontDesc->GetIntegerFor("Flags", PDFFONT_NONSYMBOLIC);
int ItalicAngle = 0;
FX_BOOL bExistItalicAngle = FALSE;
if (pFontDesc->KeyExist("ItalicAngle")) {
- ItalicAngle = pFontDesc->GetIntegerBy("ItalicAngle");
+ ItalicAngle = pFontDesc->GetIntegerFor("ItalicAngle");
bExistItalicAngle = TRUE;
}
if (ItalicAngle < 0) {
@@ -176,17 +176,17 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) {
}
FX_BOOL bExistStemV = FALSE;
if (pFontDesc->KeyExist("StemV")) {
- m_StemV = pFontDesc->GetIntegerBy("StemV");
+ m_StemV = pFontDesc->GetIntegerFor("StemV");
bExistStemV = TRUE;
}
FX_BOOL bExistAscent = FALSE;
if (pFontDesc->KeyExist("Ascent")) {
- m_Ascent = pFontDesc->GetIntegerBy("Ascent");
+ m_Ascent = pFontDesc->GetIntegerFor("Ascent");
bExistAscent = TRUE;
}
FX_BOOL bExistDescent = FALSE;
if (pFontDesc->KeyExist("Descent")) {
- m_Descent = pFontDesc->GetIntegerBy("Descent");
+ m_Descent = pFontDesc->GetIntegerFor("Descent");
bExistDescent = TRUE;
}
FX_BOOL bExistCapHeight = FALSE;
@@ -200,7 +200,7 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) {
if (m_Descent > 10) {
m_Descent = -m_Descent;
}
- CPDF_Array* pBBox = pFontDesc->GetArrayBy("FontBBox");
+ CPDF_Array* pBBox = pFontDesc->GetArrayFor("FontBBox");
if (pBBox) {
m_FontBBox.left = pBBox->GetIntegerAt(0);
m_FontBBox.bottom = pBBox->GetIntegerAt(1);
@@ -208,11 +208,11 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) {
m_FontBBox.top = pBBox->GetIntegerAt(3);
}
- CPDF_Stream* pFontFile = pFontDesc->GetStreamBy("FontFile");
+ CPDF_Stream* pFontFile = pFontDesc->GetStreamFor("FontFile");
if (!pFontFile)
- pFontFile = pFontDesc->GetStreamBy("FontFile2");
+ pFontFile = pFontDesc->GetStreamFor("FontFile2");
if (!pFontFile)
- pFontFile = pFontDesc->GetStreamBy("FontFile3");
+ pFontFile = pFontDesc->GetStreamFor("FontFile3");
if (!pFontFile)
return;
@@ -277,7 +277,7 @@ void CPDF_Font::CheckFontMetrics() {
void CPDF_Font::LoadUnicodeMap() const {
m_bToUnicodeLoaded = TRUE;
- CPDF_Stream* pStream = m_pFontDict->GetStreamBy("ToUnicode");
+ CPDF_Stream* pStream = m_pFontDict->GetStreamFor("ToUnicode");
if (!pStream) {
return;
}
@@ -309,10 +309,10 @@ CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc,
return pFont;
}
CPDF_Dictionary* pDict = new CPDF_Dictionary;
- pDict->SetAtName("Type", "Font");
- pDict->SetAtName("Subtype", "Type1");
- pDict->SetAtName("BaseFont", fontname);
- pDict->SetAtName("Encoding", "WinAnsiEncoding");
+ pDict->SetNameFor("Type", "Font");
+ pDict->SetNameFor("Subtype", "Type1");
+ pDict->SetNameFor("BaseFont", fontname);
+ pDict->SetNameFor("Encoding", "WinAnsiEncoding");
pFont = CPDF_Font::CreateFontF(nullptr, pDict);
pFontGlobals->Set(pDoc, font_id, pFont);
return pFont;
@@ -320,13 +320,13 @@ CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc,
CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc,
CPDF_Dictionary* pFontDict) {
- CFX_ByteString type = pFontDict->GetStringBy("Subtype");
+ CFX_ByteString type = pFontDict->GetStringFor("Subtype");
std::unique_ptr<CPDF_Font> pFont;
if (type == "TrueType") {
- CFX_ByteString tag = pFontDict->GetStringBy("BaseFont").Left(4);
+ CFX_ByteString tag = pFontDict->GetStringFor("BaseFont").Left(4);
for (size_t i = 0; i < FX_ArraySize(kChineseFontNames); ++i) {
if (tag == CFX_ByteString(kChineseFontNames[i], 4)) {
- CPDF_Dictionary* pFontDesc = pFontDict->GetDictBy("FontDescriptor");
+ CPDF_Dictionary* pFontDesc = pFontDict->GetDictFor("FontDescriptor");
if (!pFontDesc || !pFontDesc->KeyExist("FontFile2"))
pFont.reset(new CPDF_CIDFont);
break;
@@ -343,7 +343,7 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc,
}
pFont->m_pFontDict = pFontDict;
pFont->m_pDocument = pDoc;
- pFont->m_BaseFont = pFontDict->GetStringBy("BaseFont");
+ pFont->m_BaseFont = pFontDict->GetStringFor("BaseFont");
return pFont->Load() ? pFont.release() : nullptr;
}
@@ -396,7 +396,7 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
if (iBaseEncoding != PDFFONT_ENCODING_ADOBE_SYMBOL &&
iBaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS) {
- CFX_ByteString bsEncoding = pDict->GetStringBy("BaseEncoding");
+ CFX_ByteString bsEncoding = pDict->GetStringFor("BaseEncoding");
if (bsEncoding.Compare("MacExpertEncoding") == 0 && bTrueType) {
bsEncoding = "WinAnsiEncoding";
}
@@ -405,7 +405,7 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
if ((!bEmbedded || bTrueType) && iBaseEncoding == PDFFONT_ENCODING_BUILTIN)
iBaseEncoding = PDFFONT_ENCODING_STANDARD;
- CPDF_Array* pDiffs = pDict->GetArrayBy("Differences");
+ CPDF_Array* pDiffs = pDict->GetArrayFor("Differences");
if (!pDiffs)
return;
diff --git a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp
index 6b726f0a32..29587927bc 100644
--- a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp
@@ -1711,8 +1711,8 @@ CPDF_Object* CPDF_FontEncoding::Realize() {
}
CPDF_Dictionary* pDict = new CPDF_Dictionary;
- pDict->SetAtName("BaseEncoding", "WinAnsiEncoding");
- pDict->SetAt("Differences", pDiff);
+ pDict->SetNameFor("BaseEncoding", "WinAnsiEncoding");
+ pDict->SetFor("Differences", pDiff);
return pDict;
}
diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
index 8c4dc8d2cd..fbc1a64e30 100644
--- a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp
@@ -102,21 +102,21 @@ FX_RECT CPDF_SimpleFont::GetCharBBox(uint32_t charcode, int level) {
}
FX_BOOL CPDF_SimpleFont::LoadCommon() {
- CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor");
+ CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictFor("FontDescriptor");
if (pFontDesc) {
LoadFontDescriptor(pFontDesc);
}
- CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths");
+ CPDF_Array* pWidthArray = m_pFontDict->GetArrayFor("Widths");
m_bUseFontWidth = !pWidthArray;
if (pWidthArray) {
if (pFontDesc && pFontDesc->KeyExist("MissingWidth")) {
- int MissingWidth = pFontDesc->GetIntegerBy("MissingWidth");
+ int MissingWidth = pFontDesc->GetIntegerFor("MissingWidth");
for (int i = 0; i < 256; i++) {
m_CharWidth[i] = MissingWidth;
}
}
- size_t width_start = m_pFontDict->GetIntegerBy("FirstChar", 0);
- size_t width_end = m_pFontDict->GetIntegerBy("LastChar", 0);
+ size_t width_start = m_pFontDict->GetIntegerFor("FirstChar", 0);
+ size_t width_end = m_pFontDict->GetIntegerFor("LastChar", 0);
if (width_start <= 255) {
if (width_end == 0 || width_end >= width_start + pWidthArray->GetCount())
width_end = width_start + pWidthArray->GetCount() - 1;
@@ -136,7 +136,7 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() {
if (!(m_Flags & PDFFONT_SYMBOLIC)) {
m_BaseEncoding = PDFFONT_ENCODING_STANDARD;
}
- CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectBy("Encoding");
+ CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectFor("Encoding");
LoadPDFEncoding(pEncoding, m_BaseEncoding, &m_CharNames, !!m_pFontFile,
m_Font.IsTTFont());
LoadGlyphMap();
diff --git a/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp b/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp
index 25baf45d02..d54553ab10 100644
--- a/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp
@@ -68,7 +68,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
(m_Flags & PDFFONT_NONSYMBOLIC)) {
if (!FXFT_Has_Glyph_Names(m_Font.GetFace()) &&
(!m_Font.GetFace()->num_charmaps || !m_Font.GetFace()->charmaps)) {
- int nStartChar = m_pFontDict->GetIntegerBy("FirstChar");
+ int nStartChar = m_pFontDict->GetIntegerFor("FirstChar");
if (nStartChar < 0 || nStartChar > 255)
return;
diff --git a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp
index c316d8d424..72fc947d31 100644
--- a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp
@@ -80,9 +80,9 @@ CPDF_Type1Font* CPDF_Type1Font::AsType1Font() {
FX_BOOL CPDF_Type1Font::Load() {
m_Base14Font = PDF_GetStandardFontName(&m_BaseFont);
if (m_Base14Font >= 0) {
- CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor");
+ CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictFor("FontDescriptor");
if (pFontDesc && pFontDesc->KeyExist("Flags"))
- m_Flags = pFontDesc->GetIntegerBy("Flags");
+ m_Flags = pFontDesc->GetIntegerFor("Flags");
else
m_Flags = m_Base14Font >= 12 ? PDFFONT_SYMBOLIC : PDFFONT_NONSYMBOLIC;
diff --git a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp
index 849ad92298..69857575b5 100644
--- a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp
+++ b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp
@@ -38,23 +38,23 @@ CPDF_Type3Font* CPDF_Type3Font::AsType3Font() {
}
FX_BOOL CPDF_Type3Font::Load() {
- m_pFontResources = m_pFontDict->GetDictBy("Resources");
- CPDF_Array* pMatrix = m_pFontDict->GetArrayBy("FontMatrix");
+ m_pFontResources = m_pFontDict->GetDictFor("Resources");
+ CPDF_Array* pMatrix = m_pFontDict->GetArrayFor("FontMatrix");
FX_FLOAT xscale = 1.0f, yscale = 1.0f;
if (pMatrix) {
m_FontMatrix = pMatrix->GetMatrix();
xscale = m_FontMatrix.a;
yscale = m_FontMatrix.d;
}
- CPDF_Array* pBBox = m_pFontDict->GetArrayBy("FontBBox");
+ CPDF_Array* pBBox = m_pFontDict->GetArrayFor("FontBBox");
if (pBBox) {
m_FontBBox.left = (int32_t)(pBBox->GetNumberAt(0) * xscale * 1000);
m_FontBBox.bottom = (int32_t)(pBBox->GetNumberAt(1) * yscale * 1000);
m_FontBBox.right = (int32_t)(pBBox->GetNumberAt(2) * xscale * 1000);
m_FontBBox.top = (int32_t)(pBBox->GetNumberAt(3) * yscale * 1000);
}
- int StartChar = m_pFontDict->GetIntegerBy("FirstChar");
- CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths");
+ int StartChar = m_pFontDict->GetIntegerFor("FirstChar");
+ CPDF_Array* pWidthArray = m_pFontDict->GetArrayFor("Widths");
if (pWidthArray && (StartChar >= 0 && StartChar < 256)) {
size_t count = pWidthArray->GetCount();
if (count > 256)
@@ -66,8 +66,8 @@ FX_BOOL CPDF_Type3Font::Load() {
FXSYS_round(pWidthArray->GetNumberAt(i) * xscale * 1000);
}
}
- m_pCharProcs = m_pFontDict->GetDictBy("CharProcs");
- CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectBy("Encoding");
+ m_pCharProcs = m_pFontDict->GetDictFor("CharProcs");
+ CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectFor("Encoding");
if (pEncoding) {
LoadPDFEncoding(pEncoding, m_BaseEncoding, &m_CharNames, FALSE, FALSE);
if (!m_CharNames.empty()) {
@@ -100,7 +100,7 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(uint32_t charcode, int level) {
return nullptr;
CPDF_Stream* pStream =
- ToStream(m_pCharProcs ? m_pCharProcs->GetDirectObjectBy(name) : nullptr);
+ ToStream(m_pCharProcs ? m_pCharProcs->GetDirectObjectFor(name) : nullptr);
if (!pStream)
return nullptr;