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 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 127 } |
128 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; | 128 FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; |
129 CFGAS_GEFont* pCurFont = nullptr; | 129 CFGAS_GEFont* pCurFont = nullptr; |
130 CFGAS_GEFont* pSTFont = nullptr; | 130 CFGAS_GEFont* pSTFont = nullptr; |
131 FXTEXT_CHARPOS* pCurCP = nullptr; | 131 FXTEXT_CHARPOS* pCurCP = nullptr; |
132 int32_t iCurCount = 0; | 132 int32_t iCurCount = 0; |
133 | 133 |
134 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 134 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
135 uint32_t dwFontStyle = pFont->GetFontStyles(); | 135 uint32_t dwFontStyle = pFont->GetFontStyles(); |
136 CFX_Font FxFont; | 136 CFX_Font FxFont; |
137 CFX_SubstFont SubstFxFont; | 137 CFX_SubstFont* SubstFxFont = new CFX_SubstFont(); |
138 FxFont.SetSubstFont(&SubstFxFont); | 138 FxFont.SetSubstFont(std::unique_ptr<CFX_SubstFont>(SubstFxFont)); |
139 SubstFxFont.m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400; | 139 SubstFxFont->m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400; |
140 SubstFxFont.m_ItalicAngle = dwFontStyle & FX_FONTSTYLE_Italic ? -12 : 0; | 140 SubstFxFont->m_ItalicAngle = dwFontStyle & FX_FONTSTYLE_Italic ? -12 : 0; |
141 SubstFxFont.m_WeightCJK = SubstFxFont.m_Weight; | 141 SubstFxFont->m_WeightCJK = SubstFxFont->m_Weight; |
142 SubstFxFont.m_bItalicCJK = !!(dwFontStyle & FX_FONTSTYLE_Italic); | 142 SubstFxFont->m_bItalicCJK = !!(dwFontStyle & FX_FONTSTYLE_Italic); |
143 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 143 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
144 | 144 |
145 for (int32_t i = 0; i < iCount; ++i) { | 145 for (int32_t i = 0; i < iCount; ++i) { |
146 pSTFont = pFont->GetSubstFont((int32_t)pCP->m_GlyphIndex); | 146 pSTFont = pFont->GetSubstFont((int32_t)pCP->m_GlyphIndex); |
147 pCP->m_GlyphIndex &= 0x00FFFFFF; | 147 pCP->m_GlyphIndex &= 0x00FFFFFF; |
148 pCP->m_bFontStyle = false; | 148 pCP->m_bFontStyle = false; |
149 if (pCurFont != pSTFont) { | 149 if (pCurFont != pSTFont) { |
150 if (pCurFont) { | 150 if (pCurFont) { |
151 pFxFont = pCurFont->GetDevFont(); | 151 pFxFont = pCurFont->GetDevFont(); |
152 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 152 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
(...skipping 15 matching lines...) Expand all Loading... |
168 } | 168 } |
169 pCP++; | 169 pCP++; |
170 } | 170 } |
171 if (pCurFont && iCurCount) { | 171 if (pCurFont && iCurCount) { |
172 pFxFont = pCurFont->GetDevFont(); | 172 pFxFont = pCurFont->GetDevFont(); |
173 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 173 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
174 FxFont.SetFace(pFxFont->GetFace()); | 174 FxFont.SetFace(pFxFont->GetFace()); |
175 FX_BOOL bRet = m_pDevice->DrawNormalText( | 175 FX_BOOL bRet = m_pDevice->DrawNormalText( |
176 iCurCount, pCurCP, &FxFont, pCache, -fFontSize, | 176 iCurCount, pCurCP, &FxFont, pCache, -fFontSize, |
177 (const CFX_Matrix*)pMatrix, argb, FXTEXT_CLEARTYPE); | 177 (const CFX_Matrix*)pMatrix, argb, FXTEXT_CLEARTYPE); |
178 FxFont.SetSubstFont(nullptr); | |
179 FxFont.SetFace(nullptr); | 178 FxFont.SetFace(nullptr); |
180 return bRet; | 179 return bRet; |
181 #else | 180 #else |
182 return m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, pCache, | 181 return m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, pCache, |
183 -fFontSize, (const CFX_Matrix*)pMatrix, | 182 -fFontSize, (const CFX_Matrix*)pMatrix, |
184 argb, FXTEXT_CLEARTYPE); | 183 argb, FXTEXT_CLEARTYPE); |
185 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 184 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
186 } | 185 } |
187 | 186 |
188 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 187 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
189 FxFont.SetSubstFont(nullptr); | |
190 FxFont.SetFace(nullptr); | 188 FxFont.SetFace(nullptr); |
191 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 189 #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
192 | 190 |
193 return TRUE; | 191 return TRUE; |
194 } | 192 } |
195 | 193 |
196 FX_BOOL CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen, | 194 FX_BOOL CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen, |
197 FX_FLOAT fPenWidth, | 195 FX_FLOAT fPenWidth, |
198 const CFX_PointF& pt1, | 196 const CFX_PointF& pt1, |
199 const CFX_PointF& pt2, | 197 const CFX_PointF& pt2, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 const CFX_Matrix* pMatrix) { | 321 const CFX_Matrix* pMatrix) { |
324 CFDE_Path* pGePath = (CFDE_Path*)pPath; | 322 CFDE_Path* pGePath = (CFDE_Path*)pPath; |
325 if (!pGePath) | 323 if (!pGePath) |
326 return FALSE; | 324 return FALSE; |
327 if (!pBrush) | 325 if (!pBrush) |
328 return FALSE; | 326 return FALSE; |
329 return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr, | 327 return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr, |
330 pBrush->GetColor(), 0, FXFILL_WINDING); | 328 pBrush->GetColor(), 0, FXFILL_WINDING); |
331 } | 329 } |
332 | 330 |
OLD | NEW |