OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium 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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "core/fpdfdoc/pdf_vt.h" | 9 #include "core/fpdfdoc/pdf_vt.h" |
10 #include "core/include/fpdfdoc/fpdf_doc.h" | 10 #include "core/include/fpdfdoc/fpdf_doc.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 | 416 |
417 return ((word >= 0x00C0 && word <= 0x00FF) || | 417 return ((word >= 0x00C0 && word <= 0x00FF) || |
418 (word >= 0x0100 && word <= 0x024F) || | 418 (word >= 0x0100 && word <= 0x024F) || |
419 (word >= 0x1E00 && word <= 0x1EFF) || | 419 (word >= 0x1E00 && word <= 0x1EFF) || |
420 (word >= 0x2C60 && word <= 0x2C7F) || | 420 (word >= 0x2C60 && word <= 0x2C7F) || |
421 (word >= 0xA720 && word <= 0xA7FF) || | 421 (word >= 0xA720 && word <= 0xA7FF) || |
422 (word >= 0xFF21 && word <= 0xFF3A) || | 422 (word >= 0xFF21 && word <= 0xFF3A) || |
423 (word >= 0xFF41 && word <= 0xFF5A)); | 423 (word >= 0xFF41 && word <= 0xFF5A)); |
424 } | 424 } |
425 | 425 |
426 static bool IsDigit(FX_DWORD word) { | 426 static bool IsDigit(uint32_t word) { |
427 return word >= 0x0030 && word <= 0x0039; | 427 return word >= 0x0030 && word <= 0x0039; |
428 } | 428 } |
429 | 429 |
430 static bool IsCJK(FX_DWORD word) { | 430 static bool IsCJK(uint32_t word) { |
431 if ((word >= 0x1100 && word <= 0x11FF) || | 431 if ((word >= 0x1100 && word <= 0x11FF) || |
432 (word >= 0x2E80 && word <= 0x2FFF) || | 432 (word >= 0x2E80 && word <= 0x2FFF) || |
433 (word >= 0x3040 && word <= 0x9FBF) || | 433 (word >= 0x3040 && word <= 0x9FBF) || |
434 (word >= 0xAC00 && word <= 0xD7AF) || | 434 (word >= 0xAC00 && word <= 0xD7AF) || |
435 (word >= 0xF900 && word <= 0xFAFF) || | 435 (word >= 0xF900 && word <= 0xFAFF) || |
436 (word >= 0xFE30 && word <= 0xFE4F) || | 436 (word >= 0xFE30 && word <= 0xFE4F) || |
437 (word >= 0x20000 && word <= 0x2A6DF) || | 437 (word >= 0x20000 && word <= 0x2A6DF) || |
438 (word >= 0x2F800 && word <= 0x2FA1F)) { | 438 (word >= 0x2F800 && word <= 0x2FA1F)) { |
439 return true; | 439 return true; |
440 } | 440 } |
441 if (word >= 0x3000 && word <= 0x303F) { | 441 if (word >= 0x3000 && word <= 0x303F) { |
442 return ( | 442 return ( |
443 word == 0x3005 || word == 0x3006 || word == 0x3021 || word == 0x3022 || | 443 word == 0x3005 || word == 0x3006 || word == 0x3021 || word == 0x3022 || |
444 word == 0x3023 || word == 0x3024 || word == 0x3025 || word == 0x3026 || | 444 word == 0x3023 || word == 0x3024 || word == 0x3025 || word == 0x3026 || |
445 word == 0x3027 || word == 0x3028 || word == 0x3029 || word == 0x3031 || | 445 word == 0x3027 || word == 0x3028 || word == 0x3029 || word == 0x3031 || |
446 word == 0x3032 || word == 0x3033 || word == 0x3034 || word == 0x3035); | 446 word == 0x3032 || word == 0x3033 || word == 0x3034 || word == 0x3035); |
447 } | 447 } |
448 return word >= 0xFF66 && word <= 0xFF9D; | 448 return word >= 0xFF66 && word <= 0xFF9D; |
449 } | 449 } |
450 | 450 |
451 static bool IsPunctuation(FX_DWORD word) { | 451 static bool IsPunctuation(uint32_t word) { |
452 if (word <= 0x007F) | 452 if (word <= 0x007F) |
453 return !!(special_chars[word] & 0x08); | 453 return !!(special_chars[word] & 0x08); |
454 | 454 |
455 if (word >= 0x0080 && word <= 0x00FF) { | 455 if (word >= 0x0080 && word <= 0x00FF) { |
456 return (word == 0x0082 || word == 0x0084 || word == 0x0085 || | 456 return (word == 0x0082 || word == 0x0084 || word == 0x0085 || |
457 word == 0x0091 || word == 0x0092 || word == 0x0093 || | 457 word == 0x0091 || word == 0x0092 || word == 0x0093 || |
458 word <= 0x0094 || word == 0x0096 || word == 0x00B4 || | 458 word <= 0x0094 || word == 0x0096 || word == 0x00B4 || |
459 word == 0x00B8); | 459 word == 0x00B8); |
460 } | 460 } |
461 | 461 |
(...skipping 26 matching lines...) Expand all Loading... |
488 word == 0xFF09 || word == 0xFF0C || word == 0xFF0E || word == 0xFF0F || | 488 word == 0xFF09 || word == 0xFF0C || word == 0xFF0E || word == 0xFF0F || |
489 word == 0xFF1A || word == 0xFF1B || word == 0xFF1F || word == 0xFF3B || | 489 word == 0xFF1A || word == 0xFF1B || word == 0xFF1F || word == 0xFF3B || |
490 word == 0xFF3D || word == 0xFF40 || word == 0xFF5B || word == 0xFF5C || | 490 word == 0xFF3D || word == 0xFF40 || word == 0xFF5B || word == 0xFF5C || |
491 word == 0xFF5D || word == 0xFF61 || word == 0xFF62 || word == 0xFF63 || | 491 word == 0xFF5D || word == 0xFF61 || word == 0xFF62 || word == 0xFF63 || |
492 word == 0xFF64 || word == 0xFF65 || word == 0xFF9E || word == 0xFF9F); | 492 word == 0xFF64 || word == 0xFF65 || word == 0xFF9E || word == 0xFF9F); |
493 } | 493 } |
494 | 494 |
495 return false; | 495 return false; |
496 } | 496 } |
497 | 497 |
498 static bool IsConnectiveSymbol(FX_DWORD word) { | 498 static bool IsConnectiveSymbol(uint32_t word) { |
499 return word <= 0x007F && (special_chars[word] & 0x20); | 499 return word <= 0x007F && (special_chars[word] & 0x20); |
500 } | 500 } |
501 | 501 |
502 static bool IsOpenStylePunctuation(FX_DWORD word) { | 502 static bool IsOpenStylePunctuation(uint32_t word) { |
503 if (word <= 0x007F) | 503 if (word <= 0x007F) |
504 return !!(special_chars[word] & 0x04); | 504 return !!(special_chars[word] & 0x04); |
505 | 505 |
506 return (word == 0x300A || word == 0x300C || word == 0x300E || | 506 return (word == 0x300A || word == 0x300C || word == 0x300E || |
507 word == 0x3010 || word == 0x3014 || word == 0x3016 || | 507 word == 0x3010 || word == 0x3014 || word == 0x3016 || |
508 word == 0x3018 || word == 0x301A || word == 0xFF08 || | 508 word == 0x3018 || word == 0x301A || word == 0xFF08 || |
509 word == 0xFF3B || word == 0xFF5B || word == 0xFF62); | 509 word == 0xFF3B || word == 0xFF5B || word == 0xFF62); |
510 } | 510 } |
511 | 511 |
512 static bool IsCurrencySymbol(uint16_t word) { | 512 static bool IsCurrencySymbol(uint16_t word) { |
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1798 if (pSection->m_SecInfo.pSecProps) { | 1798 if (pSection->m_SecInfo.pSecProps) { |
1799 *pSection->m_SecInfo.pSecProps = section.SecProps; | 1799 *pSection->m_SecInfo.pSecProps = section.SecProps; |
1800 } | 1800 } |
1801 if (pSection->m_SecInfo.pWordProps) { | 1801 if (pSection->m_SecInfo.pWordProps) { |
1802 *pSection->m_SecInfo.pWordProps = section.WordProps; | 1802 *pSection->m_SecInfo.pWordProps = section.WordProps; |
1803 } | 1803 } |
1804 return TRUE; | 1804 return TRUE; |
1805 } | 1805 } |
1806 return FALSE; | 1806 return FALSE; |
1807 } | 1807 } |
OLD | NEW |