| 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 | 242 |
| 243 sTextBuf.Clear(); | 243 sTextBuf.Clear(); |
| 244 } | 244 } |
| 245 nFontIndex = word.nFontIndex; | 245 nFontIndex = word.nFontIndex; |
| 246 ptBT = word.ptWord; | 246 ptBT = word.ptWord; |
| 247 crOldFill = crCurFill; | 247 crOldFill = crCurFill; |
| 248 } | 248 } |
| 249 | 249 |
| 250 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, | 250 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, |
| 251 SubWord) | 251 SubWord) |
| 252 .AsByteStringC(); | 252 .AsStringC(); |
| 253 } else { | 253 } else { |
| 254 DrawTextString( | 254 DrawTextString( |
| 255 pDevice, CFX_FloatPoint(word.ptWord.x + ptOffset.x, | 255 pDevice, CFX_FloatPoint(word.ptWord.x + ptOffset.x, |
| 256 word.ptWord.y + ptOffset.y), | 256 word.ptWord.y + ptOffset.y), |
| 257 pFontMap->GetPDFFont(word.nFontIndex), fFontSize, pUser2Device, | 257 pFontMap->GetPDFFont(word.nFontIndex), fFontSize, pUser2Device, |
| 258 GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord), | 258 GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord), |
| 259 crCurFill, crTextStroke, nHorzScale); | 259 crCurFill, crTextStroke, nHorzScale); |
| 260 } | 260 } |
| 261 oldplace = place; | 261 oldplace = place; |
| 262 } | 262 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 | 356 |
| 357 sTextBuf.Clear(); | 357 sTextBuf.Clear(); |
| 358 } | 358 } |
| 359 wp = word.WordProps; | 359 wp = word.WordProps; |
| 360 ptBT = word.ptWord; | 360 ptBT = word.ptWord; |
| 361 crOld = crCurText; | 361 crOld = crCurText; |
| 362 } | 362 } |
| 363 | 363 |
| 364 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, | 364 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, |
| 365 word.Word, 0) | 365 word.Word, 0) |
| 366 .AsByteStringC(); | 366 .AsStringC(); |
| 367 | 367 |
| 368 if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) { | 368 if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) { |
| 369 CFX_PathData pathUnderline; | 369 CFX_PathData pathUnderline; |
| 370 CFX_FloatRect rcUnderline = GetUnderLineRect(word); | 370 CFX_FloatRect rcUnderline = GetUnderLineRect(word); |
| 371 pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom, | 371 pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom, |
| 372 rcUnderline.right, rcUnderline.top); | 372 rcUnderline.right, rcUnderline.top); |
| 373 | 373 |
| 374 pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, crCurText, 0, | 374 pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, crCurText, 0, |
| 375 FXFILL_WINDING); | 375 FXFILL_WINDING); |
| 376 } | 376 } |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 sTextBuf.GetByteString())); | 500 sTextBuf.GetByteString())); |
| 501 | 501 |
| 502 sTextBuf.Clear(); | 502 sTextBuf.Clear(); |
| 503 } | 503 } |
| 504 | 504 |
| 505 ptBT = word.ptWord; | 505 ptBT = word.ptWord; |
| 506 nOldFontIndex = word.nFontIndex; | 506 nOldFontIndex = word.nFontIndex; |
| 507 } | 507 } |
| 508 | 508 |
| 509 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 0) | 509 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 0) |
| 510 .AsByteStringC(); | 510 .AsStringC(); |
| 511 oldplace = place; | 511 oldplace = place; |
| 512 } | 512 } |
| 513 } | 513 } |
| 514 | 514 |
| 515 if (sTextBuf.GetLength() > 0) { | 515 if (sTextBuf.GetLength() > 0) { |
| 516 ObjArray.Add(AddTextObjToPageObjects( | 516 ObjArray.Add(AddTextObjToPageObjects( |
| 517 pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), | 517 pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), |
| 518 fFontSize, 0.0f, 100, | 518 fFontSize, 0.0f, 100, |
| 519 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), | 519 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), |
| 520 sTextBuf.GetByteString())); | 520 sTextBuf.GetByteString())); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 sTextBuf.Clear(); | 573 sTextBuf.Clear(); |
| 574 } | 574 } |
| 575 | 575 |
| 576 wp = word.WordProps; | 576 wp = word.WordProps; |
| 577 ptBT = word.ptWord; | 577 ptBT = word.ptWord; |
| 578 crOld = crCurText; | 578 crOld = crCurText; |
| 579 } | 579 } |
| 580 | 580 |
| 581 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, | 581 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, |
| 582 word.Word, 0) | 582 word.Word, 0) |
| 583 .AsByteStringC(); | 583 .AsStringC(); |
| 584 | 584 |
| 585 if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) { | 585 if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) { |
| 586 CFX_FloatRect rcUnderline = GetUnderLineRect(word); | 586 CFX_FloatRect rcUnderline = GetUnderLineRect(word); |
| 587 rcUnderline.left += ptOffset.x; | 587 rcUnderline.left += ptOffset.x; |
| 588 rcUnderline.right += ptOffset.x; | 588 rcUnderline.right += ptOffset.x; |
| 589 rcUnderline.top += ptOffset.y; | 589 rcUnderline.top += ptOffset.y; |
| 590 rcUnderline.bottom += ptOffset.y; | 590 rcUnderline.bottom += ptOffset.y; |
| 591 | 591 |
| 592 AddRectToPageObjects(pObjectHolder, crCurText, rcUnderline); | 592 AddRectToPageObjects(pObjectHolder, crCurText, rcUnderline); |
| 593 } | 593 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 rcUnderline.left += ptOffset.x; | 642 rcUnderline.left += ptOffset.x; |
| 643 rcUnderline.right += ptOffset.x; | 643 rcUnderline.right += ptOffset.x; |
| 644 rcUnderline.top += ptOffset.y; | 644 rcUnderline.top += ptOffset.y; |
| 645 rcUnderline.bottom += ptOffset.y; | 645 rcUnderline.bottom += ptOffset.y; |
| 646 AddRectToPageObjects(pObjectHolder, color, rcUnderline); | 646 AddRectToPageObjects(pObjectHolder, color, rcUnderline); |
| 647 } | 647 } |
| 648 } | 648 } |
| 649 } | 649 } |
| 650 } | 650 } |
| 651 } | 651 } |
| OLD | NEW |