| 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/ctypeset.h" | 7 #include "core/fpdfdoc/ctypeset.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 nStart = m_pVT->m_nCharArray - m_pSection->m_WordArray.GetSize(); | 207 nStart = m_pVT->m_nCharArray - m_pSection->m_WordArray.GetSize(); |
| 208 pLine->m_LineInfo.fLineX = | 208 pLine->m_LineInfo.fLineX = |
| 209 fNodeWidth * nStart - fNodeWidth * VARIABLETEXT_HALF; | 209 fNodeWidth * nStart - fNodeWidth * VARIABLETEXT_HALF; |
| 210 break; | 210 break; |
| 211 } | 211 } |
| 212 for (int32_t w = 0, sz = m_pSection->m_WordArray.GetSize(); w < sz; w++) { | 212 for (int32_t w = 0, sz = m_pSection->m_WordArray.GetSize(); w < sz; w++) { |
| 213 if (w >= m_pVT->m_nCharArray) { | 213 if (w >= m_pVT->m_nCharArray) { |
| 214 break; | 214 break; |
| 215 } | 215 } |
| 216 fNextWidth = 0; | 216 fNextWidth = 0; |
| 217 if (CPVT_WordInfo* pNextWord = | 217 if (CPVT_WordInfo* pNextWord = m_pSection->m_WordArray.GetAt(w + 1)) { |
| 218 (CPVT_WordInfo*)m_pSection->m_WordArray.GetAt(w + 1)) { | |
| 219 pNextWord->fWordTail = 0; | 218 pNextWord->fWordTail = 0; |
| 220 fNextWidth = m_pVT->GetWordWidth(*pNextWord); | 219 fNextWidth = m_pVT->GetWordWidth(*pNextWord); |
| 221 } | 220 } |
| 222 if (CPVT_WordInfo* pWord = | 221 if (CPVT_WordInfo* pWord = m_pSection->m_WordArray.GetAt(w)) { |
| 223 (CPVT_WordInfo*)m_pSection->m_WordArray.GetAt(w)) { | |
| 224 pWord->fWordTail = 0; | 222 pWord->fWordTail = 0; |
| 225 FX_FLOAT fWordWidth = m_pVT->GetWordWidth(*pWord); | 223 FX_FLOAT fWordWidth = m_pVT->GetWordWidth(*pWord); |
| 226 FX_FLOAT fWordAscent = m_pVT->GetWordAscent(*pWord); | 224 FX_FLOAT fWordAscent = m_pVT->GetWordAscent(*pWord); |
| 227 FX_FLOAT fWordDescent = m_pVT->GetWordDescent(*pWord); | 225 FX_FLOAT fWordDescent = m_pVT->GetWordDescent(*pWord); |
| 228 x = (FX_FLOAT)(fNodeWidth * (w + nStart + 0.5) - | 226 x = (FX_FLOAT)(fNodeWidth * (w + nStart + 0.5) - |
| 229 fWordWidth * VARIABLETEXT_HALF); | 227 fWordWidth * VARIABLETEXT_HALF); |
| 230 pWord->fWordX = x; | 228 pWord->fWordX = x; |
| 231 pWord->fWordY = y; | 229 pWord->fWordY = y; |
| 232 if (w == 0) { | 230 if (w == 0) { |
| 233 pLine->m_LineInfo.fLineX = x; | 231 pLine->m_LineInfo.fLineX = x; |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 } | 485 } |
| 488 fPosX += m_pVT->GetWordWidth(*pWord); | 486 fPosX += m_pVT->GetWordWidth(*pWord); |
| 489 } | 487 } |
| 490 } | 488 } |
| 491 fPosY -= pLine->m_LineInfo.fLineDescent; | 489 fPosY -= pLine->m_LineInfo.fLineDescent; |
| 492 } | 490 } |
| 493 } | 491 } |
| 494 } | 492 } |
| 495 m_rcRet = CPVT_FloatRect(fMinX, fMinY, fMaxX, fMaxY); | 493 m_rcRet = CPVT_FloatRect(fMinX, fMinY, fMaxX, fMaxY); |
| 496 } | 494 } |
| OLD | NEW |