OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/fpdfdoc/cpvt_generateap.h" | 7 #include "core/fpdfdoc/cpvt_generateap.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" | 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" | 10 #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 CPDF_Dictionary* pAnnotDict) { | 496 CPDF_Dictionary* pAnnotDict) { |
497 return GenerateWidgetAP(pDoc, pAnnotDict, 2); | 497 return GenerateWidgetAP(pDoc, pAnnotDict, 2); |
498 } | 498 } |
499 | 499 |
500 // Static. | 500 // Static. |
501 CFX_ByteString CPVT_GenerateAP::GenerateEditAP( | 501 CFX_ByteString CPVT_GenerateAP::GenerateEditAP( |
502 IPVT_FontMap* pFontMap, | 502 IPVT_FontMap* pFontMap, |
503 CPDF_VariableText::Iterator* pIterator, | 503 CPDF_VariableText::Iterator* pIterator, |
504 const CFX_FloatPoint& ptOffset, | 504 const CFX_FloatPoint& ptOffset, |
505 FX_BOOL bContinuous, | 505 FX_BOOL bContinuous, |
506 uint16_t SubWord, | 506 uint16_t SubWord) { |
507 const CPVT_WordRange* pVisible) { | |
508 CFX_ByteTextBuf sEditStream, sLineStream, sWords; | 507 CFX_ByteTextBuf sEditStream, sLineStream, sWords; |
509 CFX_FloatPoint ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f); | 508 CFX_FloatPoint ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f); |
510 int32_t nCurFontIndex = -1; | 509 int32_t nCurFontIndex = -1; |
511 if (pIterator) { | 510 if (pIterator) { |
512 if (pVisible) | 511 pIterator->SetAt(0); |
513 pIterator->SetAt(pVisible->BeginPos); | |
514 else | |
515 pIterator->SetAt(0); | |
516 | 512 |
517 CPVT_WordPlace oldplace; | 513 CPVT_WordPlace oldplace; |
518 while (pIterator->NextWord()) { | 514 while (pIterator->NextWord()) { |
519 CPVT_WordPlace place = pIterator->GetAt(); | 515 CPVT_WordPlace place = pIterator->GetAt(); |
520 if (pVisible && place.WordCmp(pVisible->EndPos) > 0) | |
521 break; | |
522 | |
523 if (bContinuous) { | 516 if (bContinuous) { |
524 if (place.LineCmp(oldplace) != 0) { | 517 if (place.LineCmp(oldplace) != 0) { |
525 if (sWords.GetSize() > 0) { | 518 if (sWords.GetSize() > 0) { |
526 sLineStream << GetWordRenderString(sWords.AsStringC()); | 519 sLineStream << GetWordRenderString(sWords.AsStringC()); |
527 sEditStream << sLineStream; | 520 sEditStream << sLineStream; |
528 sLineStream.Clear(); | 521 sLineStream.Clear(); |
529 sWords.Clear(); | 522 sWords.Clear(); |
530 } | 523 } |
531 CPVT_Word word; | 524 CPVT_Word word; |
532 if (pIterator->GetWord(word)) { | 525 if (pIterator->GetWord(word)) { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 int32_t nFontIndex, | 754 int32_t nFontIndex, |
762 FX_FLOAT fFontSize) { | 755 FX_FLOAT fFontSize) { |
763 CFX_ByteTextBuf sRet; | 756 CFX_ByteTextBuf sRet; |
764 if (pFontMap) { | 757 if (pFontMap) { |
765 CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex); | 758 CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex); |
766 if (sFontAlias.GetLength() > 0 && fFontSize > 0) | 759 if (sFontAlias.GetLength() > 0 && fFontSize > 0) |
767 sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n"; | 760 sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n"; |
768 } | 761 } |
769 return sRet.AsStringC(); | 762 return sRet.AsStringC(); |
770 } | 763 } |
OLD | NEW |