Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Side by Side Diff: fpdfsdk/fxedit/fxet_ap.cpp

Issue 1886263003: Rename CFX_ByteTextBuf::GetByteString() to AsStringC(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_font/include/cpdf_font.h" 7 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
8 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" 8 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h"
9 #include "core/fpdfdoc/include/cpvt_word.h" 9 #include "core/fpdfdoc/include/cpvt_word.h"
10 #include "core/fpdfdoc/include/ipvt_fontmap.h" 10 #include "core/fpdfdoc/include/ipvt_fontmap.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 FX_FLOAT fFontSize) { 49 FX_FLOAT fFontSize) {
50 CFX_ByteTextBuf sRet; 50 CFX_ByteTextBuf sRet;
51 51
52 if (pFontMap) { 52 if (pFontMap) {
53 CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex); 53 CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex);
54 54
55 if (sFontAlias.GetLength() > 0 && fFontSize > 0) 55 if (sFontAlias.GetLength() > 0 && fFontSize > 0)
56 sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n"; 56 sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n";
57 } 57 }
58 58
59 return sRet.GetByteString(); 59 return sRet.AsStringC();
60 } 60 }
61 61
62 CFX_ByteString IFX_Edit::GetEditAppearanceStream( 62 CFX_ByteString IFX_Edit::GetEditAppearanceStream(
63 IFX_Edit* pEdit, 63 IFX_Edit* pEdit,
64 const CFX_FloatPoint& ptOffset, 64 const CFX_FloatPoint& ptOffset,
65 const CPVT_WordRange* pRange /* = NULL*/, 65 const CPVT_WordRange* pRange /* = NULL*/,
66 FX_BOOL bContinuous /* = TRUE*/, 66 FX_BOOL bContinuous /* = TRUE*/,
67 uint16_t SubWord /* = 0*/) { 67 uint16_t SubWord /* = 0*/) {
68 CFX_ByteTextBuf sEditStream, sWords; 68 CFX_ByteTextBuf sEditStream, sWords;
69 69
(...skipping 10 matching lines...) Expand all
80 80
81 while (pIterator->NextWord()) { 81 while (pIterator->NextWord()) {
82 CPVT_WordPlace place = pIterator->GetAt(); 82 CPVT_WordPlace place = pIterator->GetAt();
83 83
84 if (pRange && place.WordCmp(pRange->EndPos) > 0) 84 if (pRange && place.WordCmp(pRange->EndPos) > 0)
85 break; 85 break;
86 86
87 if (bContinuous) { 87 if (bContinuous) {
88 if (place.LineCmp(oldplace) != 0) { 88 if (place.LineCmp(oldplace) != 0) {
89 if (sWords.GetSize() > 0) { 89 if (sWords.GetSize() > 0) {
90 sEditStream << GetWordRenderString(sWords.GetByteString()); 90 sEditStream << GetWordRenderString(sWords.AsStringC());
91 sWords.Clear(); 91 sWords.Clear();
92 } 92 }
93 93
94 CPVT_Word word; 94 CPVT_Word word;
95 if (pIterator->GetWord(word)) { 95 if (pIterator->GetWord(word)) {
96 ptNew = CFX_FloatPoint(word.ptWord.x + ptOffset.x, 96 ptNew = CFX_FloatPoint(word.ptWord.x + ptOffset.x,
97 word.ptWord.y + ptOffset.y); 97 word.ptWord.y + ptOffset.y);
98 } else { 98 } else {
99 CPVT_Line line; 99 CPVT_Line line;
100 pIterator->GetLine(line); 100 pIterator->GetLine(line);
101 ptNew = CFX_FloatPoint(line.ptLine.x + ptOffset.x, 101 ptNew = CFX_FloatPoint(line.ptLine.x + ptOffset.x,
102 line.ptLine.y + ptOffset.y); 102 line.ptLine.y + ptOffset.y);
103 } 103 }
104 104
105 if (ptNew.x != ptOld.x || ptNew.y != ptOld.y) { 105 if (ptNew.x != ptOld.x || ptNew.y != ptOld.y) {
106 sEditStream << ptNew.x - ptOld.x << " " << ptNew.y - ptOld.y 106 sEditStream << ptNew.x - ptOld.x << " " << ptNew.y - ptOld.y
107 << " Td\n"; 107 << " Td\n";
108 108
109 ptOld = ptNew; 109 ptOld = ptNew;
110 } 110 }
111 } 111 }
112 112
113 CPVT_Word word; 113 CPVT_Word word;
114 if (pIterator->GetWord(word)) { 114 if (pIterator->GetWord(word)) {
115 if (word.nFontIndex != nCurFontIndex) { 115 if (word.nFontIndex != nCurFontIndex) {
116 if (sWords.GetSize() > 0) { 116 if (sWords.GetSize() > 0) {
117 sEditStream << GetWordRenderString(sWords.GetByteString()); 117 sEditStream << GetWordRenderString(sWords.AsStringC());
118 sWords.Clear(); 118 sWords.Clear();
119 } 119 }
120 sEditStream << GetFontSetString(pEdit->GetFontMap(), 120 sEditStream << GetFontSetString(pEdit->GetFontMap(),
121 word.nFontIndex, word.fFontSize); 121 word.nFontIndex, word.fFontSize);
122 nCurFontIndex = word.nFontIndex; 122 nCurFontIndex = word.nFontIndex;
123 } 123 }
124 124
125 sWords << GetPDFWordString(pEdit->GetFontMap(), nCurFontIndex, 125 sWords << GetPDFWordString(pEdit->GetFontMap(), nCurFontIndex,
126 word.Word, SubWord); 126 word.Word, SubWord);
127 } 127 }
(...skipping 17 matching lines...) Expand all
145 nCurFontIndex = word.nFontIndex; 145 nCurFontIndex = word.nFontIndex;
146 } 146 }
147 147
148 sEditStream << GetWordRenderString(GetPDFWordString( 148 sEditStream << GetWordRenderString(GetPDFWordString(
149 pEdit->GetFontMap(), nCurFontIndex, word.Word, SubWord)); 149 pEdit->GetFontMap(), nCurFontIndex, word.Word, SubWord));
150 } 150 }
151 } 151 }
152 } 152 }
153 153
154 if (sWords.GetSize() > 0) { 154 if (sWords.GetSize() > 0) {
155 sEditStream << GetWordRenderString(sWords.GetByteString()); 155 sEditStream << GetWordRenderString(sWords.AsStringC());
156 sWords.Clear(); 156 sWords.Clear();
157 } 157 }
158 } 158 }
159 159
160 CFX_ByteTextBuf sAppStream; 160 CFX_ByteTextBuf sAppStream;
161 if (sEditStream.GetSize() > 0) { 161 if (sEditStream.GetSize() > 0) {
162 int32_t nHorzScale = pEdit->GetHorzScale(); 162 int32_t nHorzScale = pEdit->GetHorzScale();
163 if (nHorzScale != 100) { 163 if (nHorzScale != 100) {
164 sAppStream << nHorzScale << " Tz\n"; 164 sAppStream << nHorzScale << " Tz\n";
165 } 165 }
166 166
167 FX_FLOAT fCharSpace = pEdit->GetCharSpace(); 167 FX_FLOAT fCharSpace = pEdit->GetCharSpace();
168 if (!FX_EDIT_IsFloatZero(fCharSpace)) { 168 if (!FX_EDIT_IsFloatZero(fCharSpace)) {
169 sAppStream << fCharSpace << " Tc\n"; 169 sAppStream << fCharSpace << " Tc\n";
170 } 170 }
171 171
172 sAppStream << sEditStream; 172 sAppStream << sEditStream;
173 } 173 }
174 174
175 return sAppStream.GetByteString(); 175 return sAppStream.AsStringC();
176 } 176 }
177 177
178 CFX_ByteString IFX_Edit::GetSelectAppearanceStream( 178 CFX_ByteString IFX_Edit::GetSelectAppearanceStream(
179 IFX_Edit* pEdit, 179 IFX_Edit* pEdit,
180 const CFX_FloatPoint& ptOffset, 180 const CFX_FloatPoint& ptOffset,
181 const CPVT_WordRange* pRange) { 181 const CPVT_WordRange* pRange) {
182 CFX_ByteTextBuf sRet; 182 CFX_ByteTextBuf sRet;
183 183
184 if (pRange && pRange->IsExist()) { 184 if (pRange && pRange->IsExist()) {
185 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { 185 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) {
186 pIterator->SetAt(pRange->BeginPos); 186 pIterator->SetAt(pRange->BeginPos);
187 187
188 while (pIterator->NextWord()) { 188 while (pIterator->NextWord()) {
189 CPVT_WordPlace place = pIterator->GetAt(); 189 CPVT_WordPlace place = pIterator->GetAt();
190 190
191 if (pRange && place.WordCmp(pRange->EndPos) > 0) 191 if (pRange && place.WordCmp(pRange->EndPos) > 0)
192 break; 192 break;
193 193
194 CPVT_Word word; 194 CPVT_Word word;
195 CPVT_Line line; 195 CPVT_Line line;
196 if (pIterator->GetWord(word) && pIterator->GetLine(line)) { 196 if (pIterator->GetWord(word) && pIterator->GetLine(line)) {
197 sRet << word.ptWord.x + ptOffset.x << " " 197 sRet << word.ptWord.x + ptOffset.x << " "
198 << line.ptLine.y + line.fLineDescent << " " << word.fWidth << " " 198 << line.ptLine.y + line.fLineDescent << " " << word.fWidth << " "
199 << line.fLineAscent - line.fLineDescent << " re\nf\n"; 199 << line.fLineAscent - line.fLineDescent << " re\nf\n";
200 } 200 }
201 } 201 }
202 } 202 }
203 } 203 }
204 204
205 return sRet.GetByteString(); 205 return sRet.AsStringC();
206 } 206 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698