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 "../../../third_party/base/nonstd_unique_ptr.h" | 7 #include "../../../third_party/base/nonstd_unique_ptr.h" |
8 #include "../../include/fpdfapi/fpdf_page.h" | 8 #include "../../include/fpdfapi/fpdf_page.h" |
9 #include "../../include/fpdfapi/fpdf_pageobj.h" | 9 #include "../../include/fpdfapi/fpdf_pageobj.h" |
10 #include "../../include/fpdftext/fpdf_text.h" | 10 #include "../../include/fpdftext/fpdf_text.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 return; | 309 return; |
310 } | 310 } |
311 CFX_WideString sBuffer; | 311 CFX_WideString sBuffer; |
312 nonstd::unique_ptr<IFX_BidiChar> pBidiChar(IFX_BidiChar::Create()); | 312 nonstd::unique_ptr<IFX_BidiChar> pBidiChar(IFX_BidiChar::Create()); |
313 CFX_WordArray order; | 313 CFX_WordArray order; |
314 FX_BOOL bR2L = FALSE; | 314 FX_BOOL bR2L = FALSE; |
315 int32_t start = 0, count = 0, i = 0; | 315 int32_t start = 0, count = 0, i = 0; |
316 int nR2L = 0, nL2R = 0; | 316 int nR2L = 0, nL2R = 0; |
317 for (i = 0; i < str.GetLength(); i++) { | 317 for (i = 0; i < str.GetLength(); i++) { |
318 if(pBidiChar->AppendChar(str.GetAt(i))) { | 318 if(pBidiChar->AppendChar(str.GetAt(i))) { |
319 int32_t ret = pBidiChar->GetBidiInfo(start, count); | 319 IFX_BidiChar::Direction ret = |
| 320 pBidiChar->GetBidiInfo(&start, &count); |
320 order.Add(start); | 321 order.Add(start); |
321 order.Add(count); | 322 order.Add(count); |
322 order.Add(ret); | 323 order.Add(ret); |
323 if(!bR2L) { | 324 if(!bR2L) { |
324 if(ret == 2) { | 325 if (ret == IFX_BidiChar::RIGHT) { |
325 nR2L++; | 326 nR2L++; |
326 } else if (ret == 1) { | 327 } else if (ret == IFX_BidiChar::LEFT) { |
327 nL2R++; | 328 nL2R++; |
328 } | 329 } |
329 } | 330 } |
330 } | 331 } |
331 } | 332 } |
332 if(pBidiChar->EndChar()) { | 333 if(pBidiChar->EndChar()) { |
333 int32_t ret = pBidiChar->GetBidiInfo(start, count); | 334 IFX_BidiChar::Direction ret = pBidiChar->GetBidiInfo(&start, &count); |
334 order.Add(start); | 335 order.Add(start); |
335 order.Add(count); | 336 order.Add(count); |
336 order.Add(ret); | 337 order.Add(ret); |
337 if(!bR2L) { | 338 if(!bR2L) { |
338 if(ret == 2) { | 339 if (ret == IFX_BidiChar::RIGHT) { |
339 nR2L++; | 340 nR2L++; |
340 } else if(ret == 1) { | 341 } else if (ret == IFX_BidiChar::LEFT) { |
341 nL2R++; | 342 nL2R++; |
342 } | 343 } |
343 } | 344 } |
344 } | 345 } |
345 if(nR2L > 0 && nR2L >= nL2R) { | 346 if(nR2L > 0 && nR2L >= nL2R) { |
346 bR2L = TRUE; | 347 bR2L = TRUE; |
347 } | 348 } |
348 if(bR2L) { | 349 if(bR2L) { |
349 int count = order.GetSize(); | 350 int count = order.GetSize(); |
350 for(int j = count - 1; j > 0; j -= 3) { | 351 for(int j = count - 1; j > 0; j -= 3) { |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 { | 770 { |
770 buffer.EstimateSize(0, 10240); | 771 buffer.EstimateSize(0, 10240); |
771 CPDF_Page page; | 772 CPDF_Page page; |
772 page.Load(pDoc, pPage); | 773 page.Load(pDoc, pPage); |
773 CPDF_ParseOptions options; | 774 CPDF_ParseOptions options; |
774 options.m_bTextOnly = TRUE; | 775 options.m_bTextOnly = TRUE; |
775 options.m_bSeparateForm = FALSE; | 776 options.m_bSeparateForm = FALSE; |
776 page.ParseContent(&options); | 777 page.ParseContent(&options); |
777 _PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL); | 778 _PDF_GetTextStream_Unicode(buffer, &page, TRUE, NULL); |
778 } | 779 } |
OLD | NEW |