Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(751)

Unified Diff: fpdfsdk/cfx_systemhandler.cpp

Issue 2083943003: Use FXFONT defines in place of integers. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/cfx_systemhandler.h ('k') | fpdfsdk/formfiller/cba_fontmap.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/cfx_systemhandler.cpp
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp
index c0fd140c9b903da6810ee7576b9fe7b366a2a7f0..d6ec4f0cf0f9d3b1597cc55fb4648eb85147265e 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,
« no previous file with comments | « fpdfsdk/cfx_systemhandler.h ('k') | fpdfsdk/formfiller/cba_fontmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698