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

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

Issue 1507263002: PDF: Always use Courier New for fixed ANSI fonts on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « no previous file | 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/i18n/icu_encoding_detection.h" 9 #include "base/i18n/icu_encoding_detection.h"
10 #include "base/i18n/icu_string_conversions.h" 10 #include "base/i18n/icu_string_conversions.h"
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 "MS PGothic", false, false}, 199 "MS PGothic", false, false},
200 // MS Gothic in Shift_JIS encoding. 200 // MS Gothic in Shift_JIS encoding.
201 {"\x82\x6C\x82\x72\x83\x53\x83\x56\x83\x62\x83\x4E", 201 {"\x82\x6C\x82\x72\x83\x53\x83\x56\x83\x62\x83\x4E",
202 "MS Gothic", false, false}, 202 "MS Gothic", false, false},
203 // MS PMincho in Shift_JIS encoding. 203 // MS PMincho in Shift_JIS encoding.
204 {"\x82\x6C\x82\x72\x82\x6F\x96\xBE\x92\xA9", 204 {"\x82\x6C\x82\x72\x82\x6F\x96\xBE\x92\xA9",
205 "MS PMincho", false, false}, 205 "MS PMincho", false, false},
206 // MS Mincho in Shift_JIS encoding. 206 // MS Mincho in Shift_JIS encoding.
207 {"\x82\x6C\x82\x72\x96\xBE\x92\xA9", 207 {"\x82\x6C\x82\x72\x96\xBE\x92\xA9",
208 "MS Mincho", false, false}, 208 "MS Mincho", false, false},
209 }; 209 };
210
211 // Similar logic exists in PDFium's CFX_FolderFontInfo::FindFont().
212 if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH))
213 face = "Courier New";
210 214
211 // Map from the standard PDF fonts to TrueType font names. 215 // Map from the standard PDF fonts to TrueType font names.
212 size_t i; 216 size_t i;
213 for (i = 0; i < arraysize(kPdfFontSubstitutions); ++i) { 217 for (i = 0; i < arraysize(kPdfFontSubstitutions); ++i) {
214 if (strcmp(face, kPdfFontSubstitutions[i].pdf_name) == 0) { 218 if (strcmp(face, kPdfFontSubstitutions[i].pdf_name) == 0) {
215 description.set_face(kPdfFontSubstitutions[i].face); 219 description.set_face(kPdfFontSubstitutions[i].face);
216 if (kPdfFontSubstitutions[i].bold) 220 if (kPdfFontSubstitutions[i].bold)
217 description.set_weight(PP_BROWSERFONT_TRUSTED_WEIGHT_BOLD); 221 description.set_weight(PP_BROWSERFONT_TRUSTED_WEIGHT_BOLD);
218 if (kPdfFontSubstitutions[i].italic) 222 if (kPdfFontSubstitutions[i].italic)
219 description.set_italic(true); 223 description.set_italic(true);
(...skipping 3775 matching lines...) Expand 10 before | Expand all | Expand 10 after
3995 double* height) { 3999 double* height) {
3996 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); 4000 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL);
3997 if (!doc) 4001 if (!doc)
3998 return false; 4002 return false;
3999 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; 4003 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0;
4000 FPDF_CloseDocument(doc); 4004 FPDF_CloseDocument(doc);
4001 return success; 4005 return success;
4002 } 4006 }
4003 4007
4004 } // namespace chrome_pdf 4008 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698