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 "xfa/fee/fde_txtedtpage.h" | 7 #include "xfa/fee/fde_txtedtpage.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 if (nLength < 1) { | 74 if (nLength < 1) { |
75 return 0; | 75 return 0; |
76 } | 76 } |
77 CFDE_TxtEdtEngine* pEngine = (CFDE_TxtEdtEngine*)(m_pPage->GetEngine()); | 77 CFDE_TxtEdtEngine* pEngine = (CFDE_TxtEdtEngine*)(m_pPage->GetEngine()); |
78 const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams(); | 78 const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams(); |
79 CFX_TxtBreak* pBreak = pEngine->GetTextBreak(); | 79 CFX_TxtBreak* pBreak = pEngine->GetTextBreak(); |
80 uint32_t dwLayoutStyle = pBreak->GetLayoutStyles(); | 80 uint32_t dwLayoutStyle = pBreak->GetLayoutStyles(); |
81 FX_TXTRUN tr; | 81 FX_TXTRUN tr; |
82 tr.pAccess = m_pPage; | 82 tr.pAccess = m_pPage; |
83 tr.pIdentity = (void*)hText; | 83 tr.pIdentity = (void*)hText; |
84 tr.pStr = NULL; | |
85 tr.pWidths = NULL; | |
86 tr.iLength = nLength; | 84 tr.iLength = nLength; |
87 tr.pFont = pTextParams->pFont; | 85 tr.pFont = pTextParams->pFont; |
88 tr.fFontSize = pTextParams->fFontSize; | 86 tr.fFontSize = pTextParams->fFontSize; |
89 tr.dwStyles = dwLayoutStyle; | 87 tr.dwStyles = dwLayoutStyle; |
90 tr.iCharRotation = pTextParams->nCharRotation; | 88 tr.iCharRotation = pTextParams->nCharRotation; |
91 tr.dwCharStyles = pPiece->dwCharStyles; | 89 tr.dwCharStyles = pPiece->dwCharStyles; |
92 tr.pRect = &(pPiece->rtPiece); | 90 tr.pRect = &(pPiece->rtPiece); |
93 tr.wLineBreakChar = pTextParams->wLineBreakChar; | 91 tr.wLineBreakChar = pTextParams->wLineBreakChar; |
94 return pBreak->GetDisplayPos(&tr, pCharPos, bCharCode, pWSForms); | 92 return pBreak->GetDisplayPos(&tr, pCharPos, bCharCode, pWSForms); |
95 } | 93 } |
(...skipping 11 matching lines...) Expand all Loading... |
107 CFDE_TxtEdtEngine* pEngine = (CFDE_TxtEdtEngine*)(m_pPage->GetEngine()); | 105 CFDE_TxtEdtEngine* pEngine = (CFDE_TxtEdtEngine*)(m_pPage->GetEngine()); |
108 int32_t nLength = pPiece->nCount; | 106 int32_t nLength = pPiece->nCount; |
109 if (nLength < 1) { | 107 if (nLength < 1) { |
110 return 0; | 108 return 0; |
111 } | 109 } |
112 const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams(); | 110 const FDE_TXTEDTPARAMS* pTextParams = pEngine->GetEditParams(); |
113 uint32_t dwLayoutStyle = pEngine->GetTextBreak()->GetLayoutStyles(); | 111 uint32_t dwLayoutStyle = pEngine->GetTextBreak()->GetLayoutStyles(); |
114 FX_TXTRUN tr; | 112 FX_TXTRUN tr; |
115 tr.pAccess = m_pPage; | 113 tr.pAccess = m_pPage; |
116 tr.pIdentity = (void*)hText; | 114 tr.pIdentity = (void*)hText; |
117 tr.pStr = NULL; | |
118 tr.pWidths = NULL; | |
119 tr.iLength = nLength; | 115 tr.iLength = nLength; |
120 tr.pFont = pTextParams->pFont; | 116 tr.pFont = pTextParams->pFont; |
121 tr.fFontSize = pTextParams->fFontSize; | 117 tr.fFontSize = pTextParams->fFontSize; |
122 tr.dwStyles = dwLayoutStyle; | 118 tr.dwStyles = dwLayoutStyle; |
123 tr.iCharRotation = pTextParams->nCharRotation; | 119 tr.iCharRotation = pTextParams->nCharRotation; |
124 tr.dwCharStyles = pPiece->dwCharStyles; | 120 tr.dwCharStyles = pPiece->dwCharStyles; |
125 tr.pRect = &(pPiece->rtPiece); | 121 tr.pRect = &(pPiece->rtPiece); |
126 tr.wLineBreakChar = pTextParams->wLineBreakChar; | 122 tr.wLineBreakChar = pTextParams->wLineBreakChar; |
127 return pEngine->GetTextBreak()->GetCharRects(&tr, rtArray, bBBox); | 123 return pEngine->GetTextBreak()->GetCharRects(&tr, rtArray, bBBox); |
128 } | 124 } |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 ptF.x = rtF.left; | 637 ptF.x = rtF.left; |
642 } else if (ptF.x >= rtF.right()) { | 638 } else if (ptF.x >= rtF.right()) { |
643 ptF.x = rtF.right() - fTolerance; | 639 ptF.x = rtF.right() - fTolerance; |
644 } | 640 } |
645 if (ptF.y < rtF.top) { | 641 if (ptF.y < rtF.top) { |
646 ptF.y = rtF.top; | 642 ptF.y = rtF.top; |
647 } else if (ptF.y >= rtF.bottom()) { | 643 } else if (ptF.y >= rtF.bottom()) { |
648 ptF.y = rtF.bottom() - fTolerance; | 644 ptF.y = rtF.bottom() - fTolerance; |
649 } | 645 } |
650 } | 646 } |
OLD | NEW |