summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-04-19 12:46:53 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-04-19 17:08:38 +0000
commitf51a02a29e10fcc490ba28f44d43f50104f940ed (patch)
tree354215ff5deeea419ce5a88b369535b5e4468a62 /fpdfsdk
parent2a473dbecab2b47c513de9127a2cddf4c2800306 (diff)
downloadpdfium-f51a02a29e10fcc490ba28f44d43f50104f940ed.tar.xz
Cleanup codepage and charset definitions.
This Cl cleans up the unused defines in fx_codepage.h. The FXFONT_CHARSET_ defines are replaced with fx_codepage defines, this moves fx_codepage into core instead of xfa only. Static asserts are added to verify the public/ charsets match the fx_codepage charsets. Change-Id: Ie2f749e093de60a9a6743128a1fb087912e4cc96 Reviewed-on: https://pdfium-review.googlesource.com/4316 Commit-Queue: dsinclair <dsinclair@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/cfx_systemhandler.cpp19
-rw-r--r--fpdfsdk/formfiller/cba_fontmap.cpp10
-rw-r--r--fpdfsdk/formfiller/cffl_combobox.cpp2
-rw-r--r--fpdfsdk/formfiller/cffl_textfield.cpp2
-rw-r--r--fpdfsdk/fpdf_sysfontinfo.cpp14
-rw-r--r--fpdfsdk/fxedit/fxet_edit.cpp5
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.cpp6
-rw-r--r--fpdfsdk/pdfwindow/PWL_EditCtrl.cpp4
-rw-r--r--fpdfsdk/pdfwindow/PWL_FontMap.cpp127
-rw-r--r--fpdfsdk/pdfwindow/PWL_FontMap.h5
10 files changed, 105 insertions, 89 deletions
diff --git a/fpdfsdk/cfx_systemhandler.cpp b/fpdfsdk/cfx_systemhandler.cpp
index 906954354b..277e34b18c 100644
--- a/fpdfsdk/cfx_systemhandler.cpp
+++ b/fpdfsdk/cfx_systemhandler.cpp
@@ -9,6 +9,7 @@
#include <memory>
#include "core/fpdfapi/parser/cpdf_document.h"
+#include "core/fxcrt/fx_codepage.h"
#include "core/fxge/cfx_fontmapper.h"
#include "core/fxge/cfx_fontmgr.h"
#include "core/fxge/cfx_gemodule.h"
@@ -21,15 +22,15 @@
namespace {
int CharSet2CP(int charset) {
- if (charset == FXFONT_SHIFTJIS_CHARSET)
- return 932;
- if (charset == FXFONT_GB2312_CHARSET)
- return 936;
- if (charset == FXFONT_HANGUL_CHARSET)
- return 949;
- if (charset == FXFONT_CHINESEBIG5_CHARSET)
- return 950;
- return 0;
+ if (charset == FX_CHARSET_ShiftJIS)
+ return FX_CODEPAGE_ShiftJIS;
+ if (charset == FX_CHARSET_ChineseSimplified)
+ return FX_CODEPAGE_ChineseSimplified;
+ if (charset == FX_CHARSET_Hangul)
+ return FX_CODEPAGE_Hangul;
+ if (charset == FX_CHARSET_ChineseTraditional)
+ return FX_CODEPAGE_ChineseTraditional;
+ return FX_CODEPAGE_DefANSI;
}
} // namespace
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp
index 1c380e59c1..30f25d49cc 100644
--- a/fpdfsdk/formfiller/cba_fontmap.cpp
+++ b/fpdfsdk/formfiller/cba_fontmap.cpp
@@ -42,7 +42,7 @@ void CBA_FontMap::Reset() {
}
void CBA_FontMap::Initialize() {
- int32_t nCharset = FXFONT_DEFAULT_CHARSET;
+ int32_t nCharset = FX_CHARSET_Default;
if (!m_pDefaultFont) {
m_pDefaultFont = GetAnnotDefaultFont(&m_sDefaultFontName);
@@ -54,16 +54,16 @@ void CBA_FontMap::Initialize() {
m_sDefaultFontName == "Wingdings2" ||
m_sDefaultFontName == "Wingdings3" ||
m_sDefaultFontName == "Webdings")
- nCharset = FXFONT_SYMBOL_CHARSET;
+ nCharset = FX_CHARSET_Symbol;
else
- nCharset = FXFONT_ANSI_CHARSET;
+ nCharset = FX_CHARSET_ANSI;
}
AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset);
AddFontToAnnotDict(m_pDefaultFont, m_sDefaultFontName);
}
}
- if (nCharset != FXFONT_ANSI_CHARSET)
+ if (nCharset != FX_CHARSET_ANSI)
CPWL_FontMap::Initialize();
}
@@ -77,7 +77,7 @@ void CBA_FontMap::SetDefaultFont(CPDF_Font* pFont,
m_pDefaultFont = pFont;
m_sDefaultFontName = sFontName;
- int32_t nCharset = FXFONT_DEFAULT_CHARSET;
+ int32_t nCharset = FX_CHARSET_Default;
if (const CFX_SubstFont* pSubstFont = m_pDefaultFont->GetSubstFont())
nCharset = pSubstFont->m_Charset;
AddFontData(m_pDefaultFont, m_sDefaultFontName, nCharset);
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index 7a6d497ad2..ef05a883c9 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -267,7 +267,7 @@ void CFFL_ComboBox::OnSetFocus(CPWL_Wnd* pWnd) {
return;
CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
- pEdit->SetCharSet(FXFONT_GB2312_CHARSET);
+ pEdit->SetCharSet(FX_CHARSET_ChineseSimplified);
pEdit->SetReadyToInput();
CFX_WideString wsText = pEdit->GetText();
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index 19a87d04ae..71fc9291dc 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -275,7 +275,7 @@ void CFFL_TextField::OnSetFocus(CPWL_Wnd* pWnd) {
return;
CPWL_Edit* pEdit = (CPWL_Edit*)pWnd;
- pEdit->SetCharSet(FXFONT_GB2312_CHARSET);
+ pEdit->SetCharSet(FX_CHARSET_ChineseSimplified);
pEdit->SetReadyToInput();
CFX_WideString wsText = pEdit->GetText();
diff --git a/fpdfsdk/fpdf_sysfontinfo.cpp b/fpdfsdk/fpdf_sysfontinfo.cpp
index 6939eba14d..32e573611b 100644
--- a/fpdfsdk/fpdf_sysfontinfo.cpp
+++ b/fpdfsdk/fpdf_sysfontinfo.cpp
@@ -8,6 +8,7 @@
#include <memory>
+#include "core/fxcrt/fx_codepage.h"
#include "core/fxge/cfx_fontmapper.h"
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/fx_font.h"
@@ -15,6 +16,19 @@
#include "fpdfsdk/fsdk_define.h"
#include "fpdfsdk/pdfwindow/PWL_FontMap.h"
+static_assert(FXFONT_ANSI_CHARSET == FX_CHARSET_ANSI, "Charset must match");
+static_assert(FXFONT_DEFAULT_CHARSET == FX_CHARSET_Default,
+ "Charset must match");
+static_assert(FXFONT_SYMBOL_CHARSET == FX_CHARSET_Symbol, "Charset must match");
+static_assert(FXFONT_SHIFTJIS_CHARSET == FX_CHARSET_ShiftJIS,
+ "Charset must match");
+static_assert(FXFONT_HANGEUL_CHARSET == FX_CHARSET_Hangul,
+ "Charset must match");
+static_assert(FXFONT_GB2312_CHARSET == FX_CHARSET_ChineseSimplified,
+ "Charset must match");
+static_assert(FXFONT_CHINESEBIG5_CHARSET == FX_CHARSET_ChineseTraditional,
+ "Charset must match");
+
class CFX_ExternalFontInfo final : public IFX_SystemFontInfo {
public:
explicit CFX_ExternalFontInfo(FPDF_SYSFONTINFO* pInfo) : m_pInfo(pInfo) {}
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp
index 7e2cf04b3f..5b84c9b95e 100644
--- a/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/fxedit/fxet_edit.cpp
@@ -21,6 +21,7 @@
#include "core/fpdfdoc/cpvt_section.h"
#include "core/fpdfdoc/cpvt_word.h"
#include "core/fpdfdoc/ipvt_fontmap.h"
+#include "core/fxcrt/fx_codepage.h"
#include "core/fxge/cfx_graphstatedata.h"
#include "core/fxge/cfx_pathdata.h"
#include "core/fxge/cfx_renderdevice.h"
@@ -476,7 +477,7 @@ void CFXEU_Clear::Undo() {
if (m_pEdit) {
m_pEdit->SelectNone();
m_pEdit->SetCaret(m_wrSel.BeginPos);
- m_pEdit->InsertText(m_swText, FXFONT_DEFAULT_CHARSET, false, true);
+ m_pEdit->InsertText(m_swText, FX_CHARSET_Default, false, true);
m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos);
}
}
@@ -1027,7 +1028,7 @@ CPVT_WordRange CFX_Edit::GetSelectWordRange() const {
void CFX_Edit::SetText(const CFX_WideString& sText) {
Empty();
- DoInsertText(CPVT_WordPlace(0, 0, -1), sText, FXFONT_DEFAULT_CHARSET);
+ DoInsertText(CPVT_WordPlace(0, 0, -1), sText, FX_CHARSET_Default);
Paint();
}
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp
index 1212d7f853..b1285a8428 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp
@@ -460,7 +460,7 @@ void CPWL_Edit::OnKillFocus() {
ShowVScrollBar(false);
m_pEdit->SelectNone();
SetCaret(false, CFX_PointF(), CFX_PointF());
- SetCharSet(FXFONT_ANSI_CHARSET);
+ SetCharSet(FX_CHARSET_ANSI);
m_bFocus = false;
}
@@ -569,7 +569,7 @@ void CPWL_Edit::SetLimitChar(int32_t nLimitChar) {
void CPWL_Edit::ReplaceSel(const CFX_WideString& wsText) {
m_pEdit->Clear();
- m_pEdit->InsertText(wsText, FXFONT_DEFAULT_CHARSET);
+ m_pEdit->InsertText(wsText, FX_CHARSET_Default);
}
CFX_FloatRect CPWL_Edit::GetFocusRect() const {
@@ -714,7 +714,7 @@ bool CPWL_Edit::OnChar(uint16_t nChar, uint32_t nFlag) {
if (IPVT_FontMap* pFontMap = GetFontMap()) {
int32_t nOldCharSet = GetCharSet();
int32_t nNewCharSet =
- pFontMap->CharSetFromUnicode(nChar, FXFONT_DEFAULT_CHARSET);
+ pFontMap->CharSetFromUnicode(nChar, FX_CHARSET_Default);
if (nOldCharSet != nNewCharSet) {
SetCharSet(nNewCharSet);
}
diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
index 19daae1413..c149e80f14 100644
--- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
+++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
@@ -21,7 +21,7 @@ CPWL_EditCtrl::CPWL_EditCtrl()
: m_pEdit(new CFX_Edit),
m_pEditCaret(nullptr),
m_bMouseDown(false),
- m_nCharSet(FXFONT_DEFAULT_CHARSET) {}
+ m_nCharSet(FX_CHARSET_Default) {}
CPWL_EditCtrl::~CPWL_EditCtrl() {}
@@ -472,7 +472,7 @@ void CPWL_EditCtrl::IOnInvalidateRect(CFX_FloatRect* pRect) {
}
int32_t CPWL_EditCtrl::GetCharSet() const {
- return m_nCharSet < 0 ? FXFONT_DEFAULT_CHARSET : m_nCharSet;
+ return m_nCharSet < 0 ? FX_CHARSET_Default : m_nCharSet;
}
void CPWL_EditCtrl::SetReadyToInput() {
diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
index ddf496fbb0..c981f18705 100644
--- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp
+++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
@@ -14,6 +14,7 @@
#include "core/fpdfapi/parser/cpdf_document.h"
#include "core/fpdfapi/parser/cpdf_parser.h"
#include "core/fpdfdoc/ipvt_fontmap.h"
+#include "core/fxcrt/fx_codepage.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
#include "third_party/base/ptr_util.h"
#include "third_party/base/stl_util.h"
@@ -85,9 +86,8 @@ int32_t CPWL_FontMap::GetWordFontIndex(uint16_t word,
return nFontIndex;
} else {
if (const CPWL_FontMap_Data* pData = GetFontMapData(0)) {
- if (nCharset == FXFONT_DEFAULT_CHARSET ||
- pData->nCharset == FXFONT_SYMBOL_CHARSET ||
- nCharset == pData->nCharset) {
+ if (nCharset == FX_CHARSET_Default ||
+ pData->nCharset == FX_CHARSET_Symbol || nCharset == pData->nCharset) {
if (KnowWord(0, word))
return 0;
}
@@ -100,8 +100,7 @@ int32_t CPWL_FontMap::GetWordFontIndex(uint16_t word,
if (KnowWord(nNewFontIndex, word))
return nNewFontIndex;
}
- nNewFontIndex =
- GetFontIndex("Arial Unicode MS", FXFONT_DEFAULT_CHARSET, false);
+ nNewFontIndex = GetFontIndex("Arial Unicode MS", FX_CHARSET_Default, false);
if (nNewFontIndex >= 0) {
if (KnowWord(nNewFontIndex, word))
return nNewFontIndex;
@@ -146,7 +145,7 @@ void CPWL_FontMap::Empty() {
}
void CPWL_FontMap::Initialize() {
- GetFontIndex(kDefaultFontName, FXFONT_ANSI_CHARSET, false);
+ GetFontIndex(kDefaultFontName, FX_CHARSET_ANSI, false);
}
bool CPWL_FontMap::IsStandardFont(const CFX_ByteString& sFontName) {
@@ -163,7 +162,7 @@ int32_t CPWL_FontMap::FindFont(const CFX_ByteString& sFontName,
int32_t i = 0;
for (const auto& pData : m_Data) {
if (pData &&
- (nCharset == FXFONT_DEFAULT_CHARSET || nCharset == pData->nCharset) &&
+ (nCharset == FX_CHARSET_Default || nCharset == pData->nCharset) &&
(sFontName.IsEmpty() || pData->sFontName == sFontName)) {
return i;
}
@@ -210,7 +209,7 @@ void CPWL_FontMap::AddedFont(CPDF_Font* pFont,
const CFX_ByteString& sFontAlias) {}
CFX_ByteString CPWL_FontMap::GetNativeFont(int32_t nCharset) {
- if (nCharset == FXFONT_DEFAULT_CHARSET)
+ if (nCharset == FX_CHARSET_Default)
nCharset = GetNativeCharset();
CFX_ByteString sFontName = GetDefaultFontByCharset(nCharset);
@@ -254,7 +253,7 @@ CPDF_Font* CPWL_FontMap::AddSystemFont(CPDF_Document* pDoc,
if (sFontName.IsEmpty())
sFontName = GetNativeFont(nCharset);
- if (nCharset == FXFONT_DEFAULT_CHARSET)
+ if (nCharset == FX_CHARSET_Default)
nCharset = GetNativeCharset();
return m_pSystemHandler->AddNativeTrueTypeFontToPDF(pDoc, sFontName,
@@ -279,75 +278,75 @@ const CPWL_FontMap_Data* CPWL_FontMap::GetFontMapData(int32_t nIndex) const {
}
int32_t CPWL_FontMap::GetNativeCharset() {
- uint8_t nCharset = FXFONT_ANSI_CHARSET;
+ uint8_t nCharset = FX_CHARSET_ANSI;
int32_t iCodePage = FXSYS_GetACP();
switch (iCodePage) {
- case 932: // Japan
- nCharset = FXFONT_SHIFTJIS_CHARSET;
+ case FX_CODEPAGE_ShiftJIS:
+ nCharset = FX_CHARSET_ShiftJIS;
break;
- case 936: // Chinese (PRC, Singapore)
- nCharset = FXFONT_GB2312_CHARSET;
+ case FX_CODEPAGE_ChineseSimplified:
+ nCharset = FX_CHARSET_ChineseSimplified;
break;
- case 950: // Chinese (Taiwan; Hong Kong SAR, PRC)
- nCharset = FXFONT_GB2312_CHARSET;
+ case FX_CODEPAGE_ChineseTraditional:
+ nCharset = FX_CHARSET_ChineseTraditional;
break;
- case 1252: // Windows 3.1 Latin 1 (US, Western Europe)
- nCharset = FXFONT_ANSI_CHARSET;
+ case FX_CODEPAGE_MSWin_WesternEuropean:
+ nCharset = FX_CHARSET_ANSI;
break;
- case 874: // Thai
- nCharset = FXFONT_THAI_CHARSET;
+ case FX_CODEPAGE_MSDOS_Thai:
+ nCharset = FX_CHARSET_Thai;
break;
- case 949: // Korean
- nCharset = FXFONT_HANGUL_CHARSET;
+ case FX_CODEPAGE_Hangul:
+ nCharset = FX_CHARSET_Hangul;
break;
- case 1200: // Unicode (BMP of ISO 10646)
- nCharset = FXFONT_ANSI_CHARSET;
+ case FX_CODEPAGE_UTF16LE:
+ nCharset = FX_CHARSET_ANSI;
break;
- case 1250: // Windows 3.1 Eastern European
- nCharset = FXFONT_EASTEUROPE_CHARSET;
+ case FX_CODEPAGE_MSWin_EasternEuropean:
+ nCharset = FX_CHARSET_MSWin_EasternEuropean;
break;
- case 1251: // Windows 3.1 Cyrillic
- nCharset = FXFONT_RUSSIAN_CHARSET;
+ case FX_CODEPAGE_MSWin_Cyrillic:
+ nCharset = FX_CHARSET_MSWin_Cyrillic;
break;
- case 1253: // Windows 3.1 Greek
- nCharset = FXFONT_GREEK_CHARSET;
+ case FX_CODEPAGE_MSWin_Greek:
+ nCharset = FX_CHARSET_MSWin_Greek;
break;
- case 1254: // Windows 3.1 Turkish
- nCharset = FXFONT_TURKISH_CHARSET;
+ case FX_CODEPAGE_MSWin_Turkish:
+ nCharset = FX_CHARSET_MSWin_Turkish;
break;
- case 1255: // Hebrew
- nCharset = FXFONT_HEBREW_CHARSET;
+ case FX_CODEPAGE_MSWin_Hebrew:
+ nCharset = FX_CHARSET_MSWin_Hebrew;
break;
- case 1256: // Arabic
- nCharset = FXFONT_ARABIC_CHARSET;
+ case FX_CODEPAGE_MSWin_Arabic:
+ nCharset = FX_CHARSET_MSWin_Arabic;
break;
- case 1257: // Baltic
- nCharset = FXFONT_BALTIC_CHARSET;
+ case FX_CODEPAGE_MSWin_Baltic:
+ nCharset = FX_CHARSET_MSWin_Baltic;
break;
- case 1258: // Vietnamese
- nCharset = FXFONT_VIETNAMESE_CHARSET;
+ case FX_CODEPAGE_MSWin_Vietnamese:
+ nCharset = FX_CHARSET_MSWin_Vietnamese;
break;
- case 1361: // Korean(Johab)
- nCharset = FXFONT_JOHAB_CHARSET;
+ case FX_CODEPAGE_Johab:
+ nCharset = FX_CHARSET_Johab;
break;
}
return nCharset;
}
const FPDF_CharsetFontMap CPWL_FontMap::defaultTTFMap[] = {
- {FXFONT_ANSI_CHARSET, "Helvetica"},
- {FXFONT_GB2312_CHARSET, "SimSun"},
- {FXFONT_CHINESEBIG5_CHARSET, "MingLiU"},
- {FXFONT_SHIFTJIS_CHARSET, "MS Gothic"},
- {FXFONT_HANGUL_CHARSET, "Batang"},
- {FXFONT_RUSSIAN_CHARSET, "Arial"},
+ {FX_CHARSET_ANSI, "Helvetica"},
+ {FX_CHARSET_ChineseSimplified, "SimSun"},
+ {FX_CHARSET_ChineseTraditional, "MingLiU"},
+ {FX_CHARSET_ShiftJIS, "MS Gothic"},
+ {FX_CHARSET_Hangul, "Batang"},
+ {FX_CHARSET_MSWin_Cyrillic, "Arial"},
#if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ || \
_FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- {FXFONT_EASTEUROPE_CHARSET, "Arial"},
+ {FX_CHARSET_MSWin_EasternEuropean, "Arial"},
#else
- {FXFONT_EASTEUROPE_CHARSET, "Tahoma"},
+ {FX_CHARSET_MSWin_EasternEuropean, "Tahoma"},
#endif
- {FXFONT_ARABIC_CHARSET, "Arial"},
+ {FX_CHARSET_MSWin_Arabic, "Arial"},
{-1, nullptr}};
CFX_ByteString CPWL_FontMap::GetDefaultFontByCharset(int32_t nCharset) {
@@ -363,9 +362,9 @@ CFX_ByteString CPWL_FontMap::GetDefaultFontByCharset(int32_t nCharset) {
int32_t CPWL_FontMap::CharSetFromUnicode(uint16_t word, int32_t nOldCharset) {
// to avoid CJK Font to show ASCII
if (word < 0x7F)
- return FXFONT_ANSI_CHARSET;
+ return FX_CHARSET_ANSI;
// follow the old charset
- if (nOldCharset != FXFONT_DEFAULT_CHARSET)
+ if (nOldCharset != FX_CHARSET_Default)
return nOldCharset;
// find new charset
@@ -373,42 +372,42 @@ int32_t CPWL_FontMap::CharSetFromUnicode(uint16_t word, int32_t nOldCharset) {
(word >= 0xE7C7 && word <= 0xE7F3) ||
(word >= 0x3000 && word <= 0x303F) ||
(word >= 0x2000 && word <= 0x206F)) {
- return FXFONT_GB2312_CHARSET;
+ return FX_CHARSET_ChineseSimplified;
}
if (((word >= 0x3040) && (word <= 0x309F)) ||
((word >= 0x30A0) && (word <= 0x30FF)) ||
((word >= 0x31F0) && (word <= 0x31FF)) ||
((word >= 0xFF00) && (word <= 0xFFEF))) {
- return FXFONT_SHIFTJIS_CHARSET;
+ return FX_CHARSET_ShiftJIS;
}
if (((word >= 0xAC00) && (word <= 0xD7AF)) ||
((word >= 0x1100) && (word <= 0x11FF)) ||
((word >= 0x3130) && (word <= 0x318F))) {
- return FXFONT_HANGUL_CHARSET;
+ return FX_CHARSET_Hangul;
}
if (word >= 0x0E00 && word <= 0x0E7F)
- return FXFONT_THAI_CHARSET;
+ return FX_CHARSET_Thai;
if ((word >= 0x0370 && word <= 0x03FF) || (word >= 0x1F00 && word <= 0x1FFF))
- return FXFONT_GREEK_CHARSET;
+ return FX_CHARSET_MSWin_Greek;
if ((word >= 0x0600 && word <= 0x06FF) || (word >= 0xFB50 && word <= 0xFEFC))
- return FXFONT_ARABIC_CHARSET;
+ return FX_CHARSET_MSWin_Arabic;
if (word >= 0x0590 && word <= 0x05FF)
- return FXFONT_HEBREW_CHARSET;
+ return FX_CHARSET_MSWin_Hebrew;
if (word >= 0x0400 && word <= 0x04FF)
- return FXFONT_RUSSIAN_CHARSET;
+ return FX_CHARSET_MSWin_Cyrillic;
if (word >= 0x0100 && word <= 0x024F)
- return FXFONT_EASTEUROPE_CHARSET;
+ return FX_CHARSET_MSWin_EasternEuropean;
if (word >= 0x1E00 && word <= 0x1EFF)
- return FXFONT_VIETNAMESE_CHARSET;
+ return FX_CHARSET_MSWin_Vietnamese;
- return FXFONT_ANSI_CHARSET;
+ return FX_CHARSET_ANSI;
}
diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.h b/fpdfsdk/pdfwindow/PWL_FontMap.h
index 21535305ae..2a532197cb 100644
--- a/fpdfsdk/pdfwindow/PWL_FontMap.h
+++ b/fpdfsdk/pdfwindow/PWL_FontMap.h
@@ -11,6 +11,7 @@
#include <vector>
#include "core/fpdfdoc/ipvt_fontmap.h"
+#include "core/fxcrt/fx_codepage.h"
#include "core/fxge/fx_font.h"
#include "fpdfsdk/fxedit/fx_edit.h"
#include "public/fpdf_sysfontinfo.h"
@@ -65,7 +66,7 @@ class CPWL_FontMap : public IPVT_FontMap {
bool bFind);
int32_t AddFontData(CPDF_Font* pFont,
const CFX_ByteString& sFontAlias,
- int32_t nCharset = FXFONT_DEFAULT_CHARSET);
+ int32_t nCharset = FX_CHARSET_Default);
CFX_ByteString EncodeFontAlias(const CFX_ByteString& sFontName,
int32_t nCharset);
@@ -76,7 +77,7 @@ class CPWL_FontMap : public IPVT_FontMap {
private:
int32_t FindFont(const CFX_ByteString& sFontName,
- int32_t nCharset = FXFONT_DEFAULT_CHARSET);
+ int32_t nCharset = FX_CHARSET_Default);
CFX_ByteString GetNativeFont(int32_t nCharset);
CPDF_Font* AddFontToDocument(CPDF_Document* pDoc,