summaryrefslogtreecommitdiff
path: root/core/fxge/ge/cfx_fontmapper.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_fontmapper.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_fontmapper.cpp')
-rw-r--r--core/fxge/ge/cfx_fontmapper.cpp31
1 files changed, 16 insertions, 15 deletions
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);