Index: pdf/pdfium/pdfium_engine.cc |
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc |
index c012dec606898062532c979cb4cd9adbee77d5c6..a72c410240f266c5fe06981efac188ea0149bf32 100644 |
--- a/pdf/pdfium/pdfium_engine.cc |
+++ b/pdf/pdfium/pdfium_engine.cc |
@@ -136,19 +136,6 @@ struct PDFFontSubstitution { |
bool italic; |
}; |
-PP_BrowserFont_Trusted_Weight WeightToBrowserFontTrustedWeight(int weight) { |
Lei Zhang
2014/07/09 02:10:48
Why is this code deleted?
|
- COMPILE_ASSERT(PP_BROWSERFONT_TRUSTED_WEIGHT_100 == 0, |
- PP_BrowserFont_Trusted_Weight_Min); |
- COMPILE_ASSERT(PP_BROWSERFONT_TRUSTED_WEIGHT_900 == 8, |
- PP_BrowserFont_Trusted_Weight_Max); |
- const int kMinimumWeight = 100; |
- const int kMaximumWeight = 900; |
- int normalized_weight = |
- std::min(std::max(weight, kMinimumWeight), kMaximumWeight); |
- normalized_weight = (normalized_weight / 100) - 1; |
- return static_cast<PP_BrowserFont_Trusted_Weight>(normalized_weight); |
-} |
- |
// This list is for CPWL_FontMap::GetDefaultFontByCharset(). |
// We pretend to have these font natively and let the browser (or underlying |
// fontconfig) to pick the proper font on the system. |
@@ -234,9 +221,6 @@ void* MapFont(struct _FPDF_SYSFONTINFO*, int weight, int italic, |
// TODO(kochi): Pass the face in UTF-8. If face is not encoded in UTF-8, |
// convert to UTF-8 before passing. |
description.set_face(face); |
- |
- description.set_weight(WeightToBrowserFontTrustedWeight(weight)); |
- description.set_italic(italic > 0); |
} |
if (!pp::PDF::IsAvailable()) { |
@@ -3400,4 +3384,19 @@ bool PDFiumEngineExports::GetPDFDocInfo(const void* pdf_buffer, |
return true; |
} |
+bool PDFiumEngineExports::GetPDFPageSizeByIndex( |
+ const void* pdf_buffer, |
+ int buffer_size, |
+ int index, |
+ double* width, |
+ double* height) { |
+ FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, buffer_size, NULL); |
+ bool success = false; |
Lei Zhang
2014/07/09 02:10:48
Can you try following my suggested pattern? There'
|
+ if (!doc) |
+ return success; |
+ success = FPDF_GetPageSizeByIndex(doc, index, width, height) != 0; |
+ FPDF_CloseDocument(doc); |
+ return success; |
+} |
+ |
} // namespace chrome_pdf |