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 "fpdfsdk/fxedit/include/fxet_edit.h" | 7 #include "fpdfsdk/fxedit/include/fxet_edit.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjectHolder* pObjectHolder, | 155 CPDF_TextObject* AddTextObjToPageObjects(CPDF_PageObjectHolder* pObjectHolder, |
156 FX_COLORREF crText, | 156 FX_COLORREF crText, |
157 CPDF_Font* pFont, | 157 CPDF_Font* pFont, |
158 FX_FLOAT fFontSize, | 158 FX_FLOAT fFontSize, |
159 FX_FLOAT fCharSpace, | 159 FX_FLOAT fCharSpace, |
160 int32_t nHorzScale, | 160 int32_t nHorzScale, |
161 const CFX_FloatPoint& point, | 161 const CFX_FloatPoint& point, |
162 const CFX_ByteString& text) { | 162 const CFX_ByteString& text) { |
163 std::unique_ptr<CPDF_TextObject> pTxtObj(new CPDF_TextObject); | 163 std::unique_ptr<CPDF_TextObject> pTxtObj(new CPDF_TextObject); |
164 CPDF_TextStateData* pTextStateData = pTxtObj->m_TextState.GetPrivateCopy(); | 164 pTxtObj->m_TextState.SetFont(pFont); |
165 pTextStateData->m_pFont = pFont; | 165 pTxtObj->m_TextState.SetFontSize(fFontSize); |
166 pTextStateData->m_FontSize = fFontSize; | 166 pTxtObj->m_TextState.SetCharSpace(fCharSpace); |
167 pTextStateData->m_CharSpace = fCharSpace; | 167 pTxtObj->m_TextState.SetWordSpace(0); |
168 pTextStateData->m_WordSpace = 0; | 168 pTxtObj->m_TextState.SetTextMode(TextRenderingMode::MODE_FILL); |
169 pTextStateData->m_TextMode = TextRenderingMode::MODE_FILL; | 169 |
170 pTextStateData->m_Matrix[0] = nHorzScale / 100.0f; | 170 FX_FLOAT* matrix = pTxtObj->m_TextState.GetMutableMatrix(); |
171 pTextStateData->m_Matrix[1] = 0; | 171 matrix[0] = nHorzScale / 100.0f; |
172 pTextStateData->m_Matrix[2] = 0; | 172 matrix[1] = 0; |
173 pTextStateData->m_Matrix[3] = 1; | 173 matrix[2] = 0; |
| 174 matrix[3] = 1; |
174 | 175 |
175 FX_FLOAT rgb[3]; | 176 FX_FLOAT rgb[3]; |
176 rgb[0] = FXARGB_R(crText) / 255.0f; | 177 rgb[0] = FXARGB_R(crText) / 255.0f; |
177 rgb[1] = FXARGB_G(crText) / 255.0f; | 178 rgb[1] = FXARGB_G(crText) / 255.0f; |
178 rgb[2] = FXARGB_B(crText) / 255.0f; | 179 rgb[2] = FXARGB_B(crText) / 255.0f; |
179 pTxtObj->m_ColorState.SetFillColor( | 180 pTxtObj->m_ColorState.SetFillColor( |
180 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); | 181 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); |
181 pTxtObj->m_ColorState.SetStrokeColor( | 182 pTxtObj->m_ColorState.SetStrokeColor( |
182 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); | 183 CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB), rgb, 3); |
183 | 184 |
(...skipping 2871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3055 int32_t CFX_Edit_RectArray::GetSize() const { | 3056 int32_t CFX_Edit_RectArray::GetSize() const { |
3056 return m_Rects.GetSize(); | 3057 return m_Rects.GetSize(); |
3057 } | 3058 } |
3058 | 3059 |
3059 CFX_FloatRect* CFX_Edit_RectArray::GetAt(int32_t nIndex) const { | 3060 CFX_FloatRect* CFX_Edit_RectArray::GetAt(int32_t nIndex) const { |
3060 if (nIndex < 0 || nIndex >= m_Rects.GetSize()) | 3061 if (nIndex < 0 || nIndex >= m_Rects.GetSize()) |
3061 return nullptr; | 3062 return nullptr; |
3062 | 3063 |
3063 return m_Rects.GetAt(nIndex); | 3064 return m_Rects.GetAt(nIndex); |
3064 } | 3065 } |
OLD | NEW |