summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
authornpm <npm@chromium.org>2016-09-19 07:24:33 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-19 07:24:33 -0700
commitea3c3be83dae12ef682c68fc7cf906d790fd9f84 (patch)
treecdaca6bc4a4b9de627e45b90c64d4bd197fd8940 /core/fxge
parent2f8568ef91156d2deb8411c427fbb52f880ccc34 (diff)
downloadpdfium-ea3c3be83dae12ef682c68fc7cf906d790fd9f84.tar.xz
Remove duplicated charset definitions, and move them to fx_font.h
PWL_FontMap does not need its own charset definitions. fx_edit.h does not need to define DEFAULT_CHARSET. XFA have their own definitions. They look different in that most are MAC or MSWin charset definitions. So they are left untouched. public/fpdf_sysfontinfo.h duplicate ones were left untouched due to being in public folder. Review-Url: https://codereview.chromium.org/2347313002
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/android/fpf_skiafontmgr.cpp4
-rw-r--r--core/fxge/apple/fx_mac_imp.cpp2
-rw-r--r--core/fxge/ge/cfx_folderfontinfo.cpp4
-rw-r--r--core/fxge/ge/cfx_fontmapper.cpp2
-rw-r--r--core/fxge/ge/fx_ge_linux.cpp2
-rw-r--r--core/fxge/include/fx_font.h33
-rw-r--r--core/fxge/win32/fx_win32_device.cpp26
7 files changed, 41 insertions, 32 deletions
diff --git a/core/fxge/android/fpf_skiafontmgr.cpp b/core/fxge/android/fpf_skiafontmgr.cpp
index 4b2ad98ddd..b7400fc47f 100644
--- a/core/fxge/android/fpf_skiafontmgr.cpp
+++ b/core/fxge/android/fpf_skiafontmgr.cpp
@@ -147,7 +147,7 @@ static uint32_t FPF_SkiaGetCharset(uint8_t uCharset) {
return FPF_SKIACHARSET_Symbol;
case FXFONT_SHIFTJIS_CHARSET:
return FPF_SKIACHARSET_ShiftJIS;
- case FXFONT_HANGEUL_CHARSET:
+ case FXFONT_HANGUL_CHARSET:
return FPF_SKIACHARSET_Korean;
case FXFONT_GB2312_CHARSET:
return FPF_SKIACHARSET_GB2312;
@@ -204,7 +204,7 @@ static uint32_t FPF_SKIAGetFamilyHash(const CFX_ByteStringC& bsFamily,
static FX_BOOL FPF_SkiaIsCJK(uint8_t uCharset) {
return (uCharset == FXFONT_GB2312_CHARSET) ||
(uCharset == FXFONT_CHINESEBIG5_CHARSET) ||
- (uCharset == FXFONT_HANGEUL_CHARSET) ||
+ (uCharset == FXFONT_HANGUL_CHARSET) ||
(uCharset == FXFONT_SHIFTJIS_CHARSET);
}
static FX_BOOL FPF_SkiaMaybeSymbol(const CFX_ByteStringC& bsFacename) {
diff --git a/core/fxge/apple/fx_mac_imp.cpp b/core/fxge/apple/fx_mac_imp.cpp
index 78bb90fdc2..addcb6d815 100644
--- a/core/fxge/apple/fx_mac_imp.cpp
+++ b/core/fxge/apple/fx_mac_imp.cpp
@@ -107,7 +107,7 @@ void* CFX_MacFontInfo::MapFont(int weight,
case FXFONT_GB2312_CHARSET:
face = "STSong";
break;
- case FXFONT_HANGEUL_CHARSET:
+ case FXFONT_HANGUL_CHARSET:
face = "AppleMyungjo";
break;
case FXFONT_CHINESEBIG5_CHARSET:
diff --git a/core/fxge/ge/cfx_folderfontinfo.cpp b/core/fxge/ge/cfx_folderfontinfo.cpp
index 5bd5b29c79..d4fe325576 100644
--- a/core/fxge/ge/cfx_folderfontinfo.cpp
+++ b/core/fxge/ge/cfx_folderfontinfo.cpp
@@ -63,7 +63,7 @@ uint32_t GetCharset(int charset) {
return CHARSET_FLAG_GB;
case FXFONT_CHINESEBIG5_CHARSET:
return CHARSET_FLAG_BIG5;
- case FXFONT_HANGEUL_CHARSET:
+ case FXFONT_HANGUL_CHARSET:
return CHARSET_FLAG_KOREAN;
case FXFONT_SYMBOL_CHARSET:
return CHARSET_FLAG_SYMBOL;
@@ -239,7 +239,7 @@ void CFX_FolderFontInfo::ReportFace(const CFX_ByteString& path,
pInfo->m_Charsets |= CHARSET_FLAG_BIG5;
}
if ((codepages & (1 << 19)) || (codepages & (1 << 21))) {
- m_pMapper->AddInstalledFont(facename, FXFONT_HANGEUL_CHARSET);
+ m_pMapper->AddInstalledFont(facename, FXFONT_HANGUL_CHARSET);
pInfo->m_Charsets |= CHARSET_FLAG_KOREAN;
}
if (codepages & (1 << 31)) {
diff --git a/core/fxge/ge/cfx_fontmapper.cpp b/core/fxge/ge/cfx_fontmapper.cpp
index 08677ee650..f383730e8f 100644
--- a/core/fxge/ge/cfx_fontmapper.cpp
+++ b/core/fxge/ge/cfx_fontmapper.cpp
@@ -578,7 +578,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
Charset = FXFONT_SYMBOL_CHARSET;
bool bCJK =
(Charset == FXFONT_SHIFTJIS_CHARSET || Charset == FXFONT_GB2312_CHARSET ||
- Charset == FXFONT_HANGEUL_CHARSET ||
+ Charset == FXFONT_HANGUL_CHARSET ||
Charset == FXFONT_CHINESEBIG5_CHARSET);
if (!m_pFontInfo) {
pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
diff --git a/core/fxge/ge/fx_ge_linux.cpp b/core/fxge/ge/fx_ge_linux.cpp
index f57efe8a32..b13a133bc1 100644
--- a/core/fxge/ge/fx_ge_linux.cpp
+++ b/core/fxge/ge/fx_ge_linux.cpp
@@ -123,7 +123,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight,
}
break;
}
- case FXFONT_HANGEUL_CHARSET: {
+ case FXFONT_HANGUL_CHARSET: {
for (size_t i = 0; i < FX_ArraySize(g_LinuxHGFontList); ++i) {
auto it = m_FontList.find(g_LinuxHGFontList[i]);
if (it != m_FontList.end()) {
diff --git a/core/fxge/include/fx_font.h b/core/fxge/include/fx_font.h
index 00c9d6f559..58d12bbb2a 100644
--- a/core/fxge/include/fx_font.h
+++ b/core/fxge/include/fx_font.h
@@ -29,22 +29,12 @@ class SkTypeface;
using CFX_TypeFace = SkTypeface;
#endif
-#define FXFONT_FIXED_PITCH 0x01
-#define FXFONT_SERIF 0x02
-#define FXFONT_SYMBOLIC 0x04
-#define FXFONT_SCRIPT 0x08
-#define FXFONT_ITALIC 0x40
-#define FXFONT_BOLD 0x40000
-#define FXFONT_USEEXTERNATTR 0x80000
-#define FXFONT_CIDFONT 0x100000
-#ifdef PDF_ENABLE_XFA
-#define FXFONT_EXACTMATCH 0x80000000
-#endif // PDF_ENABLE_XFA
+/* Character sets for the font */
#define FXFONT_ANSI_CHARSET 0
#define FXFONT_DEFAULT_CHARSET 1
#define FXFONT_SYMBOL_CHARSET 2
#define FXFONT_SHIFTJIS_CHARSET 128
-#define FXFONT_HANGEUL_CHARSET 129
+#define FXFONT_HANGUL_CHARSET 129
#define FXFONT_GB2312_CHARSET 134
#define FXFONT_CHINESEBIG5_CHARSET 136
#define FXFONT_THAI_CHARSET 222
@@ -55,12 +45,31 @@ using CFX_TypeFace = SkTypeface;
#define FXFONT_HEBREW_CHARSET 177
#define FXFONT_ARABIC_CHARSET 178
#define FXFONT_BALTIC_CHARSET 186
+#define FXFONT_JOHAB_CHARSET 130
+#define FXFONT_VIETNAMESE_CHARSET 163
+
+/* Font pitch and family flags */
#define FXFONT_FF_FIXEDPITCH 1
#define FXFONT_FF_ROMAN (1 << 4)
#define FXFONT_FF_SCRIPT (4 << 4)
+
+/* Typical weight values */
#define FXFONT_FW_NORMAL 400
#define FXFONT_FW_BOLD 700
+/* Font styles */
+#define FXFONT_FIXED_PITCH 0x01
+#define FXFONT_SERIF 0x02
+#define FXFONT_SYMBOLIC 0x04
+#define FXFONT_SCRIPT 0x08
+#define FXFONT_ITALIC 0x40
+#define FXFONT_BOLD 0x40000
+#define FXFONT_USEEXTERNATTR 0x80000
+#define FXFONT_CIDFONT 0x100000
+#ifdef PDF_ENABLE_XFA
+#define FXFONT_EXACTMATCH 0x80000000
+#endif // PDF_ENABLE_XFA
+
#define CHARSET_FLAG_ANSI 1
#define CHARSET_FLAG_SYMBOL 2
#define CHARSET_FLAG_SHIFTJIS 4
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index 9a54dd7f73..061bc0a4d0 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -459,7 +459,7 @@ FX_BOOL CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) {
m_pMapper = pMapper;
LOGFONTA lf;
FXSYS_memset(&lf, 0, sizeof(LOGFONTA));
- lf.lfCharSet = DEFAULT_CHARSET;
+ lf.lfCharSet = FXFONT_DEFAULT_CHARSET;
lf.lfFaceName[0] = 0;
lf.lfPitchAndFamily = 0;
EnumFontFamiliesExA(m_hDC, &lf, (FONTENUMPROCA)FontEnumProc, (uintptr_t) this,
@@ -500,7 +500,7 @@ void* CFX_Win32FallbackFontInfo::MapFont(int weight,
case FXFONT_SHIFTJIS_CHARSET:
case FXFONT_GB2312_CHARSET:
case FXFONT_CHINESEBIG5_CHARSET:
- case FXFONT_HANGEUL_CHARSET:
+ case FXFONT_HANGUL_CHARSET:
default:
bCJK = FALSE;
break;
@@ -592,17 +592,17 @@ void* CFX_Win32FontInfo::MapFont(int weight,
iExact = TRUE;
break;
}
- if (charset == ANSI_CHARSET || charset == SYMBOL_CHARSET) {
- charset = DEFAULT_CHARSET;
+ if (charset == FXFONT_ANSI_CHARSET || charset == FXFONT_SYMBOL_CHARSET) {
+ charset = FXFONT_DEFAULT_CHARSET;
}
int subst_pitch_family = pitch_family;
switch (charset) {
- case SHIFTJIS_CHARSET:
+ case FXFONT_SHIFTJIS_CHARSET:
subst_pitch_family = FF_ROMAN;
break;
- case CHINESEBIG5_CHARSET:
- case HANGUL_CHARSET:
- case GB2312_CHARSET:
+ case FXFONT_CHINESEBIG5_CHARSET:
+ case FXFONT_HANGUL_CHARSET:
+ case FXFONT_GB2312_CHARSET:
subst_pitch_family = 0;
break;
}
@@ -629,20 +629,20 @@ void* CFX_Win32FontInfo::MapFont(int weight,
return hFont;
}
::DeleteObject(hFont);
- if (charset == DEFAULT_CHARSET)
+ if (charset == FXFONT_DEFAULT_CHARSET)
return nullptr;
switch (charset) {
- case SHIFTJIS_CHARSET:
+ case FXFONT_SHIFTJIS_CHARSET:
GetJapanesePreference(face, weight, pitch_family);
break;
- case GB2312_CHARSET:
+ case FXFONT_GB2312_CHARSET:
GetGBPreference(face, weight, pitch_family);
break;
- case HANGUL_CHARSET:
+ case FXFONT_HANGUL_CHARSET:
face = "Gulim";
break;
- case CHINESEBIG5_CHARSET:
+ case FXFONT_CHINESEBIG5_CHARSET:
if (face.Find("MSung") >= 0) {
face = "MingLiU";
} else {