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/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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 const base::char16 kPdfiumHyphenEOL = 0xfffe; | 465 const base::char16 kPdfiumHyphenEOL = 0xfffe; |
466 | 466 |
467 for (size_t i = 0; i < text->size(); ++i) { | 467 for (size_t i = 0; i < text->size(); ++i) { |
468 const base::char16& current_char = (*text)[i]; | 468 const base::char16& current_char = (*text)[i]; |
469 if (current_char == kPdfiumHyphenEOL) { | 469 if (current_char == kPdfiumHyphenEOL) { |
470 if (current_hyphen_position_is_valid) | 470 if (current_hyphen_position_is_valid) |
471 hyphen_positions.push_back(current_hyphen_position); | 471 hyphen_positions.push_back(current_hyphen_position); |
472 current_hyphen_position = HyphenPosition(); | 472 current_hyphen_position = HyphenPosition(); |
473 current_hyphen_position.position = i; | 473 current_hyphen_position.position = i; |
474 current_hyphen_position_is_valid = true; | 474 current_hyphen_position_is_valid = true; |
475 } else if (IsWhitespace(current_char)) { | 475 } else if (base::IsUnicodeWhitespace(current_char)) { |
476 if (current_hyphen_position_is_valid) { | 476 if (current_hyphen_position_is_valid) { |
477 if (current_char != L'\r' && current_char != L'\n') | 477 if (current_char != L'\r' && current_char != L'\n') |
478 current_hyphen_position.next_whitespace_position = i; | 478 current_hyphen_position.next_whitespace_position = i; |
479 hyphen_positions.push_back(current_hyphen_position); | 479 hyphen_positions.push_back(current_hyphen_position); |
480 current_hyphen_position_is_valid = false; | 480 current_hyphen_position_is_valid = false; |
481 } | 481 } |
482 } | 482 } |
483 } | 483 } |
484 if (current_hyphen_position_is_valid) | 484 if (current_hyphen_position_is_valid) |
485 hyphen_positions.push_back(current_hyphen_position); | 485 hyphen_positions.push_back(current_hyphen_position); |
(...skipping 3545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4031 double* height) { | 4031 double* height) { |
4032 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); | 4032 FPDF_DOCUMENT doc = FPDF_LoadMemDocument(pdf_buffer, pdf_buffer_size, NULL); |
4033 if (!doc) | 4033 if (!doc) |
4034 return false; | 4034 return false; |
4035 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; | 4035 bool success = FPDF_GetPageSizeByIndex(doc, page_number, width, height) != 0; |
4036 FPDF_CloseDocument(doc); | 4036 FPDF_CloseDocument(doc); |
4037 return success; | 4037 return success; |
4038 } | 4038 } |
4039 | 4039 |
4040 } // namespace chrome_pdf | 4040 } // namespace chrome_pdf |
OLD | NEW |