diff options
author | thestig <thestig@chromium.org> | 2016-06-21 14:38:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-21 14:38:28 -0700 |
commit | 907a5223ea5abd09878de20cc74c59ebd0d6c3c8 (patch) | |
tree | 7dba8b090eda4f65da57d1979bdb02cedd273055 /fpdfsdk/cfx_systemhandler.cpp | |
parent | 56a8b1944d555ed65dda97164b702a9a657485ca (diff) | |
download | pdfium-907a5223ea5abd09878de20cc74c59ebd0d6c3c8.tar.xz |
Use FXFONT defines in place of integers.
Fix nits along the way.
Review-Url: https://codereview.chromium.org/2083943003
Diffstat (limited to 'fpdfsdk/cfx_systemhandler.cpp')
-rw-r--r-- | fpdfsdk/cfx_systemhandler.cpp | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp index c0fd140c9b..d6ec4f0cf0 100644 --- a/fpdfsdk/cfx_systemhandler.cpp +++ b/fpdfsdk/cfx_systemhandler.cpp @@ -6,6 +6,8 @@ #include "fpdfsdk/cfx_systemhandler.h" +#include <memory> + #include "core/fxge/include/fx_ge.h" #include "fpdfsdk/formfiller/cffl_formfiller.h" #include "fpdfsdk/include/fsdk_mgr.h" @@ -13,13 +15,13 @@ namespace { int CharSet2CP(int charset) { - if (charset == 128) + if (charset == FXFONT_SHIFTJIS_CHARSET) return 932; - if (charset == 134) + if (charset == FXFONT_GB2312_CHARSET) return 936; - if (charset == 129) + if (charset == FXFONT_HANGEUL_CHARSET) return 949; - if (charset == 136) + if (charset == FXFONT_CHINESEBIG5_CHARSET) return 950; return 0; } @@ -78,8 +80,7 @@ bool CFX_SystemHandler::IsSelectionImplemented() const { return false; } -bool CFX_SystemHandler::FindNativeTrueTypeFont(int32_t nCharset, - CFX_ByteString sFontFaceName) { +bool CFX_SystemHandler::FindNativeTrueTypeFont(CFX_ByteString sFontFaceName) { CFX_FontMgr* pFontMgr = CFX_GEModule::Get()->GetFontMgr(); if (!pFontMgr) return false; @@ -106,11 +107,9 @@ CPDF_Font* CFX_SystemHandler::AddNativeTrueTypeFontToPDF( if (!pDoc) return nullptr; - CFX_Font* pFXFont = new CFX_Font(); + std::unique_ptr<CFX_Font> pFXFont(new CFX_Font); pFXFont->LoadSubst(sFontFaceName, TRUE, 0, 0, 0, CharSet2CP(nCharset), FALSE); - CPDF_Font* pFont = pDoc->AddFont(pFXFont, nCharset, FALSE); - delete pFXFont; - return pFont; + return pDoc->AddFont(pFXFont.get(), nCharset, FALSE); } int32_t CFX_SystemHandler::SetTimer(int32_t uElapse, |