Chromium Code Reviews| Index: xfa/fde/fde_gedevice.cpp |
| diff --git a/xfa/fde/fde_gedevice.cpp b/xfa/fde/fde_gedevice.cpp |
| index e78ab8da4ca5a675468204cea96b35fd653bcce1..56f845c35bd23f0d0668bc7813dde0708e03b9a3 100644 |
| --- a/xfa/fde/fde_gedevice.cpp |
| +++ b/xfa/fde/fde_gedevice.cpp |
| @@ -134,12 +134,12 @@ FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, |
| #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
| uint32_t dwFontStyle = pFont->GetFontStyles(); |
| CFX_Font FxFont; |
| - CFX_SubstFont SubstFxFont; |
| - FxFont.SetSubstFont(&SubstFxFont); |
| - SubstFxFont.m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400; |
| - SubstFxFont.m_ItalicAngle = dwFontStyle & FX_FONTSTYLE_Italic ? -12 : 0; |
| - SubstFxFont.m_WeightCJK = SubstFxFont.m_Weight; |
| - SubstFxFont.m_bItalicCJK = !!(dwFontStyle & FX_FONTSTYLE_Italic); |
| + CFX_SubstFont* SubstFxFont = new CFX_SubstFont(); |
| + FxFont.SetSubstFont(std::unique_ptr<CFX_SubstFont>(SubstFxFont)); |
| + SubstFxFont->m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400; |
| + SubstFxFont->m_ItalicAngle = dwFontStyle & FX_FONTSTYLE_Italic ? -12 : 0; |
| + SubstFxFont->m_WeightCJK = SubstFxFont->m_Weight; |
| + SubstFxFont->m_bItalicCJK = !!(dwFontStyle & FX_FONTSTYLE_Italic); |
| #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
| for (int32_t i = 0; i < iCount; ++i) { |
| @@ -175,7 +175,6 @@ FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, |
| FX_BOOL bRet = m_pDevice->DrawNormalText( |
| iCurCount, pCurCP, &FxFont, pCache, -fFontSize, |
| (const CFX_Matrix*)pMatrix, argb, FXTEXT_CLEARTYPE); |
| - FxFont.SetSubstFont(nullptr); |
|
dsinclair
2016/07/21 19:39:59
Isn't this still needed to clear the FxFont substi
Wei Li
2016/07/21 21:15:03
Substitution font in FxFont is stored as a unique_
|
| FxFont.SetFace(nullptr); |
| return bRet; |
| #else |
| @@ -186,7 +185,6 @@ FX_BOOL CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, |
| } |
| #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
| - FxFont.SetSubstFont(nullptr); |
|
dsinclair
2016/07/21 19:39:59
ditto
Wei Li
2016/07/21 21:15:03
same here.
|
| FxFont.SetFace(nullptr); |
| #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |