summaryrefslogtreecommitdiff
path: root/core/fxge/ge/cfx_folderfontinfo.cpp
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 /core/fxge/ge/cfx_folderfontinfo.cpp
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 'core/fxge/ge/cfx_folderfontinfo.cpp')
-rw-r--r--core/fxge/ge/cfx_folderfontinfo.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/core/fxge/ge/cfx_folderfontinfo.cpp b/core/fxge/ge/cfx_folderfontinfo.cpp
index ff8cc4c29f..d46c7b5fef 100644
--- a/core/fxge/ge/cfx_folderfontinfo.cpp
+++ b/core/fxge/ge/cfx_folderfontinfo.cpp
@@ -8,6 +8,7 @@
#include <limits>
+#include "core/fxcrt/fx_codepage.h"
#include "core/fxge/cfx_fontmapper.h"
#include "core/fxge/fx_font.h"
@@ -59,17 +60,17 @@ CFX_ByteString FPDF_LoadTableFromTT(FILE* pFile,
uint32_t GetCharset(int charset) {
switch (charset) {
- case FXFONT_SHIFTJIS_CHARSET:
+ case FX_CHARSET_ShiftJIS:
return CHARSET_FLAG_SHIFTJIS;
- case FXFONT_GB2312_CHARSET:
+ case FX_CHARSET_ChineseSimplified:
return CHARSET_FLAG_GB;
- case FXFONT_CHINESEBIG5_CHARSET:
+ case FX_CHARSET_ChineseTraditional:
return CHARSET_FLAG_BIG5;
- case FXFONT_HANGUL_CHARSET:
+ case FX_CHARSET_Hangul:
return CHARSET_FLAG_KOREAN;
- case FXFONT_SYMBOL_CHARSET:
+ case FX_CHARSET_Symbol:
return CHARSET_FLAG_SYMBOL;
- case FXFONT_ANSI_CHARSET:
+ case FX_CHARSET_ANSI:
return CHARSET_FLAG_ANSI;
default:
break;
@@ -229,27 +230,27 @@ void CFX_FolderFontInfo::ReportFace(const CFX_ByteString& path,
const uint8_t* p = os2.raw_str() + 78;
uint32_t codepages = GET_TT_LONG(p);
if (codepages & (1 << 17)) {
- m_pMapper->AddInstalledFont(facename, FXFONT_SHIFTJIS_CHARSET);
+ m_pMapper->AddInstalledFont(facename, FX_CHARSET_ShiftJIS);
pInfo->m_Charsets |= CHARSET_FLAG_SHIFTJIS;
}
if (codepages & (1 << 18)) {
- m_pMapper->AddInstalledFont(facename, FXFONT_GB2312_CHARSET);
+ m_pMapper->AddInstalledFont(facename, FX_CHARSET_ChineseSimplified);
pInfo->m_Charsets |= CHARSET_FLAG_GB;
}
if (codepages & (1 << 20)) {
- m_pMapper->AddInstalledFont(facename, FXFONT_CHINESEBIG5_CHARSET);
+ m_pMapper->AddInstalledFont(facename, FX_CHARSET_ChineseTraditional);
pInfo->m_Charsets |= CHARSET_FLAG_BIG5;
}
if ((codepages & (1 << 19)) || (codepages & (1 << 21))) {
- m_pMapper->AddInstalledFont(facename, FXFONT_HANGUL_CHARSET);
+ m_pMapper->AddInstalledFont(facename, FX_CHARSET_Hangul);
pInfo->m_Charsets |= CHARSET_FLAG_KOREAN;
}
if (codepages & (1 << 31)) {
- m_pMapper->AddInstalledFont(facename, FXFONT_SYMBOL_CHARSET);
+ m_pMapper->AddInstalledFont(facename, FX_CHARSET_Symbol);
pInfo->m_Charsets |= CHARSET_FLAG_SYMBOL;
}
}
- m_pMapper->AddInstalledFont(facename, FXFONT_ANSI_CHARSET);
+ m_pMapper->AddInstalledFont(facename, FX_CHARSET_ANSI);
pInfo->m_Charsets |= CHARSET_FLAG_ANSI;
pInfo->m_Styles = 0;
if (style.Find("Bold") > -1)
@@ -278,17 +279,16 @@ void* CFX_FolderFontInfo::FindFont(int weight,
const char* family,
bool bMatchName) {
CFX_FontFaceInfo* pFind = nullptr;
- if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH))
+ if (charset == FX_CHARSET_ANSI && (pitch_family & FXFONT_FF_FIXEDPITCH))
return GetFont("Courier New");
uint32_t charset_flag = GetCharset(charset);
int32_t iBestSimilar = 0;
for (const auto& it : m_FontList) {
const CFX_ByteString& bsName = it.first;
CFX_FontFaceInfo* pFont = it.second;
- if (!(pFont->m_Charsets & charset_flag) &&
- charset != FXFONT_DEFAULT_CHARSET) {
+ if (!(pFont->m_Charsets & charset_flag) && charset != FX_CHARSET_Default)
continue;
- }
+
int32_t index = bsName.Find(family);
if (bMatchName && index < 0)
continue;