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 "../../../include/fpdfapi/fpdf_page.h" | 7 #include "../../../include/fpdfapi/fpdf_page.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "../../../include/fpdfapi/fpdf_serial.h" | 9 #include "../../../include/fpdfapi/fpdf_serial.h" |
10 #include "pageint.h" | 10 #include "pageint.h" |
(...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1341 if (pObj->GetType() == PDFOBJ_STRING) { | 1341 if (pObj->GetType() == PDFOBJ_STRING) { |
1342 nsegs ++; | 1342 nsegs ++; |
1343 } | 1343 } |
1344 } | 1344 } |
1345 if (nsegs == 0) { | 1345 if (nsegs == 0) { |
1346 for (i = 0; i < n; i ++) { | 1346 for (i = 0; i < n; i ++) { |
1347 m_pCurStates->m_TextX -= FXSYS_Mul(pArray->GetNumber(i), m_pCurState
s->m_TextState.GetFontSize()) / 1000; | 1347 m_pCurStates->m_TextX -= FXSYS_Mul(pArray->GetNumber(i), m_pCurState
s->m_TextState.GetFontSize()) / 1000; |
1348 }; | 1348 }; |
1349 return; | 1349 return; |
1350 } | 1350 } |
1351 CFX_ByteString* pStrs; | 1351 CFX_ByteString* pStrs = new CFX_ByteString[nsegs]; |
1352 FX_NEW_VECTOR(pStrs, CFX_ByteString, nsegs); | |
1353 FX_FLOAT* pKerning = FX_Alloc(FX_FLOAT, nsegs); | 1352 FX_FLOAT* pKerning = FX_Alloc(FX_FLOAT, nsegs); |
1354 int iSegment = 0; | 1353 int iSegment = 0; |
1355 FX_FLOAT fInitKerning = 0; | 1354 FX_FLOAT fInitKerning = 0; |
1356 for (i = 0; i < n; i ++) { | 1355 for (i = 0; i < n; i ++) { |
1357 CPDF_Object* pObj = pArray->GetElementValue(i); | 1356 CPDF_Object* pObj = pArray->GetElementValue(i); |
1358 if (pObj->GetType() == PDFOBJ_STRING) { | 1357 if (pObj->GetType() == PDFOBJ_STRING) { |
1359 CFX_ByteString str = pObj->GetString(); | 1358 CFX_ByteString str = pObj->GetString(); |
1360 if (str.IsEmpty()) { | 1359 if (str.IsEmpty()) { |
1361 continue; | 1360 continue; |
1362 } | 1361 } |
1363 pStrs[iSegment] = str; | 1362 pStrs[iSegment] = str; |
1364 pKerning[iSegment ++] = 0; | 1363 pKerning[iSegment ++] = 0; |
1365 } else { | 1364 } else { |
1366 FX_FLOAT num = pObj ? pObj->GetNumber() : 0; | 1365 FX_FLOAT num = pObj ? pObj->GetNumber() : 0; |
1367 if (iSegment == 0) { | 1366 if (iSegment == 0) { |
1368 fInitKerning += num; | 1367 fInitKerning += num; |
1369 } else { | 1368 } else { |
1370 pKerning[iSegment - 1] += num; | 1369 pKerning[iSegment - 1] += num; |
1371 } | 1370 } |
1372 } | 1371 } |
1373 } | 1372 } |
1374 AddTextObject(pStrs, fInitKerning, pKerning, iSegment); | 1373 AddTextObject(pStrs, fInitKerning, pKerning, iSegment); |
1375 FX_DELETE_VECTOR(pStrs, CFX_ByteString, nsegs); | 1374 delete[] pStrs; |
1376 FX_Free(pKerning); | 1375 FX_Free(pKerning); |
1377 } | 1376 } |
1378 void CPDF_StreamContentParser::Handle_SetTextLeading() | 1377 void CPDF_StreamContentParser::Handle_SetTextLeading() |
1379 { | 1378 { |
1380 m_pCurStates->m_TextLeading = GetNumber(0); | 1379 m_pCurStates->m_TextLeading = GetNumber(0); |
1381 } | 1380 } |
1382 void CPDF_StreamContentParser::Handle_SetTextMatrix() | 1381 void CPDF_StreamContentParser::Handle_SetTextMatrix() |
1383 { | 1382 { |
1384 m_pCurStates->m_TextMatrix.Set(GetNumber16(5), GetNumber16(4), GetNumber16(3
), | 1383 m_pCurStates->m_TextMatrix.Set(GetNumber16(5), GetNumber16(4), GetNumber16(3
), |
1385 GetNumber16(2), GetNumber(1), GetNumber(0)); | 1384 GetNumber16(2), GetNumber(1), GetNumber(0)); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 buf.AppendChar((char)code); | 1578 buf.AppendChar((char)code); |
1580 } | 1579 } |
1581 bFirst = !bFirst; | 1580 bFirst = !bFirst; |
1582 } | 1581 } |
1583 } | 1582 } |
1584 if (!bFirst) { | 1583 if (!bFirst) { |
1585 buf.AppendChar((char)code); | 1584 buf.AppendChar((char)code); |
1586 } | 1585 } |
1587 return buf.GetByteString(); | 1586 return buf.GetByteString(); |
1588 } | 1587 } |
OLD | NEW |