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

Side by Side Diff: core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp

Issue 1294933008: Merge to XFA: Extern in .cpp file is a code smell, part 2. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: IWYU Created 5 years, 4 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 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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 "../../../include/fpdfapi/fpdf_page.h" 7 #include "../../../include/fpdfapi/fpdf_page.h"
8 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 #include "../fpdf_page/pageint.h" 9 #include "../fpdf_page/pageint.h"
10 #include <limits.h> 10 #include <limits.h>
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 FX_BOOL bTranslateName) { 212 FX_BOOL bTranslateName) {
213 LOGFONTA lfa; 213 LOGFONTA lfa;
214 FXSYS_memcpy(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa); 214 FXSYS_memcpy(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa);
215 CFX_ByteString face = CFX_ByteString::FromUnicode(pLogFont->lfFaceName); 215 CFX_ByteString face = CFX_ByteString::FromUnicode(pLogFont->lfFaceName);
216 if (face.GetLength() >= LF_FACESIZE) { 216 if (face.GetLength() >= LF_FACESIZE) {
217 return NULL; 217 return NULL;
218 } 218 }
219 FXSYS_strcpy(lfa.lfFaceName, face.c_str()); 219 FXSYS_strcpy(lfa.lfFaceName, face.c_str());
220 return AddWindowsFont(&lfa, bVert, bTranslateName); 220 return AddWindowsFont(&lfa, bVert, bTranslateName);
221 } 221 }
222 extern CFX_ByteString _FPDF_GetNameFromTT(const uint8_t* name_table,
223 FX_DWORD name);
224 CFX_ByteString _FPDF_GetPSNameFromTT(HDC hDC) { 222 CFX_ByteString _FPDF_GetPSNameFromTT(HDC hDC) {
225 CFX_ByteString result; 223 CFX_ByteString result;
226 DWORD size = ::GetFontData(hDC, 'eman', 0, NULL, 0); 224 DWORD size = ::GetFontData(hDC, 'eman', 0, NULL, 0);
227 if (size != GDI_ERROR) { 225 if (size != GDI_ERROR) {
228 LPBYTE buffer = FX_Alloc(BYTE, size); 226 LPBYTE buffer = FX_Alloc(BYTE, size);
229 ::GetFontData(hDC, 'eman', 0, buffer, size); 227 ::GetFontData(hDC, 'eman', 0, buffer, size);
230 result = _FPDF_GetNameFromTT(buffer, 6); 228 result = GetNameFromTT(buffer, 6);
231 FX_Free(buffer); 229 FX_Free(buffer);
232 } 230 }
233 return result; 231 return result;
234 } 232 }
235 CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, 233 CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont,
236 FX_BOOL bVert, 234 FX_BOOL bVert,
237 FX_BOOL bTranslateName) { 235 FX_BOOL bTranslateName) {
238 pLogFont->lfHeight = -1000; 236 pLogFont->lfHeight = -1000;
239 pLogFont->lfWidth = 0; 237 pLogFont->lfWidth = 0;
240 HGDIOBJ hFont = CreateFontIndirectA(pLogFont); 238 HGDIOBJ hFont = CreateFontIndirectA(pLogFont);
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, 1140 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict,
1143 const CFX_ByteStringC& name) { 1141 const CFX_ByteStringC& name) {
1144 if (pPageDict->KeyExist(name)) { 1142 if (pPageDict->KeyExist(name)) {
1145 return; 1143 return;
1146 } 1144 }
1147 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); 1145 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name);
1148 if (pObj) { 1146 if (pObj) {
1149 pPageDict->SetAt(name, pObj->Clone()); 1147 pPageDict->SetAt(name, pObj->Clone());
1150 } 1148 }
1151 } 1149 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698