| 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 "../../include/fpdfapi/fpdf_page.h" | 7 #include "../../include/fpdfapi/fpdf_page.h" |
| 8 #include "../../include/fpdfapi/fpdf_pageobj.h" | 8 #include "../../include/fpdfapi/fpdf_pageobj.h" |
| 9 #include "../../include/fpdftext/fpdf_text.h" | 9 #include "../../include/fpdftext/fpdf_text.h" |
| 10 #include "txtproc.h" | 10 #include "txtproc.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 121 } |
| 122 FX_FLOAT char_left = pPosArray[cc * 2]; | 122 FX_FLOAT char_left = pPosArray[cc * 2]; |
| 123 FX_FLOAT char_right = pPosArray[cc * 2 + 1]; | 123 FX_FLOAT char_right = pPosArray[cc * 2 + 1]; |
| 124 cc ++; | 124 cc ++; |
| 125 if (char_left < last_left || (char_left - last_right) > spacew / 2) { | 125 if (char_left < last_left || (char_left - last_right) > spacew / 2) { |
| 126 pBaseLine = InsertTextBox(pBaseLine, baseline, leftx + segment_left,
leftx + segment_right, | 126 pBaseLine = InsertTextBox(pBaseLine, baseline, leftx + segment_left,
leftx + segment_right, |
| 127 topy, bottomy, spacew, fontsize_v, segment
, pFont); | 127 topy, bottomy, spacew, fontsize_v, segment
, pFont); |
| 128 segment_left = char_left; | 128 segment_left = char_left; |
| 129 segment = ""; | 129 segment = ""; |
| 130 } | 130 } |
| 131 CFX_WideString wCh = pText->GetFont()->UnicodeFromCharCode(charcode); | |
| 132 FX_DWORD ch = wCh.GetLength() > 0 ? wCh.GetAt(0) : charcode; | |
| 133 if (space_count > 1) { | 131 if (space_count > 1) { |
| 134 pBaseLine = InsertTextBox(pBaseLine, baseline, leftx + segment_left,
leftx + segment_right, | 132 pBaseLine = InsertTextBox(pBaseLine, baseline, leftx + segment_left,
leftx + segment_right, |
| 135 topy, bottomy, spacew, fontsize_v, segment
, pFont); | 133 topy, bottomy, spacew, fontsize_v, segment
, pFont); |
| 136 segment = ""; | 134 segment = ""; |
| 137 } else if (space_count == 1) { | 135 } else if (space_count == 1) { |
| 138 pFont->AppendChar(segment, ' '); | 136 pFont->AppendChar(segment, ' '); |
| 139 } | 137 } |
| 140 if (segment.GetLength() == 0) { | 138 if (segment.GetLength() == 0) { |
| 141 segment_left = char_left; | 139 segment_left = char_left; |
| 142 } | 140 } |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 n = i + 3; | 372 n = i + 3; |
| 375 } | 373 } |
| 376 if(n >= j) { | 374 if(n >= j) { |
| 377 for(int m = start; m < end; m++) { | 375 for(int m = start; m < end; m++) { |
| 378 sBuffer += str[m]; | 376 sBuffer += str[m]; |
| 379 } | 377 } |
| 380 } else { | 378 } else { |
| 381 i = j; | 379 i = j; |
| 382 j = n; | 380 j = n; |
| 383 for(; n <= i; n += 3) { | 381 for(; n <= i; n += 3) { |
| 384 int ret = order.GetAt(n); | |
| 385 int start = order.GetAt(n - 2); | 382 int start = order.GetAt(n - 2); |
| 386 int count1 = order.GetAt(n - 1); | 383 int count1 = order.GetAt(n - 1); |
| 387 int end = start + count1 ; | 384 int end = start + count1 ; |
| 388 for(int m = start; m < end; m++) { | 385 for(int m = start; m < end; m++) { |
| 389 sBuffer += str[m]; | 386 sBuffer += str[m]; |
| 390 } | 387 } |
| 391 } | 388 } |
| 392 } | 389 } |
| 393 } | 390 } |
| 394 } | 391 } |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 inter_bottom, inter_top)) { | 551 inter_bottom, inter_top)) { |
| 555 return FALSE; | 552 return FALSE; |
| 556 } | 553 } |
| 557 FX_FLOAT inter_h = inter_top - inter_bottom; | 554 FX_FLOAT inter_h = inter_top - inter_bottom; |
| 558 if (inter_h < (m_Top - m_Bottom) / 2 && inter_h < (pOther->m_Top - pOther->m
_Bottom) / 2) { | 555 if (inter_h < (m_Top - m_Bottom) / 2 && inter_h < (pOther->m_Top - pOther->m
_Bottom) / 2) { |
| 559 return FALSE; | 556 return FALSE; |
| 560 } | 557 } |
| 561 FX_FLOAT dy = (FX_FLOAT)FXSYS_fabs(m_BaseLine - pOther->m_BaseLine); | 558 FX_FLOAT dy = (FX_FLOAT)FXSYS_fabs(m_BaseLine - pOther->m_BaseLine); |
| 562 for (int i = 0; i < m_TextList.GetSize(); i ++) { | 559 for (int i = 0; i < m_TextList.GetSize(); i ++) { |
| 563 CTextBox* pText = (CTextBox*)m_TextList.GetAt(i); | 560 CTextBox* pText = (CTextBox*)m_TextList.GetAt(i); |
| 564 FX_FLOAT width = pText->m_Right - pText->m_Left; | |
| 565 for (int j = 0; j < pOther->m_TextList.GetSize(); j ++) { | 561 for (int j = 0; j < pOther->m_TextList.GetSize(); j ++) { |
| 566 CTextBox* pOtherText = (CTextBox*)pOther->m_TextList.GetAt(j); | 562 CTextBox* pOtherText = (CTextBox*)pOther->m_TextList.GetAt(j); |
| 567 FX_FLOAT inter_left, inter_right; | 563 FX_FLOAT inter_left, inter_right; |
| 568 if (!GetIntersection(pText->m_Left, pText->m_Right, | 564 if (!GetIntersection(pText->m_Left, pText->m_Right, |
| 569 pOtherText->m_Left, pOtherText->m_Right, inter_
left, inter_right)) { | 565 pOtherText->m_Left, pOtherText->m_Right, inter_
left, inter_right)) { |
| 570 continue; | 566 continue; |
| 571 } | 567 } |
| 572 FX_FLOAT inter_w = inter_right - inter_left; | 568 FX_FLOAT inter_w = inter_right - inter_left; |
| 573 if (inter_w < pText->m_SpaceWidth / 2 && inter_w < pOtherText->m_Spa
ceWidth / 2) { | 569 if (inter_w < pText->m_SpaceWidth / 2 && inter_w < pOtherText->m_Spa
ceWidth / 2) { |
| 574 continue; | 570 continue; |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 { | 778 { |
| 783 buffer.EstimateSize(0, 10240); | 779 buffer.EstimateSize(0, 10240); |
| 784 CPDF_Page page; | 780 CPDF_Page page; |
| 785 page.Load(pDoc, pPage); | 781 page.Load(pDoc, pPage); |
| 786 CPDF_ParseOptions options; | 782 CPDF_ParseOptions options; |
| 787 options.m_bTextOnly = TRUE; | 783 options.m_bTextOnly = TRUE; |
| 788 options.m_bSeparateForm = FALSE; | 784 options.m_bSeparateForm = FALSE; |
| 789 page.ParseContent(&options); | 785 page.ParseContent(&options); |
| 790 _PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL); | 786 _PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL); |
| 791 } | 787 } |
| OLD | NEW |