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/fde/fde_gedevice.h" | 7 #include "xfa/fde/fde_gedevice.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
11 #include "core/fxge/include/cfx_fontcache.h" | |
12 #include "core/fxge/include/cfx_gemodule.h" | 11 #include "core/fxge/include/cfx_gemodule.h" |
13 #include "core/fxge/include/cfx_graphstatedata.h" | 12 #include "core/fxge/include/cfx_graphstatedata.h" |
14 #include "core/fxge/include/cfx_renderdevice.h" | 13 #include "core/fxge/include/cfx_renderdevice.h" |
15 #include "core/fxge/include/cfx_substfont.h" | 14 #include "core/fxge/include/cfx_substfont.h" |
16 #include "xfa/fde/cfde_path.h" | 15 #include "xfa/fde/cfde_path.h" |
17 #include "xfa/fde/fde_object.h" | 16 #include "xfa/fde/fde_object.h" |
18 #include "xfa/fgas/font/fgas_font.h" | 17 #include "xfa/fgas/font/fgas_font.h" |
19 #include "xfa/fgas/font/fgas_gefont.h" | 18 #include "xfa/fgas/font/fgas_gefont.h" |
20 | 19 |
21 CFDE_RenderDevice::CFDE_RenderDevice(CFX_RenderDevice* pDevice, | 20 CFDE_RenderDevice::CFDE_RenderDevice(CFX_RenderDevice* pDevice, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 m_pDevice->CancelDIBits(handle); | 105 m_pDevice->CancelDIBits(handle); |
107 return !!handle; | 106 return !!handle; |
108 } | 107 } |
109 FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, | 108 FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, |
110 CFGAS_GEFont* pFont, | 109 CFGAS_GEFont* pFont, |
111 const FXTEXT_CHARPOS* pCharPos, | 110 const FXTEXT_CHARPOS* pCharPos, |
112 int32_t iCount, | 111 int32_t iCount, |
113 FX_FLOAT fFontSize, | 112 FX_FLOAT fFontSize, |
114 const CFX_Matrix* pMatrix) { | 113 const CFX_Matrix* pMatrix) { |
115 ASSERT(pBrush && pFont && pCharPos && iCount > 0); | 114 ASSERT(pBrush && pFont && pCharPos && iCount > 0); |
116 CFX_FontCache* pCache = CFX_GEModule::Get()->GetFontCache(); | |
117 CFX_Font* pFxFont = pFont->GetDevFont(); | 115 CFX_Font* pFxFont = pFont->GetDevFont(); |
118 FX_ARGB argb = pBrush->GetColor(); | 116 FX_ARGB argb = pBrush->GetColor(); |
119 if ((pFont->GetFontStyles() & FX_FONTSTYLE_Italic) != 0 && | 117 if ((pFont->GetFontStyles() & FX_FONTSTYLE_Italic) != 0 && |
120 !pFxFont->IsItalic()) { | 118 !pFxFont->IsItalic()) { |
121 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; | 119 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; |
122 FX_FLOAT* pAM; | 120 FX_FLOAT* pAM; |
123 for (int32_t i = 0; i < iCount; ++i) { | 121 for (int32_t i = 0; i < iCount; ++i) { |
124 static const FX_FLOAT mc = 0.267949f; | 122 static const FX_FLOAT mc = 0.267949f; |
125 pAM = pCP->m_AdjustMatrix; | 123 pAM = pCP->m_AdjustMatrix; |
126 pAM[2] = mc * pAM[0] + pAM[2]; | 124 pAM[2] = mc * pAM[0] + pAM[2]; |
(...skipping 20 matching lines...) Expand all Loading... |
147 | 145 |
148 for (int32_t i = 0; i < iCount; ++i) { | 146 for (int32_t i = 0; i < iCount; ++i) { |
149 pSTFont = pFont->GetSubstFont((int32_t)pCP->m_GlyphIndex); | 147 pSTFont = pFont->GetSubstFont((int32_t)pCP->m_GlyphIndex); |
150 pCP->m_GlyphIndex &= 0x00FFFFFF; | 148 pCP->m_GlyphIndex &= 0x00FFFFFF; |
151 pCP->m_bFontStyle = false; | 149 pCP->m_bFontStyle = false; |
152 if (pCurFont != pSTFont) { | 150 if (pCurFont != pSTFont) { |
153 if (pCurFont) { | 151 if (pCurFont) { |
154 pFxFont = pCurFont->GetDevFont(); | 152 pFxFont = pCurFont->GetDevFont(); |
155 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 153 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
156 FxFont.SetFace(pFxFont->GetFace()); | 154 FxFont.SetFace(pFxFont->GetFace()); |
157 m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, pCache, | 155 m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize, |
158 -fFontSize, (const CFX_Matrix*)pMatrix, argb, | 156 (const CFX_Matrix*)pMatrix, argb, |
159 FXTEXT_CLEARTYPE); | 157 FXTEXT_CLEARTYPE); |
160 #else | 158 #else |
161 m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, pCache, | 159 m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize, |
162 -fFontSize, (const CFX_Matrix*)pMatrix, argb, | 160 (const CFX_Matrix*)pMatrix, argb, |
163 FXTEXT_CLEARTYPE); | 161 FXTEXT_CLEARTYPE); |
164 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 162 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
165 } | 163 } |
166 pCurFont = pSTFont; | 164 pCurFont = pSTFont; |
167 pCurCP = pCP; | 165 pCurCP = pCP; |
168 iCurCount = 1; | 166 iCurCount = 1; |
169 } else { | 167 } else { |
170 iCurCount++; | 168 iCurCount++; |
171 } | 169 } |
172 pCP++; | 170 pCP++; |
173 } | 171 } |
174 if (pCurFont && iCurCount) { | 172 if (pCurFont && iCurCount) { |
175 pFxFont = pCurFont->GetDevFont(); | 173 pFxFont = pCurFont->GetDevFont(); |
176 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 174 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
177 FxFont.SetFace(pFxFont->GetFace()); | 175 FxFont.SetFace(pFxFont->GetFace()); |
178 FX_BOOL bRet = m_pDevice->DrawNormalText( | 176 FX_BOOL bRet = m_pDevice->DrawNormalText( |
179 iCurCount, pCurCP, &FxFont, pCache, -fFontSize, | 177 iCurCount, pCurCP, &FxFont, -fFontSize, (const CFX_Matrix*)pMatrix, |
180 (const CFX_Matrix*)pMatrix, argb, FXTEXT_CLEARTYPE); | 178 argb, FXTEXT_CLEARTYPE); |
181 FxFont.SetFace(nullptr); | 179 FxFont.SetFace(nullptr); |
182 return bRet; | 180 return bRet; |
183 #else | 181 #else |
184 return m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, pCache, | 182 return m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize, |
185 -fFontSize, (const CFX_Matrix*)pMatrix, | 183 (const CFX_Matrix*)pMatrix, argb, |
186 argb, FXTEXT_CLEARTYPE); | 184 FXTEXT_CLEARTYPE); |
187 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 185 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
188 } | 186 } |
189 | 187 |
190 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 188 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
191 FxFont.SetFace(nullptr); | 189 FxFont.SetFace(nullptr); |
192 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 190 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
193 | 191 |
194 return TRUE; | 192 return TRUE; |
195 } | 193 } |
196 | 194 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 const CFX_Matrix* pMatrix) { | 322 const CFX_Matrix* pMatrix) { |
325 CFDE_Path* pGePath = (CFDE_Path*)pPath; | 323 CFDE_Path* pGePath = (CFDE_Path*)pPath; |
326 if (!pGePath) | 324 if (!pGePath) |
327 return FALSE; | 325 return FALSE; |
328 if (!pBrush) | 326 if (!pBrush) |
329 return FALSE; | 327 return FALSE; |
330 return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr, | 328 return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr, |
331 pBrush->GetColor(), 0, FXFILL_WINDING); | 329 pBrush->GetColor(), 0, FXFILL_WINDING); |
332 } | 330 } |
333 | 331 |
OLD | NEW |