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

Side by Side Diff: pdf/pdfium/pdfium_engine.cc

Issue 1129223005: Roll PDFium to 8f6445b. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « pdf/DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 #include "pdf/pdfium/pdfium_engine.h" 5 #include "pdf/pdfium/pdfium_engine.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 16 matching lines...) Expand all
27 #include "ppapi/cpp/dev/memory_dev.h" 27 #include "ppapi/cpp/dev/memory_dev.h"
28 #include "ppapi/cpp/input_event.h" 28 #include "ppapi/cpp/input_event.h"
29 #include "ppapi/cpp/instance.h" 29 #include "ppapi/cpp/instance.h"
30 #include "ppapi/cpp/module.h" 30 #include "ppapi/cpp/module.h"
31 #include "ppapi/cpp/private/pdf.h" 31 #include "ppapi/cpp/private/pdf.h"
32 #include "ppapi/cpp/trusted/browser_font_trusted.h" 32 #include "ppapi/cpp/trusted/browser_font_trusted.h"
33 #include "ppapi/cpp/url_response_info.h" 33 #include "ppapi/cpp/url_response_info.h"
34 #include "ppapi/cpp/var.h" 34 #include "ppapi/cpp/var.h"
35 #include "ppapi/cpp/var_dictionary.h" 35 #include "ppapi/cpp/var_dictionary.h"
36 #include "printing/units.h" 36 #include "printing/units.h"
37 #include "third_party/pdfium/fpdfsdk/include/pdfwindow/PDFWindow.h"
38 #include "third_party/pdfium/fpdfsdk/include/pdfwindow/PWL_FontMap.h"
39 #include "third_party/pdfium/public/fpdf_edit.h" 37 #include "third_party/pdfium/public/fpdf_edit.h"
40 #include "third_party/pdfium/public/fpdf_ext.h" 38 #include "third_party/pdfium/public/fpdf_ext.h"
41 #include "third_party/pdfium/public/fpdf_flatten.h" 39 #include "third_party/pdfium/public/fpdf_flatten.h"
42 #include "third_party/pdfium/public/fpdf_ppo.h" 40 #include "third_party/pdfium/public/fpdf_ppo.h"
43 #include "third_party/pdfium/public/fpdf_save.h" 41 #include "third_party/pdfium/public/fpdf_save.h"
44 #include "third_party/pdfium/public/fpdf_searchex.h" 42 #include "third_party/pdfium/public/fpdf_searchex.h"
45 #include "third_party/pdfium/public/fpdf_sysfontinfo.h" 43 #include "third_party/pdfium/public/fpdf_sysfontinfo.h"
46 #include "third_party/pdfium/public/fpdf_transformpage.h" 44 #include "third_party/pdfium/public/fpdf_transformpage.h"
47 #include "ui/events/keycodes/keyboard_codes.h" 45 #include "ui/events/keycodes/keyboard_codes.h"
48 46
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 normalized_weight = (normalized_weight / 100) - 1; 137 normalized_weight = (normalized_weight / 100) - 1;
140 return static_cast<PP_BrowserFont_Trusted_Weight>(normalized_weight); 138 return static_cast<PP_BrowserFont_Trusted_Weight>(normalized_weight);
141 } 139 }
142 140
143 // This list is for CPWL_FontMap::GetDefaultFontByCharset(). 141 // This list is for CPWL_FontMap::GetDefaultFontByCharset().
144 // We pretend to have these font natively and let the browser (or underlying 142 // We pretend to have these font natively and let the browser (or underlying
145 // fontconfig) to pick the proper font on the system. 143 // fontconfig) to pick the proper font on the system.
146 void EnumFonts(struct _FPDF_SYSFONTINFO* sysfontinfo, void* mapper) { 144 void EnumFonts(struct _FPDF_SYSFONTINFO* sysfontinfo, void* mapper) {
147 FPDF_AddInstalledFont(mapper, "Arial", FXFONT_DEFAULT_CHARSET); 145 FPDF_AddInstalledFont(mapper, "Arial", FXFONT_DEFAULT_CHARSET);
148 146
149 int i = 0; 147 const FPDF_CharsetFontMap* font_map = FPDF_GetDefaultTTFMap();
150 while (CPWL_FontMap::defaultTTFMap[i].charset != -1) { 148 for (; font_map->charset != -1; ++font_map) {
151 FPDF_AddInstalledFont(mapper, 149 FPDF_AddInstalledFont(mapper, font_map->fontname, font_map->charset);
152 CPWL_FontMap::defaultTTFMap[i].fontname,
153 CPWL_FontMap::defaultTTFMap[i].charset);
154 ++i;
155 } 150 }
156 } 151 }
157 152
158 const PDFFontSubstitution PDFFontSubstitutions[] = { 153 const PDFFontSubstitution PDFFontSubstitutions[] = {
159 {"Courier", "Courier New", false, false}, 154 {"Courier", "Courier New", false, false},
160 {"Courier-Bold", "Courier New", true, false}, 155 {"Courier-Bold", "Courier New", true, false},
161 {"Courier-BoldOblique", "Courier New", true, true}, 156 {"Courier-BoldOblique", "Courier New", true, true},
162 {"Courier-Oblique", "Courier New", false, true}, 157 {"Courier-Oblique", "Courier New", false, true},
163 {"Helvetica", "Arial", false, false}, 158 {"Helvetica", "Arial", false, false},
164 {"Helvetica-Bold", "Arial", true, false}, 159 {"Helvetica-Bold", "Arial", true, false},
(...skipping 3851 matching lines...) Expand 10 before | Expand all | Expand 10 after
4016 double* height) { 4011 double* height) {
4017 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); 4012 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL);
4018 if (!doc) 4013 if (!doc)
4019 return false; 4014 return false;
4020 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; 4015 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0;
4021 FPDF_CloseDocument(doc); 4016 FPDF_CloseDocument(doc);
4022 return success; 4017 return success;
4023 } 4018 }
4024 4019
4025 } // namespace chrome_pdf 4020 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « pdf/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698