Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 // MS PMincho in Shift_JIS encoding. | 197 // MS PMincho in Shift_JIS encoding. |
| 198 {"\x82\x6C\x82\x72\x82\x6F\x96\xBE\x92\xA9", | 198 {"\x82\x6C\x82\x72\x82\x6F\x96\xBE\x92\xA9", |
| 199 "MS PMincho", false, false}, | 199 "MS PMincho", false, false}, |
| 200 // MS Mincho in Shift_JIS encoding. | 200 // MS Mincho in Shift_JIS encoding. |
| 201 {"\x82\x6C\x82\x72\x96\xBE\x92\xA9", | 201 {"\x82\x6C\x82\x72\x96\xBE\x92\xA9", |
| 202 "MS Mincho", false, false}, | 202 "MS Mincho", false, false}, |
| 203 }; | 203 }; |
| 204 | 204 |
| 205 void* MapFont(struct _FPDF_SYSFONTINFO*, int weight, int italic, | 205 void* MapFont(struct _FPDF_SYSFONTINFO*, int weight, int italic, |
| 206 int charset, int pitch_family, const char* face, int* exact) { | 206 int charset, int pitch_family, const char* face, int* exact) { |
| 207 // Do not attempt to map fonts if pepper is not initialized (for privet local | 207 // Do not attempt to map fonts if pepper is not initialized (for privet local |
|
ivandavid
2014/07/09 22:53:40
Accidentally deleted this code. I restored it. Sam
| |
| 208 // printing). | 208 // printing). |
| 209 // TODO(noamsml): Real font substitution (http://crbug.com/391978) | 209 // TODO(noamsml): Real font substitution (http://crbug.com/391978) |
| 210 if (!pp::Module::Get()) | 210 if (!pp::Module::Get()) |
| 211 return NULL; | 211 return NULL; |
| 212 | 212 |
| 213 pp::BrowserFontDescription description; | 213 pp::BrowserFontDescription description; |
| 214 | 214 |
| 215 // Pretend the system does not have the Symbol font to force a fallback to | 215 // Pretend the system does not have the Symbol font to force a fallback to |
| 216 // the built in Symbol font in CFX_FontMapper::FindSubstFont(). | 216 // the built in Symbol font in CFX_FontMapper::FindSubstFont(). |
| 217 if (strcmp(face, "Symbol") == 0) | 217 if (strcmp(face, "Symbol") == 0) |
| (...skipping 3181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3399 FPDF_GetPageSizeByIndex(doc, page_number, &page_width, &page_height); | 3399 FPDF_GetPageSizeByIndex(doc, page_number, &page_width, &page_height); |
| 3400 if (page_width > *max_page_width) { | 3400 if (page_width > *max_page_width) { |
| 3401 *max_page_width = page_width; | 3401 *max_page_width = page_width; |
| 3402 } | 3402 } |
| 3403 } | 3403 } |
| 3404 } | 3404 } |
| 3405 FPDF_CloseDocument(doc); | 3405 FPDF_CloseDocument(doc); |
| 3406 return true; | 3406 return true; |
| 3407 } | 3407 } |
| 3408 | 3408 |
| 3409 bool PDFiumEngineExports::GetPDFPageSizeByIndex( | |
| 3410 const void* pdf_buffer, | |
| 3411 int pdf_buffer_size, | |
| 3412 int page_number, | |
| 3413 double* width, | |
| 3414 double* height) { | |
| 3415 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); | |
| 3416 if (!doc) | |
| 3417 return false; | |
| 3418 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | |
| 3419 FPDF_CloseDocument(doc); | |
| 3420 return success; | |
| 3421 } | |
| 3422 | |
| 3409 } // namespace chrome_pdf | 3423 } // namespace chrome_pdf |
| OLD | NEW |