summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/fde_gedevice.cpp14
-rw-r--r--xfa/fgas/font/fgas_gefont.cpp2
2 files changed, 7 insertions, 9 deletions
diff --git a/xfa/fde/fde_gedevice.cpp b/xfa/fde/fde_gedevice.cpp
index e78ab8da4c..56f845c35b 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);
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);
FxFont.SetFace(nullptr);
#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_
diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp
index 576f482df2..48635cabf7 100644
--- a/xfa/fgas/font/fgas_gefont.cpp
+++ b/xfa/fgas/font/fgas_gefont.cpp
@@ -109,7 +109,7 @@ CFGAS_GEFont::CFGAS_GEFont(const CFGAS_GEFont& src, uint32_t dwFontStyles)
CFX_SubstFont* pSubst = m_pFont->GetSubstFont();
if (!pSubst) {
pSubst = new CFX_SubstFont;
- m_pFont->SetSubstFont(pSubst);
+ m_pFont->SetSubstFont(std::unique_ptr<CFX_SubstFont>(pSubst));
}
pSubst->m_Weight =
(dwFontStyles & FX_FONTSTYLE_Bold) ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL;