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 "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" | 7 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" |
8 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" | 8 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" |
9 #include "core/fpdfapi/fpdf_page/include/cpdf_pathobject.h" | 9 #include "core/fpdfapi/fpdf_page/include/cpdf_pathobject.h" |
10 #include "core/fpdfapi/fpdf_page/include/cpdf_textobject.h" | 10 #include "core/fpdfapi/fpdf_page/include/cpdf_textobject.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 crOldFill, crTextStroke, nHorzScale); | 239 crOldFill, crTextStroke, nHorzScale); |
240 | 240 |
241 sTextBuf.Clear(); | 241 sTextBuf.Clear(); |
242 } | 242 } |
243 nFontIndex = word.nFontIndex; | 243 nFontIndex = word.nFontIndex; |
244 ptBT = word.ptWord; | 244 ptBT = word.ptWord; |
245 crOldFill = crCurFill; | 245 crOldFill = crCurFill; |
246 } | 246 } |
247 | 247 |
248 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, | 248 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, |
249 SubWord); | 249 SubWord) |
| 250 .AsByteStringC(); |
250 } else { | 251 } else { |
251 DrawTextString( | 252 DrawTextString( |
252 pDevice, CFX_FloatPoint(word.ptWord.x + ptOffset.x, | 253 pDevice, CFX_FloatPoint(word.ptWord.x + ptOffset.x, |
253 word.ptWord.y + ptOffset.y), | 254 word.ptWord.y + ptOffset.y), |
254 pFontMap->GetPDFFont(word.nFontIndex), fFontSize, pUser2Device, | 255 pFontMap->GetPDFFont(word.nFontIndex), fFontSize, pUser2Device, |
255 GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord), | 256 GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord), |
256 crCurFill, crTextStroke, nHorzScale); | 257 crCurFill, crTextStroke, nHorzScale); |
257 } | 258 } |
258 oldplace = place; | 259 oldplace = place; |
259 } | 260 } |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 wp.nHorzScale); | 353 wp.nHorzScale); |
353 | 354 |
354 sTextBuf.Clear(); | 355 sTextBuf.Clear(); |
355 } | 356 } |
356 wp = word.WordProps; | 357 wp = word.WordProps; |
357 ptBT = word.ptWord; | 358 ptBT = word.ptWord; |
358 crOld = crCurText; | 359 crOld = crCurText; |
359 } | 360 } |
360 | 361 |
361 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, | 362 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, |
362 word.Word, 0); | 363 word.Word, 0) |
| 364 .AsByteStringC(); |
363 | 365 |
364 if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) { | 366 if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) { |
365 CFX_PathData pathUnderline; | 367 CFX_PathData pathUnderline; |
366 CFX_FloatRect rcUnderline = GetUnderLineRect(word); | 368 CFX_FloatRect rcUnderline = GetUnderLineRect(word); |
367 pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom, | 369 pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom, |
368 rcUnderline.right, rcUnderline.top); | 370 rcUnderline.right, rcUnderline.top); |
369 | 371 |
370 pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, crCurText, 0, | 372 pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, crCurText, 0, |
371 FXFILL_WINDING); | 373 FXFILL_WINDING); |
372 } | 374 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), | 497 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), |
496 sTextBuf.GetByteString())); | 498 sTextBuf.GetByteString())); |
497 | 499 |
498 sTextBuf.Clear(); | 500 sTextBuf.Clear(); |
499 } | 501 } |
500 | 502 |
501 ptBT = word.ptWord; | 503 ptBT = word.ptWord; |
502 nOldFontIndex = word.nFontIndex; | 504 nOldFontIndex = word.nFontIndex; |
503 } | 505 } |
504 | 506 |
505 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 0); | 507 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 0) |
| 508 .AsByteStringC(); |
506 oldplace = place; | 509 oldplace = place; |
507 } | 510 } |
508 } | 511 } |
509 | 512 |
510 if (sTextBuf.GetLength() > 0) { | 513 if (sTextBuf.GetLength() > 0) { |
511 ObjArray.Add(AddTextObjToPageObjects( | 514 ObjArray.Add(AddTextObjToPageObjects( |
512 pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), | 515 pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), |
513 fFontSize, 0.0f, 100, | 516 fFontSize, 0.0f, 100, |
514 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), | 517 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), |
515 sTextBuf.GetByteString())); | 518 sTextBuf.GetByteString())); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 | 570 |
568 sTextBuf.Clear(); | 571 sTextBuf.Clear(); |
569 } | 572 } |
570 | 573 |
571 wp = word.WordProps; | 574 wp = word.WordProps; |
572 ptBT = word.ptWord; | 575 ptBT = word.ptWord; |
573 crOld = crCurText; | 576 crOld = crCurText; |
574 } | 577 } |
575 | 578 |
576 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, | 579 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, |
577 word.Word, 0); | 580 word.Word, 0) |
| 581 .AsByteStringC(); |
578 | 582 |
579 if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) { | 583 if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) { |
580 CFX_FloatRect rcUnderline = GetUnderLineRect(word); | 584 CFX_FloatRect rcUnderline = GetUnderLineRect(word); |
581 rcUnderline.left += ptOffset.x; | 585 rcUnderline.left += ptOffset.x; |
582 rcUnderline.right += ptOffset.x; | 586 rcUnderline.right += ptOffset.x; |
583 rcUnderline.top += ptOffset.y; | 587 rcUnderline.top += ptOffset.y; |
584 rcUnderline.bottom += ptOffset.y; | 588 rcUnderline.bottom += ptOffset.y; |
585 | 589 |
586 AddRectToPageObjects(pObjectHolder, crCurText, rcUnderline); | 590 AddRectToPageObjects(pObjectHolder, crCurText, rcUnderline); |
587 } | 591 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 rcUnderline.left += ptOffset.x; | 640 rcUnderline.left += ptOffset.x; |
637 rcUnderline.right += ptOffset.x; | 641 rcUnderline.right += ptOffset.x; |
638 rcUnderline.top += ptOffset.y; | 642 rcUnderline.top += ptOffset.y; |
639 rcUnderline.bottom += ptOffset.y; | 643 rcUnderline.bottom += ptOffset.y; |
640 AddRectToPageObjects(pObjectHolder, color, rcUnderline); | 644 AddRectToPageObjects(pObjectHolder, color, rcUnderline); |
641 } | 645 } |
642 } | 646 } |
643 } | 647 } |
644 } | 648 } |
645 } | 649 } |
OLD | NEW |