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 "xfa/fde/cfde_txtedttextset.h" | 7 #include "xfa/fde/cfde_txtedttextset.h" |
8 | 8 |
9 #include "xfa/fde/cfde_txtedtengine.h" | 9 #include "xfa/fde/cfde_txtedtengine.h" |
10 #include "xfa/fde/cfde_txtedtpage.h" | 10 #include "xfa/fde/cfde_txtedtpage.h" |
| 11 #include "xfa/fgas/font/cfgas_gefont.h" |
11 | 12 |
12 CFDE_TxtEdtTextSet::CFDE_TxtEdtTextSet(CFDE_TxtEdtPage* pPage) | 13 CFDE_TxtEdtTextSet::CFDE_TxtEdtTextSet(CFDE_TxtEdtPage* pPage) |
13 : m_pPage(pPage) {} | 14 : m_pPage(pPage) {} |
14 | 15 |
15 CFDE_TxtEdtTextSet::~CFDE_TxtEdtTextSet() {} | 16 CFDE_TxtEdtTextSet::~CFDE_TxtEdtTextSet() {} |
16 | 17 |
17 FDE_VISUALOBJTYPE CFDE_TxtEdtTextSet::GetType() { | 18 FDE_VISUALOBJTYPE CFDE_TxtEdtTextSet::GetType() { |
18 return FDE_VISUALOBJ_Text; | 19 return FDE_VISUALOBJ_Text; |
19 } | 20 } |
20 | 21 |
21 void CFDE_TxtEdtTextSet::GetRect(FDE_TEXTEDITPIECE* pPiece, CFX_RectF& rt) { | 22 void CFDE_TxtEdtTextSet::GetRect(FDE_TEXTEDITPIECE* pPiece, CFX_RectF& rt) { |
22 rt = pPiece->rtPiece; | 23 rt = pPiece->rtPiece; |
23 } | 24 } |
24 | 25 |
25 int32_t CFDE_TxtEdtTextSet::GetString(FDE_TEXTEDITPIECE* pPiece, | 26 int32_t CFDE_TxtEdtTextSet::GetString(FDE_TEXTEDITPIECE* pPiece, |
26 CFX_WideString& wsText) { | 27 CFX_WideString& wsText) { |
27 FX_WCHAR* pBuffer = wsText.GetBuffer(pPiece->nCount); | 28 FX_WCHAR* pBuffer = wsText.GetBuffer(pPiece->nCount); |
28 for (int32_t i = 0; i < pPiece->nCount; i++) { | 29 for (int32_t i = 0; i < pPiece->nCount; i++) |
29 pBuffer[i] = m_pPage->GetChar(pPiece, i); | 30 pBuffer[i] = m_pPage->GetChar(pPiece, i); |
30 } | 31 |
31 wsText.ReleaseBuffer(pPiece->nCount); | 32 wsText.ReleaseBuffer(pPiece->nCount); |
32 return pPiece->nCount; | 33 return pPiece->nCount; |
33 } | 34 } |
34 | 35 |
35 CFGAS_GEFont* CFDE_TxtEdtTextSet::GetFont() { | 36 CFX_RetainPtr<CFGAS_GEFont> CFDE_TxtEdtTextSet::GetFont() { |
36 return m_pPage->GetEngine()->GetEditParams()->pFont; | 37 return m_pPage->GetEngine()->GetEditParams()->pFont; |
37 } | 38 } |
38 | 39 |
39 FX_FLOAT CFDE_TxtEdtTextSet::GetFontSize() { | 40 FX_FLOAT CFDE_TxtEdtTextSet::GetFontSize() { |
40 return m_pPage->GetEngine()->GetEditParams()->fFontSize; | 41 return m_pPage->GetEngine()->GetEditParams()->fFontSize; |
41 } | 42 } |
42 | 43 |
43 FX_ARGB CFDE_TxtEdtTextSet::GetFontColor() { | 44 FX_ARGB CFDE_TxtEdtTextSet::GetFontColor() { |
44 return m_pPage->GetEngine()->GetEditParams()->dwFontColor; | 45 return m_pPage->GetEngine()->GetEditParams()->dwFontColor; |
45 } | 46 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 tr.iLength = nLength; | 95 tr.iLength = nLength; |
95 tr.pFont = pTextParams->pFont; | 96 tr.pFont = pTextParams->pFont; |
96 tr.fFontSize = pTextParams->fFontSize; | 97 tr.fFontSize = pTextParams->fFontSize; |
97 tr.dwStyles = dwLayoutStyle; | 98 tr.dwStyles = dwLayoutStyle; |
98 tr.iCharRotation = pTextParams->nCharRotation; | 99 tr.iCharRotation = pTextParams->nCharRotation; |
99 tr.dwCharStyles = pPiece->dwCharStyles; | 100 tr.dwCharStyles = pPiece->dwCharStyles; |
100 tr.pRect = &(pPiece->rtPiece); | 101 tr.pRect = &(pPiece->rtPiece); |
101 tr.wLineBreakChar = pTextParams->wLineBreakChar; | 102 tr.wLineBreakChar = pTextParams->wLineBreakChar; |
102 return pEngine->GetTextBreak()->GetCharRects(&tr, rtArray, bBBox); | 103 return pEngine->GetTextBreak()->GetCharRects(&tr, rtArray, bBBox); |
103 } | 104 } |
OLD | NEW |