summaryrefslogtreecommitdiff
path: root/core/src/fxge
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-08-17 15:05:46 -0700
committerLei Zhang <thestig@chromium.org>2015-08-17 15:05:46 -0700
commit52a48aadc19b2dee8abeb702269bb168eb6b6999 (patch)
treee3a77486e920c04abe2f0890c1baa70399d5ab80 /core/src/fxge
parent9494421208674d2c57a9f864d342f017c0b20902 (diff)
downloadpdfium-52a48aadc19b2dee8abeb702269bb168eb6b6999.tar.xz
Cleanup CFX_UnicodeEncoding and remove IFX_FontEncoding.
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1296753003 .
Diffstat (limited to 'core/src/fxge')
-rw-r--r--core/src/fxge/ge/fx_ge_font.cpp45
-rw-r--r--core/src/fxge/ge/text_int.h16
2 files changed, 12 insertions, 49 deletions
diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp
index 8be177ed14..d72adc36bf 100644
--- a/core/src/fxge/ge/fx_ge_font.cpp
+++ b/core/src/fxge/ge/fx_ge_font.cpp
@@ -379,48 +379,27 @@ int CFX_Font::GetULthickness() {
FXFT_Get_Face_UnderLineThickness(m_Face));
return thickness;
}
-CFX_UnicodeEncoding::CFX_UnicodeEncoding(CFX_Font* pFont) {
- m_pFont = pFont;
+
+CFX_UnicodeEncoding::CFX_UnicodeEncoding(CFX_Font* pFont) : m_pFont(pFont) {
+}
+
+CFX_UnicodeEncoding::~CFX_UnicodeEncoding() {
}
+
FX_DWORD CFX_UnicodeEncoding::GlyphFromCharCode(FX_DWORD charcode) {
FXFT_Face face = m_pFont->GetFace();
- if (!face) {
+ if (!face)
return charcode;
- }
- if (FXFT_Select_Charmap(face, FXFT_ENCODING_UNICODE) == 0) {
+
+ if (FXFT_Select_Charmap(face, FXFT_ENCODING_UNICODE) == 0)
return FXFT_Get_Char_Index(face, charcode);
- }
+
if (m_pFont->m_pSubstFont && m_pFont->m_pSubstFont->m_Charset == 2) {
FX_DWORD index = 0;
- if (FXFT_Select_Charmap(face, FXFT_ENCODING_MS_SYMBOL) == 0) {
+ if (FXFT_Select_Charmap(face, FXFT_ENCODING_MS_SYMBOL) == 0)
index = FXFT_Get_Char_Index(face, charcode);
- }
- if (!index && !FXFT_Select_Charmap(face, FXFT_ENCODING_APPLE_ROMAN)) {
+ if (!index && !FXFT_Select_Charmap(face, FXFT_ENCODING_APPLE_ROMAN))
return FXFT_Get_Char_Index(face, charcode);
- }
}
return charcode;
}
-FX_DWORD CFX_UnicodeEncoding::GlyphFromCharCodeEx(FX_DWORD charcode,
- int encoding) {
- FXFT_Face face = m_pFont->GetFace();
- if (!face) {
- return charcode;
- }
- if (encoding == ENCODING_UNICODE) {
- return GlyphFromCharCode(charcode);
- }
- int nmaps = FXFT_Get_Face_CharmapCount(m_pFont->m_Face);
- int i = 0;
- while (i < nmaps) {
- int encoding = FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[i++]);
- if (encoding != FXFT_ENCODING_UNICODE) {
- FXFT_Select_Charmap(face, encoding);
- break;
- }
- }
- return FXFT_Get_Char_Index(face, charcode);
-}
-IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont) {
- return new CFX_UnicodeEncoding(pFont);
-}
diff --git a/core/src/fxge/ge/text_int.h b/core/src/fxge/ge/text_int.h
index e9f81b3ca7..61f47eac9c 100644
--- a/core/src/fxge/ge/text_int.h
+++ b/core/src/fxge/ge/text_int.h
@@ -41,23 +41,7 @@ class CTTFontDesc {
uint8_t* m_pFontData;
int m_RefCount;
};
-class CFX_UnicodeEncoding : public IFX_FontEncoding {
- public:
- CFX_UnicodeEncoding(CFX_Font* pFont);
- virtual FX_DWORD GlyphFromCharCodeEx(FX_DWORD charcode,
- int encoding = ENCODING_UNICODE);
- private:
- CFX_Font* m_pFont;
- virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode);
- virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const {
- return CFX_WideString((FX_WCHAR)charcode);
- }
- virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const {
- return Unicode;
- }
- virtual FX_BOOL IsUnicodeCompatible() const { return TRUE; }
-};
#define CHARSET_FLAG_ANSI 1
#define CHARSET_FLAG_SYMBOL 2
#define CHARSET_FLAG_SHIFTJIS 4