summaryrefslogtreecommitdiff
path: root/core/fxge/android
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/android
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/android')
-rw-r--r--core/fxge/android/cfpf_skiafontmgr.cpp49
1 files changed, 25 insertions, 24 deletions
diff --git a/core/fxge/android/cfpf_skiafontmgr.cpp b/core/fxge/android/cfpf_skiafontmgr.cpp
index 534f41a548..46aa76e822 100644
--- a/core/fxge/android/cfpf_skiafontmgr.cpp
+++ b/core/fxge/android/cfpf_skiafontmgr.cpp
@@ -13,6 +13,7 @@
#include <algorithm>
+#include "core/fxcrt/fx_codepage.h"
#include "core/fxcrt/fx_ext.h"
#include "core/fxcrt/fx_memory.h"
#include "core/fxcrt/fx_system.h"
@@ -123,35 +124,35 @@ enum FPF_SKIACHARSET {
uint32_t FPF_SkiaGetCharset(uint8_t uCharset) {
switch (uCharset) {
- case FXFONT_ANSI_CHARSET:
+ case FX_CHARSET_ANSI:
return FPF_SKIACHARSET_Ansi;
- case FXFONT_DEFAULT_CHARSET:
+ case FX_CHARSET_Default:
return FPF_SKIACHARSET_Default;
- case FXFONT_SYMBOL_CHARSET:
+ case FX_CHARSET_Symbol:
return FPF_SKIACHARSET_Symbol;
- case FXFONT_SHIFTJIS_CHARSET:
+ case FX_CHARSET_ShiftJIS:
return FPF_SKIACHARSET_ShiftJIS;
- case FXFONT_HANGUL_CHARSET:
+ case FX_CHARSET_Hangul:
return FPF_SKIACHARSET_Korean;
- case FXFONT_GB2312_CHARSET:
+ case FX_CHARSET_ChineseSimplified:
return FPF_SKIACHARSET_GB2312;
- case FXFONT_CHINESEBIG5_CHARSET:
+ case FX_CHARSET_ChineseTraditional:
return FPF_SKIACHARSET_BIG5;
- case FXFONT_GREEK_CHARSET:
+ case FX_CHARSET_MSWin_Greek:
return FPF_SKIACHARSET_Greek;
- case FXFONT_TURKISH_CHARSET:
+ case FX_CHARSET_MSWin_Turkish:
return FPF_SKIACHARSET_Turkish;
- case FXFONT_HEBREW_CHARSET:
+ case FX_CHARSET_MSWin_Hebrew:
return FPF_SKIACHARSET_Hebrew;
- case FXFONT_ARABIC_CHARSET:
+ case FX_CHARSET_MSWin_Arabic:
return FPF_SKIACHARSET_Arabic;
- case FXFONT_BALTIC_CHARSET:
+ case FX_CHARSET_MSWin_Baltic:
return FPF_SKIACHARSET_Baltic;
- case FXFONT_RUSSIAN_CHARSET:
+ case FX_CHARSET_MSWin_Cyrillic:
return FPF_SKIACHARSET_Cyrillic;
- case FXFONT_THAI_CHARSET:
+ case FX_CHARSET_Thai:
return FPF_SKIACHARSET_Thai;
- case FXFONT_EASTEUROPE_CHARSET:
+ case FX_CHARSET_MSWin_EasternEuropean:
return FPF_SKIACHARSET_EeasternEuropean;
}
return FPF_SKIACHARSET_Default;
@@ -185,10 +186,9 @@ uint32_t FPF_SKIAGetFamilyHash(const CFX_ByteStringC& bsFamily,
}
bool FPF_SkiaIsCJK(uint8_t uCharset) {
- return (uCharset == FXFONT_GB2312_CHARSET) ||
- (uCharset == FXFONT_CHINESEBIG5_CHARSET) ||
- (uCharset == FXFONT_HANGUL_CHARSET) ||
- (uCharset == FXFONT_SHIFTJIS_CHARSET);
+ return (uCharset == FX_CHARSET_ChineseSimplified) ||
+ (uCharset == FX_CHARSET_ChineseTraditional) ||
+ (uCharset == FX_CHARSET_Hangul) || (uCharset == FX_CHARSET_ShiftJIS);
}
bool FPF_SkiaMaybeSymbol(const CFX_ByteStringC& bsFacename) {
@@ -295,11 +295,12 @@ CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname,
uint32_t dwSubstSans = FPF_SkiaGetSubstFont(dwFaceName, g_SkiaSansFontMap,
FX_ArraySize(g_SkiaSansFontMap));
bool bMaybeSymbol = FPF_SkiaMaybeSymbol(bsFamilyname);
- if (uCharset != FXFONT_ARABIC_CHARSET && FPF_SkiaMaybeArabic(bsFamilyname)) {
- uCharset = FXFONT_ARABIC_CHARSET;
- } else if (uCharset == FXFONT_ANSI_CHARSET &&
+ if (uCharset != FX_CHARSET_MSWin_Arabic &&
+ FPF_SkiaMaybeArabic(bsFamilyname)) {
+ uCharset = FX_CHARSET_MSWin_Arabic;
+ } else if (uCharset == FX_CHARSET_ANSI &&
(dwMatch & FPF_MATCHFONT_REPLACEANSI)) {
- uCharset = FXFONT_DEFAULT_CHARSET;
+ uCharset = FX_CHARSET_Default;
}
int32_t nExpectVal = FPF_SKIAMATCHWEIGHT_NAME1 + FPF_SKIAMATCHWEIGHT_1 * 3 +
FPF_SKIAMATCHWEIGHT_2 * 2;
@@ -331,7 +332,7 @@ CFPF_SkiaFont* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname,
nFind += FPF_SKIAMATCHWEIGHT_NAME2;
bMatchedName = true;
}
- if (uCharset == FXFONT_DEFAULT_CHARSET || bMaybeSymbol) {
+ if (uCharset == FX_CHARSET_Default || bMaybeSymbol) {
if (nFind > nMax && bMatchedName) {
nMax = nFind;
pBestFontDes = *it;