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

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

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 6 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
« no previous file with comments | « fpdfsdk/src/fsdk_mgr.cpp ('k') | fpdfsdk/src/fxedit/fxet_edit.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "../../include/fxedit/fxet_stub.h" 7 #include "../../include/fxedit/fxet_stub.h"
8 #include "../../include/fxedit/fx_edit.h" 8 #include "../../include/fxedit/fx_edit.h"
9 #include "../../include/fxedit/fxet_edit.h" 9 #include "../../include/fxedit/fxet_edit.h"
10 10
11 CFX_ByteString GetPDFWordString(IFX_Edit_FontMap * pFontMap, FX_INT32 nFontIndex , FX_WORD Word, FX_WORD SubWord) 11 CFX_ByteString GetPDFWordString(IFX_Edit_FontMap * pFontMap, int32_t nFontIndex, FX_WORD Word, FX_WORD SubWord)
12 { 12 {
13 ASSERT (pFontMap != NULL); 13 ASSERT (pFontMap != NULL);
14 14
15 CFX_ByteString sWord; 15 CFX_ByteString sWord;
16 16
17 if (CPDF_Font * pPDFFont = pFontMap->GetPDFFont(nFontIndex)) 17 if (CPDF_Font * pPDFFont = pFontMap->GetPDFFont(nFontIndex))
18 { 18 {
19 if (SubWord > 0) 19 if (SubWord > 0)
20 { 20 {
21 Word = SubWord; 21 Word = SubWord;
(...skipping 21 matching lines...) Expand all
43 } 43 }
44 44
45 static CFX_ByteString GetWordRenderString(const CFX_ByteString & strWords) 45 static CFX_ByteString GetWordRenderString(const CFX_ByteString & strWords)
46 { 46 {
47 if (strWords.GetLength() > 0) 47 if (strWords.GetLength() > 0)
48 return PDF_EncodeString(strWords) + " Tj\n"; 48 return PDF_EncodeString(strWords) + " Tj\n";
49 49
50 return ""; 50 return "";
51 } 51 }
52 52
53 static CFX_ByteString GetFontSetString(IFX_Edit_FontMap * pFontMap, FX_INT32 nFo ntIndex, FX_FLOAT fFontSize) 53 static CFX_ByteString GetFontSetString(IFX_Edit_FontMap * pFontMap, int32_t nFon tIndex, FX_FLOAT fFontSize)
54 { 54 {
55 CFX_ByteTextBuf sRet; 55 CFX_ByteTextBuf sRet;
56 56
57 if (pFontMap) 57 if (pFontMap)
58 { 58 {
59 CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex ); 59 CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex );
60 60
61 if (sFontAlias.GetLength() > 0 && fFontSize > 0 ) 61 if (sFontAlias.GetLength() > 0 && fFontSize > 0 )
62 sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n" ; 62 sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n" ;
63 } 63 }
64 64
65 return sRet.GetByteString(); 65 return sRet.GetByteString();
66 } 66 }
67 67
68 CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Poi nt & ptOffset, 68 CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit, const CPDF_Poi nt & ptOffset,
69 const CPVT_WordRange * pRange /* = NULL*/, FX_BOOL bContinuous/ * = TRUE*/, FX_WORD SubWord/* = 0*/) 69 const CPVT_WordRange * pRange /* = NULL*/, FX_BOOL bContinuous/ * = TRUE*/, FX_WORD SubWord/* = 0*/)
70 { 70 {
71 CFX_ByteTextBuf sEditStream, sWords; 71 CFX_ByteTextBuf sEditStream, sWords;
72 72
73 CPDF_Point ptOld(0.0f,0.0f),ptNew(0.0f,0.0f); 73 CPDF_Point ptOld(0.0f,0.0f),ptNew(0.0f,0.0f);
74 » FX_INT32 nCurFontIndex = -1; 74 » int32_t nCurFontIndex = -1;
75 75
76 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) 76 if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator())
77 { 77 {
78 if (pRange) 78 if (pRange)
79 pIterator->SetAt(pRange->BeginPos); 79 pIterator->SetAt(pRange->BeginPos);
80 else 80 else
81 pIterator->SetAt(0); 81 pIterator->SetAt(0);
82 82
83 CPVT_WordPlace oldplace; 83 CPVT_WordPlace oldplace;
84 84
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 if (sWords.GetSize() > 0) 164 if (sWords.GetSize() > 0)
165 { 165 {
166 sEditStream << GetWordRenderString(sWords.GetByteString( )); 166 sEditStream << GetWordRenderString(sWords.GetByteString( ));
167 sWords.Clear(); 167 sWords.Clear();
168 } 168 }
169 } 169 }
170 170
171 CFX_ByteTextBuf sAppStream; 171 CFX_ByteTextBuf sAppStream;
172 if (sEditStream.GetSize() > 0) 172 if (sEditStream.GetSize() > 0)
173 { 173 {
174 » » FX_INT32 nHorzScale = pEdit->GetHorzScale(); 174 » » int32_t nHorzScale = pEdit->GetHorzScale();
175 if (nHorzScale != 100) 175 if (nHorzScale != 100)
176 { 176 {
177 sAppStream << nHorzScale << " Tz\n"; 177 sAppStream << nHorzScale << " Tz\n";
178 } 178 }
179 179
180 FX_FLOAT fCharSpace = pEdit->GetCharSpace(); 180 FX_FLOAT fCharSpace = pEdit->GetCharSpace();
181 if (!FX_EDIT_IsFloatZero(fCharSpace)) 181 if (!FX_EDIT_IsFloatZero(fCharSpace))
182 { 182 {
183 sAppStream << fCharSpace << " Tc\n"; 183 sAppStream << fCharSpace << " Tc\n";
184 } 184 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 sRet << word.ptWord.x + ptOffset.x << " " << line.ptLine.y + line.fLineDescent 216 sRet << word.ptWord.x + ptOffset.x << " " << line.ptLine.y + line.fLineDescent
217 << " " << word.fWidth << " " << line.fLineAscent - line.fLineDescent << " re\nf\n"; 217 << " " << word.fWidth << " " << line.fLineAscent - line.fLineDescent << " re\nf\n";
218 } 218 }
219 } 219 }
220 } 220 }
221 } 221 }
222 222
223 return sRet.GetByteString(); 223 return sRet.GetByteString();
224 } 224 }
225 225
OLDNEW
« no previous file with comments | « fpdfsdk/src/fsdk_mgr.cpp ('k') | fpdfsdk/src/fxedit/fxet_edit.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698