summaryrefslogtreecommitdiff
path: root/core/fxge/ge
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxge/ge')
-rw-r--r--core/fxge/ge/cfx_facecache.cpp3
-rw-r--r--core/fxge/ge/cfx_folderfontinfo.cpp32
-rw-r--r--core/fxge/ge/cfx_font.cpp3
-rw-r--r--core/fxge/ge/cfx_fontmapper.cpp31
-rw-r--r--core/fxge/ge/cfx_substfont.cpp3
-rw-r--r--core/fxge/ge/cfx_unicodeencoding.cpp3
-rw-r--r--core/fxge/ge/fx_ge_linux.cpp9
7 files changed, 45 insertions, 39 deletions
diff --git a/core/fxge/ge/cfx_facecache.cpp b/core/fxge/ge/cfx_facecache.cpp
index 2a8e71acf5..0e1dea4bb3 100644
--- a/core/fxge/ge/cfx_facecache.cpp
+++ b/core/fxge/ge/cfx_facecache.cpp
@@ -10,6 +10,7 @@
#include <limits>
#include <memory>
+#include "core/fxcrt/fx_codepage.h"
#include "core/fxge/cfx_fontmgr.h"
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/cfx_pathdata.h"
@@ -165,7 +166,7 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(const CFX_Font* pFont,
if (index >= CFX_Font::kWeightPowArraySize)
return nullptr;
pdfium::base::CheckedNumeric<signed long> level = 0;
- if (pSubstFont->m_Charset == FXFONT_SHIFTJIS_CHARSET)
+ if (pSubstFont->m_Charset == FX_CHARSET_ShiftJIS)
level = CFX_Font::s_WeightPow_SHIFTJIS[index] * 2;
else
level = CFX_Font::s_WeightPow_11[index];
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;
diff --git a/core/fxge/ge/cfx_font.cpp b/core/fxge/ge/cfx_font.cpp
index 068f0b032c..2ae34f11b9 100644
--- a/core/fxge/ge/cfx_font.cpp
+++ b/core/fxge/ge/cfx_font.cpp
@@ -13,6 +13,7 @@
#include <vector>
#include "core/fpdfapi/font/cpdf_font.h"
+#include "core/fxcrt/fx_codepage.h"
#include "core/fxge/cfx_facecache.h"
#include "core/fxge/cfx_fontcache.h"
#include "core/fxge/cfx_fontmgr.h"
@@ -644,7 +645,7 @@ CFX_PathData* CFX_Font::LoadGlyphPathImpl(uint32_t glyph_index,
uint32_t index = (m_pSubstFont->m_Weight - 400) / 10;
index = std::min(index, static_cast<uint32_t>(kWeightPowArraySize - 1));
int level = 0;
- if (m_pSubstFont->m_Charset == FXFONT_SHIFTJIS_CHARSET)
+ if (m_pSubstFont->m_Charset == FX_CHARSET_ShiftJIS)
level = s_WeightPow_SHIFTJIS[index] * 2 * 65536 / 36655;
else
level = s_WeightPow[index] * 2;
diff --git a/core/fxge/ge/cfx_fontmapper.cpp b/core/fxge/ge/cfx_fontmapper.cpp
index ff80685d96..4d5e9c4831 100644
--- a/core/fxge/ge/cfx_fontmapper.cpp
+++ b/core/fxge/ge/cfx_fontmapper.cpp
@@ -11,6 +11,7 @@
#include <utility>
#include <vector>
+#include "core/fxcrt/fx_codepage.h"
#include "core/fxge/cfx_substfont.h"
#include "core/fxge/fx_font.h"
#include "core/fxge/ifx_systemfontinfo.h"
@@ -202,7 +203,7 @@ uint8_t GetCharsetFromCodePage(uint16_t codepage) {
});
if (pCharmap < pEnd && codepage == pCharmap->codepage)
return pCharmap->charset;
- return FXFONT_DEFAULT_CHARSET;
+ return FX_CHARSET_Default;
}
CFX_ByteString GetFontFamily(CFX_ByteString fontName, int nStyle) {
@@ -335,8 +336,8 @@ void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) {
void* hFont = m_pFontInfo->GetFont(name.c_str());
if (!hFont) {
int iExact;
- hFont = m_pFontInfo->MapFont(0, 0, FXFONT_DEFAULT_CHARSET, 0,
- name.c_str(), iExact);
+ hFont = m_pFontInfo->MapFont(0, 0, FX_CHARSET_Default, 0, name.c_str(),
+ iExact);
if (!hFont)
return;
}
@@ -434,12 +435,12 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
PDF_GetStandardFontName(&SubstName);
if (SubstName == "Symbol" && !bTrueType) {
pSubstFont->m_Family = "Chrome Symbol";
- pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
+ pSubstFont->m_Charset = FX_CHARSET_Symbol;
return UseInternalSubst(pSubstFont, 12, italic_angle, weight, 0);
}
if (SubstName == "ZapfDingbats") {
pSubstFont->m_Family = "Chrome Dingbats";
- pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
+ pSubstFont->m_Charset = FX_CHARSET_Symbol;
return UseInternalSubst(pSubstFont, 13, italic_angle, weight, 0);
}
int iBaseFont = 0;
@@ -552,15 +553,15 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
if (nStyle & FX_FONT_STYLE_Italic)
bItalic = true;
int iExact = 0;
- int Charset = FXFONT_ANSI_CHARSET;
+ int Charset = FX_CHARSET_ANSI;
if (WindowCP)
Charset = GetCharsetFromCodePage(WindowCP);
else if (iBaseFont == kNumStandardFonts && (flags & FXFONT_SYMBOLIC))
- Charset = FXFONT_SYMBOL_CHARSET;
- bool bCJK =
- (Charset == FXFONT_SHIFTJIS_CHARSET || Charset == FXFONT_GB2312_CHARSET ||
- Charset == FXFONT_HANGUL_CHARSET ||
- Charset == FXFONT_CHINESEBIG5_CHARSET);
+ Charset = FX_CHARSET_Symbol;
+ bool bCJK = (Charset == FX_CHARSET_ShiftJIS ||
+ Charset == FX_CHARSET_ChineseSimplified ||
+ Charset == FX_CHARSET_Hangul ||
+ Charset == FX_CHARSET_ChineseTraditional);
if (!m_pFontInfo) {
return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight,
PitchFamily);
@@ -640,12 +641,12 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
PitchFamily);
}
} else {
- if (Charset == FXFONT_SYMBOL_CHARSET) {
+ if (Charset == FX_CHARSET_Symbol) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \
_FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_
if (SubstName == "Symbol") {
pSubstFont->m_Family = "Chrome Symbol";
- pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
+ pSubstFont->m_Charset = FX_CHARSET_Symbol;
return UseInternalSubst(pSubstFont, 12, italic_angle, old_weight,
PitchFamily);
}
@@ -653,7 +654,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
return FindSubstFont(family, bTrueType, flags & ~FXFONT_SYMBOLIC,
weight, italic_angle, 0, pSubstFont);
}
- if (Charset == FXFONT_ANSI_CHARSET) {
+ if (Charset == FX_CHARSET_ANSI) {
return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight,
PitchFamily);
}
@@ -674,7 +675,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
return nullptr;
m_pFontInfo->GetFaceName(hFont, &SubstName);
- if (Charset == FXFONT_DEFAULT_CHARSET)
+ if (Charset == FX_CHARSET_Default)
m_pFontInfo->GetFontCharset(hFont, &Charset);
uint32_t ttc_size = m_pFontInfo->GetFontData(hFont, kTableTTCF, nullptr, 0);
uint32_t font_size = m_pFontInfo->GetFontData(hFont, 0, nullptr, 0);
diff --git a/core/fxge/ge/cfx_substfont.cpp b/core/fxge/ge/cfx_substfont.cpp
index 475372e3d9..27d3bc3059 100644
--- a/core/fxge/ge/cfx_substfont.cpp
+++ b/core/fxge/ge/cfx_substfont.cpp
@@ -6,10 +6,11 @@
#include "core/fxge/cfx_substfont.h"
+#include "core/fxcrt/fx_codepage.h"
#include "core/fxge/fx_font.h"
CFX_SubstFont::CFX_SubstFont()
- : m_Charset(FXFONT_ANSI_CHARSET),
+ : m_Charset(FX_CHARSET_ANSI),
m_SubstFlags(0),
m_Weight(0),
m_ItalicAngle(0),
diff --git a/core/fxge/ge/cfx_unicodeencoding.cpp b/core/fxge/ge/cfx_unicodeencoding.cpp
index cba67ba354..494ae33bb0 100644
--- a/core/fxge/ge/cfx_unicodeencoding.cpp
+++ b/core/fxge/ge/cfx_unicodeencoding.cpp
@@ -6,6 +6,7 @@
#include "core/fxge/cfx_unicodeencoding.h"
+#include "core/fxcrt/fx_codepage.h"
#include "core/fxge/fx_font.h"
#include "core/fxge/fx_freetype.h"
@@ -22,7 +23,7 @@ uint32_t CFX_UnicodeEncoding::GlyphFromCharCode(uint32_t charcode) {
return FXFT_Get_Char_Index(face, charcode);
if (m_pFont->GetSubstFont() &&
- m_pFont->GetSubstFont()->m_Charset == FXFONT_SYMBOL_CHARSET) {
+ m_pFont->GetSubstFont()->m_Charset == FX_CHARSET_Symbol) {
uint32_t index = 0;
if (FXFT_Select_Charmap(face, FXFT_ENCODING_MS_SYMBOL) == 0)
index = FXFT_Get_Char_Index(face, charcode);
diff --git a/core/fxge/ge/fx_ge_linux.cpp b/core/fxge/ge/fx_ge_linux.cpp
index 502a3674ab..8d2c496c19 100644
--- a/core/fxge/ge/fx_ge_linux.cpp
+++ b/core/fxge/ge/fx_ge_linux.cpp
@@ -6,6 +6,7 @@
#include <memory>
+#include "core/fxcrt/fx_codepage.h"
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/ge/cfx_folderfontinfo.h"
#include "core/fxge/ifx_systemfontinfo.h"
@@ -90,7 +91,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight,
}
bool bCJK = true;
switch (charset) {
- case FXFONT_SHIFTJIS_CHARSET: {
+ case FX_CHARSET_ShiftJIS: {
size_t index = GetJapanesePreference(cstr_face, weight, pitch_family);
ASSERT(index < FX_ArraySize(g_LinuxGpFontList));
for (size_t i = 0; i < kLinuxGpNameSize; i++) {
@@ -100,7 +101,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight,
}
break;
}
- case FXFONT_GB2312_CHARSET: {
+ case FX_CHARSET_ChineseSimplified: {
for (size_t i = 0; i < FX_ArraySize(g_LinuxGbFontList); ++i) {
auto it = m_FontList.find(g_LinuxGbFontList[i]);
if (it != m_FontList.end())
@@ -108,7 +109,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight,
}
break;
}
- case FXFONT_CHINESEBIG5_CHARSET: {
+ case FX_CHARSET_ChineseTraditional: {
for (size_t i = 0; i < FX_ArraySize(g_LinuxB5FontList); ++i) {
auto it = m_FontList.find(g_LinuxB5FontList[i]);
if (it != m_FontList.end())
@@ -116,7 +117,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight,
}
break;
}
- case FXFONT_HANGUL_CHARSET: {
+ case FX_CHARSET_Hangul: {
for (size_t i = 0; i < FX_ArraySize(g_LinuxHGFontList); ++i) {
auto it = m_FontList.find(g_LinuxHGFontList[i]);
if (it != m_FontList.end())