Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(797)

Side by Side Diff: core/fpdfapi/fpdf_font/cpdf_simplefont.cpp

Issue 2334323005: Rename dictionary set and get methods (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/fpdf_font/cpdf_simplefont.h" 7 #include "core/fpdfapi/fpdf_font/cpdf_simplefont.h"
8 8
9 #include "core/fpdfapi/fpdf_font/font_int.h" 9 #include "core/fpdfapi/fpdf_font/font_int.h"
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 if (charcode > 0xff) 95 if (charcode > 0xff)
96 charcode = 0; 96 charcode = 0;
97 97
98 if (m_CharBBox[charcode].left == -1) 98 if (m_CharBBox[charcode].left == -1)
99 LoadCharMetrics(charcode); 99 LoadCharMetrics(charcode);
100 100
101 return m_CharBBox[charcode]; 101 return m_CharBBox[charcode];
102 } 102 }
103 103
104 FX_BOOL CPDF_SimpleFont::LoadCommon() { 104 FX_BOOL CPDF_SimpleFont::LoadCommon() {
105 CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictBy("FontDescriptor"); 105 CPDF_Dictionary* pFontDesc = m_pFontDict->GetDictFor("FontDescriptor");
106 if (pFontDesc) { 106 if (pFontDesc) {
107 LoadFontDescriptor(pFontDesc); 107 LoadFontDescriptor(pFontDesc);
108 } 108 }
109 CPDF_Array* pWidthArray = m_pFontDict->GetArrayBy("Widths"); 109 CPDF_Array* pWidthArray = m_pFontDict->GetArrayFor("Widths");
110 m_bUseFontWidth = !pWidthArray; 110 m_bUseFontWidth = !pWidthArray;
111 if (pWidthArray) { 111 if (pWidthArray) {
112 if (pFontDesc && pFontDesc->KeyExist("MissingWidth")) { 112 if (pFontDesc && pFontDesc->KeyExist("MissingWidth")) {
113 int MissingWidth = pFontDesc->GetIntegerBy("MissingWidth"); 113 int MissingWidth = pFontDesc->GetIntegerFor("MissingWidth");
114 for (int i = 0; i < 256; i++) { 114 for (int i = 0; i < 256; i++) {
115 m_CharWidth[i] = MissingWidth; 115 m_CharWidth[i] = MissingWidth;
116 } 116 }
117 } 117 }
118 size_t width_start = m_pFontDict->GetIntegerBy("FirstChar", 0); 118 size_t width_start = m_pFontDict->GetIntegerFor("FirstChar", 0);
119 size_t width_end = m_pFontDict->GetIntegerBy("LastChar", 0); 119 size_t width_end = m_pFontDict->GetIntegerFor("LastChar", 0);
120 if (width_start <= 255) { 120 if (width_start <= 255) {
121 if (width_end == 0 || width_end >= width_start + pWidthArray->GetCount()) 121 if (width_end == 0 || width_end >= width_start + pWidthArray->GetCount())
122 width_end = width_start + pWidthArray->GetCount() - 1; 122 width_end = width_start + pWidthArray->GetCount() - 1;
123 if (width_end > 255) 123 if (width_end > 255)
124 width_end = 255; 124 width_end = 255;
125 for (size_t i = width_start; i <= width_end; i++) 125 for (size_t i = width_start; i <= width_end; i++)
126 m_CharWidth[i] = pWidthArray->GetIntegerAt(i - width_start); 126 m_CharWidth[i] = pWidthArray->GetIntegerAt(i - width_start);
127 } 127 }
128 } 128 }
129 if (m_pFontFile) { 129 if (m_pFontFile) {
130 if (m_BaseFont.GetLength() > 8 && m_BaseFont[7] == '+') { 130 if (m_BaseFont.GetLength() > 8 && m_BaseFont[7] == '+') {
131 m_BaseFont = m_BaseFont.Mid(8); 131 m_BaseFont = m_BaseFont.Mid(8);
132 } 132 }
133 } else { 133 } else {
134 LoadSubstFont(); 134 LoadSubstFont();
135 } 135 }
136 if (!(m_Flags & PDFFONT_SYMBOLIC)) { 136 if (!(m_Flags & PDFFONT_SYMBOLIC)) {
137 m_BaseEncoding = PDFFONT_ENCODING_STANDARD; 137 m_BaseEncoding = PDFFONT_ENCODING_STANDARD;
138 } 138 }
139 CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectBy("Encoding"); 139 CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectFor("Encoding");
140 LoadPDFEncoding(pEncoding, m_BaseEncoding, &m_CharNames, !!m_pFontFile, 140 LoadPDFEncoding(pEncoding, m_BaseEncoding, &m_CharNames, !!m_pFontFile,
141 m_Font.IsTTFont()); 141 m_Font.IsTTFont());
142 LoadGlyphMap(); 142 LoadGlyphMap();
143 m_CharNames.clear(); 143 m_CharNames.clear();
144 if (!m_Font.GetFace()) 144 if (!m_Font.GetFace())
145 return TRUE; 145 return TRUE;
146 146
147 if (m_Flags & PDFFONT_ALLCAP) { 147 if (m_Flags & PDFFONT_ALLCAP) {
148 unsigned char kLowercases[][2] = {{'a', 'z'}, {0xe0, 0xf6}, {0xf8, 0xfd}}; 148 unsigned char kLowercases[][2] = {{'a', 'z'}, {0xe0, 0xf6}, {0xf8, 0xfd}};
149 for (size_t range = 0; range < FX_ArraySize(kLowercases); ++range) { 149 for (size_t range = 0; range < FX_ArraySize(kLowercases); ++range) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 return CFX_WideString(); 207 return CFX_WideString();
208 return ret; 208 return ret;
209 } 209 }
210 210
211 uint32_t CPDF_SimpleFont::CharCodeFromUnicode(FX_WCHAR unicode) const { 211 uint32_t CPDF_SimpleFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
212 uint32_t ret = CPDF_Font::CharCodeFromUnicode(unicode); 212 uint32_t ret = CPDF_Font::CharCodeFromUnicode(unicode);
213 if (ret) 213 if (ret)
214 return ret; 214 return ret;
215 return m_Encoding.CharCodeFromUnicode(unicode); 215 return m_Encoding.CharCodeFromUnicode(unicode);
216 } 216 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp ('k') | core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698