summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornpm <npm@chromium.org>2016-08-18 10:55:29 -0700
committerCommit bot <commit-bot@chromium.org>2016-08-18 10:55:29 -0700
commit1a8946b09884393d7dc4941e59b3172a7e473b01 (patch)
tree12bfdaad2b15bd515f8d8fff27c7fe0db63cce2b
parent2eb7c7dd6392488d858989da8d57d618f58f04ca (diff)
downloadpdfium-1a8946b09884393d7dc4941e59b3172a7e473b01.tar.xz
Move CFX_UnicodeEncoding and CFX_UnicodeEncodingEx to their own files.
Review-Url: https://codereview.chromium.org/2260533002
-rw-r--r--BUILD.gn9
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_document.cpp1
-rw-r--r--core/fxge/ge/cfx_unicodeencoding.cpp33
-rw-r--r--core/fxge/ge/cfx_unicodeencodingex.cpp98
-rw-r--r--core/fxge/ge/fx_ge_font.cpp113
-rw-r--r--core/fxge/include/cfx_unicodeencoding.h46
-rw-r--r--core/fxge/include/cfx_unicodeencodingex.h37
-rw-r--r--core/fxge/include/fx_font.h54
-rw-r--r--pdfium.gyp8
-rw-r--r--xfa/fgas/font/fgas_gefont.cpp2
-rw-r--r--xfa/fgas/font/fgas_gefont.h1
-rw-r--r--xfa/fxbarcode/oned/BC_OneDimWriter.cpp1
-rw-r--r--xfa/fxgraphics/cfx_graphics.cpp1
13 files changed, 238 insertions, 166 deletions
diff --git a/BUILD.gn b/BUILD.gn
index 7f49b16aa7..1e87014594 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -762,6 +762,7 @@ static_library("fxge") {
"core/fxge/ge/cfx_graphstatedata.cpp",
"core/fxge/ge/cfx_pathdata.cpp",
"core/fxge/ge/cfx_renderdevice.cpp",
+ "core/fxge/ge/cfx_unicodeencoding.cpp",
"core/fxge/ge/fx_ge_font.cpp",
"core/fxge/ge/fx_ge_fontmap.cpp",
"core/fxge/ge/fx_ge_linux.cpp",
@@ -778,6 +779,7 @@ static_library("fxge") {
"core/fxge/include/cfx_graphstatedata.h",
"core/fxge/include/cfx_pathdata.h",
"core/fxge/include/cfx_renderdevice.h",
+ "core/fxge/include/cfx_unicodeencoding.h",
"core/fxge/include/cfx_windowsdevice.h",
"core/fxge/include/fx_dib.h",
"core/fxge/include/fx_font.h",
@@ -791,6 +793,13 @@ static_library("fxge") {
":pdfium_core_config",
]
+ if (pdf_enable_xfa) {
+ sources += [
+ "core/fxge/ge/cfx_unicodeencodingex.cpp",
+ "core/fxge/include/cfx_unicodeencodingex.h",
+ ]
+ }
+
if (pdf_use_skia) {
sources += [ "core/fxge/skia/fx_skia_device.cpp" ]
deps = [
diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
index 0274f10273..0f7bad0738 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp
@@ -22,6 +22,7 @@
#include "core/fpdfapi/include/cpdf_modulemgr.h"
#include "core/fxcodec/include/JBig2_DocumentContext.h"
#include "core/fxge/include/cfx_fontcache.h"
+#include "core/fxge/include/cfx_unicodeencoding.h"
#include "core/fxge/include/fx_font.h"
#include "third_party/base/stl_util.h"
diff --git a/core/fxge/ge/cfx_unicodeencoding.cpp b/core/fxge/ge/cfx_unicodeencoding.cpp
new file mode 100644
index 0000000000..456c2f5d49
--- /dev/null
+++ b/core/fxge/ge/cfx_unicodeencoding.cpp
@@ -0,0 +1,33 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/include/cfx_unicodeencoding.h"
+
+#include "core/fxge/include/fx_font.h"
+#include "core/fxge/include/fx_freetype.h"
+
+CFX_UnicodeEncoding::CFX_UnicodeEncoding(CFX_Font* pFont) : m_pFont(pFont) {}
+
+CFX_UnicodeEncoding::~CFX_UnicodeEncoding() {}
+
+uint32_t CFX_UnicodeEncoding::GlyphFromCharCode(uint32_t charcode) {
+ FXFT_Face face = m_pFont->GetFace();
+ if (!face)
+ return charcode;
+
+ if (FXFT_Select_Charmap(face, FXFT_ENCODING_UNICODE) == 0)
+ return FXFT_Get_Char_Index(face, charcode);
+
+ if (m_pFont->GetSubstFont() &&
+ m_pFont->GetSubstFont()->m_Charset == FXFONT_SYMBOL_CHARSET) {
+ uint32_t index = 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))
+ return FXFT_Get_Char_Index(face, charcode);
+ }
+ return charcode;
+}
diff --git a/core/fxge/ge/cfx_unicodeencodingex.cpp b/core/fxge/ge/cfx_unicodeencodingex.cpp
new file mode 100644
index 0000000000..030a1e9674
--- /dev/null
+++ b/core/fxge/ge/cfx_unicodeencodingex.cpp
@@ -0,0 +1,98 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#include "core/fxge/include/cfx_unicodeencodingex.h"
+
+#include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
+#include "core/fxge/include/fx_font.h"
+#include "core/fxge/include/fx_freetype.h"
+
+namespace {
+
+const uint32_t g_EncodingID[] = {
+ FXFM_ENCODING_MS_SYMBOL, FXFM_ENCODING_UNICODE,
+ FXFM_ENCODING_MS_SJIS, FXFM_ENCODING_MS_GB2312,
+ FXFM_ENCODING_MS_BIG5, FXFM_ENCODING_MS_WANSUNG,
+ FXFM_ENCODING_MS_JOHAB, FXFM_ENCODING_ADOBE_STANDARD,
+ FXFM_ENCODING_ADOBE_EXPERT, FXFM_ENCODING_ADOBE_CUSTOM,
+ FXFM_ENCODING_ADOBE_LATIN_1, FXFM_ENCODING_OLD_LATIN_2,
+ FXFM_ENCODING_APPLE_ROMAN,
+};
+
+CFX_UnicodeEncodingEx* FXFM_CreateFontEncoding(CFX_Font* pFont,
+ uint32_t nEncodingID) {
+ if (FXFT_Select_Charmap(pFont->GetFace(), nEncodingID))
+ return nullptr;
+ return new CFX_UnicodeEncodingEx(pFont, nEncodingID);
+}
+
+} // namespace
+
+CFX_UnicodeEncodingEx::CFX_UnicodeEncodingEx(CFX_Font* pFont,
+ uint32_t EncodingID)
+ : CFX_UnicodeEncoding(pFont), m_nEncodingID(EncodingID) {}
+
+CFX_UnicodeEncodingEx::~CFX_UnicodeEncodingEx() {}
+
+uint32_t CFX_UnicodeEncodingEx::GlyphFromCharCode(uint32_t charcode) {
+ FXFT_Face face = m_pFont->GetFace();
+ FT_UInt nIndex = FXFT_Get_Char_Index(face, charcode);
+ if (nIndex > 0)
+ return nIndex;
+ int nmaps = FXFT_Get_Face_CharmapCount(face);
+ int m = 0;
+ while (m < nmaps) {
+ uint32_t nEncodingID =
+ FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[m++]);
+ if (m_nEncodingID == nEncodingID)
+ continue;
+ int error = FXFT_Select_Charmap(face, nEncodingID);
+ if (error)
+ continue;
+ nIndex = FXFT_Get_Char_Index(face, charcode);
+ if (nIndex > 0) {
+ m_nEncodingID = nEncodingID;
+ return nIndex;
+ }
+ }
+ FXFT_Select_Charmap(face, m_nEncodingID);
+ return 0;
+}
+
+uint32_t CFX_UnicodeEncodingEx::CharCodeFromUnicode(FX_WCHAR Unicode) const {
+ if (m_nEncodingID == FXFM_ENCODING_UNICODE ||
+ m_nEncodingID == FXFM_ENCODING_MS_SYMBOL) {
+ return Unicode;
+ }
+ FXFT_Face face = m_pFont->GetFace();
+ int nmaps = FXFT_Get_Face_CharmapCount(face);
+ for (int i = 0; i < nmaps; i++) {
+ int nEncodingID =
+ FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[i]);
+ if (nEncodingID == FXFM_ENCODING_UNICODE ||
+ nEncodingID == FXFM_ENCODING_MS_SYMBOL) {
+ return Unicode;
+ }
+ }
+ return CPDF_Font::kInvalidCharCode;
+}
+
+CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx(CFX_Font* pFont,
+ uint32_t nEncodingID) {
+ if (!pFont || !pFont->GetFace())
+ return nullptr;
+
+ if (nEncodingID != FXFM_ENCODING_NONE)
+ return FXFM_CreateFontEncoding(pFont, nEncodingID);
+
+ for (size_t i = 0; i < FX_ArraySize(g_EncodingID); ++i) {
+ CFX_UnicodeEncodingEx* pFontEncoding =
+ FXFM_CreateFontEncoding(pFont, g_EncodingID[i]);
+ if (pFontEncoding)
+ return pFontEncoding;
+ }
+ return nullptr;
+}
diff --git a/core/fxge/ge/fx_ge_font.cpp b/core/fxge/ge/fx_ge_font.cpp
index 4e0627fba6..e459d6b083 100644
--- a/core/fxge/ge/fx_ge_font.cpp
+++ b/core/fxge/ge/fx_ge_font.cpp
@@ -7,8 +7,8 @@
#include "core/fxge/include/fx_font.h"
#include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
-#include "core/fxge/include/cfx_fontmgr.h"
#include "core/fxge/ge/fx_text_int.h"
+#include "core/fxge/include/cfx_fontmgr.h"
#include "core/fxge/include/cfx_gemodule.h"
#include "core/fxge/include/fx_freetype.h"
@@ -17,22 +17,6 @@
namespace {
#ifdef PDF_ENABLE_XFA
-const uint32_t g_EncodingID[] = {
- FXFM_ENCODING_MS_SYMBOL, FXFM_ENCODING_UNICODE,
- FXFM_ENCODING_MS_SJIS, FXFM_ENCODING_MS_GB2312,
- FXFM_ENCODING_MS_BIG5, FXFM_ENCODING_MS_WANSUNG,
- FXFM_ENCODING_MS_JOHAB, FXFM_ENCODING_ADOBE_STANDARD,
- FXFM_ENCODING_ADOBE_EXPERT, FXFM_ENCODING_ADOBE_CUSTOM,
- FXFM_ENCODING_ADOBE_LATIN_1, FXFM_ENCODING_OLD_LATIN_2,
- FXFM_ENCODING_APPLE_ROMAN,
-};
-
-CFX_UnicodeEncodingEx* _FXFM_CreateFontEncoding(CFX_Font* pFont,
- uint32_t nEncodingID) {
- if (FXFT_Select_Charmap(pFont->GetFace(), nEncodingID))
- return nullptr;
- return new CFX_UnicodeEncodingEx(pFont, nEncodingID);
-}
unsigned long FTStreamRead(FXFT_Stream stream,
unsigned long offset,
@@ -429,98 +413,3 @@ int CFX_Font::GetULthickness() const {
return EM_ADJUST(FXFT_Get_Face_UnitsPerEM(m_Face),
FXFT_Get_Face_UnderLineThickness(m_Face));
}
-
-CFX_UnicodeEncoding::CFX_UnicodeEncoding(CFX_Font* pFont) : m_pFont(pFont) {}
-
-CFX_UnicodeEncoding::~CFX_UnicodeEncoding() {}
-
-uint32_t CFX_UnicodeEncoding::GlyphFromCharCode(uint32_t charcode) {
- FXFT_Face face = m_pFont->GetFace();
- if (!face)
- return charcode;
-
- if (FXFT_Select_Charmap(face, FXFT_ENCODING_UNICODE) == 0)
- return FXFT_Get_Char_Index(face, charcode);
-
- if (m_pFont->GetSubstFont() &&
- m_pFont->GetSubstFont()->m_Charset == FXFONT_SYMBOL_CHARSET) {
- uint32_t index = 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))
- return FXFT_Get_Char_Index(face, charcode);
- }
- return charcode;
-}
-
-#ifdef PDF_ENABLE_XFA
-CFX_UnicodeEncodingEx::CFX_UnicodeEncodingEx(CFX_Font* pFont,
- uint32_t EncodingID)
- : CFX_UnicodeEncoding(pFont), m_nEncodingID(EncodingID) {}
-
-CFX_UnicodeEncodingEx::~CFX_UnicodeEncodingEx() {}
-
-uint32_t CFX_UnicodeEncodingEx::GlyphFromCharCode(uint32_t charcode) {
- FXFT_Face face = m_pFont->GetFace();
- FT_UInt nIndex = FXFT_Get_Char_Index(face, charcode);
- if (nIndex > 0) {
- return nIndex;
- }
- int nmaps = FXFT_Get_Face_CharmapCount(face);
- int m = 0;
- while (m < nmaps) {
- uint32_t nEncodingID =
- FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[m++]);
- if (m_nEncodingID == nEncodingID) {
- continue;
- }
- int error = FXFT_Select_Charmap(face, nEncodingID);
- if (error) {
- continue;
- }
- nIndex = FXFT_Get_Char_Index(face, charcode);
- if (nIndex > 0) {
- m_nEncodingID = nEncodingID;
- return nIndex;
- }
- }
- FXFT_Select_Charmap(face, m_nEncodingID);
- return 0;
-}
-
-uint32_t CFX_UnicodeEncodingEx::CharCodeFromUnicode(FX_WCHAR Unicode) const {
- if (m_nEncodingID == FXFM_ENCODING_UNICODE ||
- m_nEncodingID == FXFM_ENCODING_MS_SYMBOL) {
- return Unicode;
- }
- FXFT_Face face = m_pFont->GetFace();
- int nmaps = FXFT_Get_Face_CharmapCount(face);
- for (int i = 0; i < nmaps; i++) {
- int nEncodingID =
- FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmaps(face)[i]);
- if (nEncodingID == FXFM_ENCODING_UNICODE ||
- nEncodingID == FXFM_ENCODING_MS_SYMBOL) {
- return Unicode;
- }
- }
- return CPDF_Font::kInvalidCharCode;
-}
-
-CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx(CFX_Font* pFont,
- uint32_t nEncodingID) {
- if (!pFont || !pFont->GetFace())
- return nullptr;
-
- if (nEncodingID != FXFM_ENCODING_NONE)
- return _FXFM_CreateFontEncoding(pFont, nEncodingID);
-
- for (size_t i = 0; i < FX_ArraySize(g_EncodingID); ++i) {
- CFX_UnicodeEncodingEx* pFontEncoding =
- _FXFM_CreateFontEncoding(pFont, g_EncodingID[i]);
- if (pFontEncoding) {
- return pFontEncoding;
- }
- }
- return nullptr;
-}
-#endif // PDF_ENABLE_XFA
diff --git a/core/fxge/include/cfx_unicodeencoding.h b/core/fxge/include/cfx_unicodeencoding.h
new file mode 100644
index 0000000000..dee785f9df
--- /dev/null
+++ b/core/fxge/include/cfx_unicodeencoding.h
@@ -0,0 +1,46 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_INCLUDE_CFX_UNICODEENCODING_H_
+#define CORE_FXGE_INCLUDE_CFX_UNICODEENCODING_H_
+
+#include "core/fxge/include/fx_font.h"
+
+#define ENCODING_INTERNAL 0
+#define ENCODING_UNICODE 1
+
+#ifdef PDF_ENABLE_XFA
+#define FXFM_ENC_TAG(a, b, c, d) \
+ (((uint32_t)(a) << 24) | ((uint32_t)(b) << 16) | ((uint32_t)(c) << 8) | \
+ (uint32_t)(d))
+#define FXFM_ENCODING_NONE FXFM_ENC_TAG(0, 0, 0, 0)
+#define FXFM_ENCODING_MS_SYMBOL FXFM_ENC_TAG('s', 'y', 'm', 'b')
+#define FXFM_ENCODING_UNICODE FXFM_ENC_TAG('u', 'n', 'i', 'c')
+#define FXFM_ENCODING_MS_SJIS FXFM_ENC_TAG('s', 'j', 'i', 's')
+#define FXFM_ENCODING_MS_GB2312 FXFM_ENC_TAG('g', 'b', ' ', ' ')
+#define FXFM_ENCODING_MS_BIG5 FXFM_ENC_TAG('b', 'i', 'g', '5')
+#define FXFM_ENCODING_MS_WANSUNG FXFM_ENC_TAG('w', 'a', 'n', 's')
+#define FXFM_ENCODING_MS_JOHAB FXFM_ENC_TAG('j', 'o', 'h', 'a')
+#define FXFM_ENCODING_ADOBE_STANDARD FXFM_ENC_TAG('A', 'D', 'O', 'B')
+#define FXFM_ENCODING_ADOBE_EXPERT FXFM_ENC_TAG('A', 'D', 'B', 'E')
+#define FXFM_ENCODING_ADOBE_CUSTOM FXFM_ENC_TAG('A', 'D', 'B', 'C')
+#define FXFM_ENCODING_ADOBE_LATIN_1 FXFM_ENC_TAG('l', 'a', 't', '1')
+#define FXFM_ENCODING_OLD_LATIN_2 FXFM_ENC_TAG('l', 'a', 't', '2')
+#define FXFM_ENCODING_APPLE_ROMAN FXFM_ENC_TAG('a', 'r', 'm', 'n')
+#endif // PDF_ENABLE_XFA
+
+class CFX_UnicodeEncoding {
+ public:
+ explicit CFX_UnicodeEncoding(CFX_Font* pFont);
+ virtual ~CFX_UnicodeEncoding();
+
+ virtual uint32_t GlyphFromCharCode(uint32_t charcode);
+
+ protected:
+ CFX_Font* m_pFont; // Unowned, not nullptr.
+};
+
+#endif // CORE_FXGE_INCLUDE_CFX_UNICODEENCODING_H_
diff --git a/core/fxge/include/cfx_unicodeencodingex.h b/core/fxge/include/cfx_unicodeencodingex.h
new file mode 100644
index 0000000000..2ce062faf3
--- /dev/null
+++ b/core/fxge/include/cfx_unicodeencodingex.h
@@ -0,0 +1,37 @@
+// Copyright 2016 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef CORE_FXGE_INCLUDE_CFX_UNICODEENCODINGEX_H_
+#define CORE_FXGE_INCLUDE_CFX_UNICODEENCODINGEX_H_
+
+#include <map>
+#include <memory>
+#include <vector>
+
+#include "core/fxcrt/include/fx_system.h"
+#include "core/fxge/include/cfx_unicodeencoding.h"
+#include "core/fxge/include/fx_dib.h"
+#include "core/fxge/include/fx_freetype.h"
+
+class CFX_UnicodeEncodingEx : public CFX_UnicodeEncoding {
+ public:
+ CFX_UnicodeEncodingEx(CFX_Font* pFont, uint32_t EncodingID);
+ ~CFX_UnicodeEncodingEx() override;
+
+ // CFX_UnicodeEncoding:
+ uint32_t GlyphFromCharCode(uint32_t charcode) override;
+
+ uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const;
+
+ private:
+ uint32_t m_nEncodingID;
+};
+
+CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx(
+ CFX_Font* pFont,
+ uint32_t nEncodingID = FXFM_ENCODING_NONE);
+
+#endif // CORE_FXGE_INCLUDE_CFX_UNICODEENCODINGEX_H_
diff --git a/core/fxge/include/fx_font.h b/core/fxge/include/fx_font.h
index bb7632d1db..e6ffc6be4b 100644
--- a/core/fxge/include/fx_font.h
+++ b/core/fxge/include/fx_font.h
@@ -156,60 +156,6 @@ class CFX_Font {
FX_BOOL m_bVertical;
};
-#define ENCODING_INTERNAL 0
-#define ENCODING_UNICODE 1
-
-#ifdef PDF_ENABLE_XFA
-#define FXFM_ENC_TAG(a, b, c, d) \
- (((uint32_t)(a) << 24) | ((uint32_t)(b) << 16) | ((uint32_t)(c) << 8) | \
- (uint32_t)(d))
-#define FXFM_ENCODING_NONE FXFM_ENC_TAG(0, 0, 0, 0)
-#define FXFM_ENCODING_MS_SYMBOL FXFM_ENC_TAG('s', 'y', 'm', 'b')
-#define FXFM_ENCODING_UNICODE FXFM_ENC_TAG('u', 'n', 'i', 'c')
-#define FXFM_ENCODING_MS_SJIS FXFM_ENC_TAG('s', 'j', 'i', 's')
-#define FXFM_ENCODING_MS_GB2312 FXFM_ENC_TAG('g', 'b', ' ', ' ')
-#define FXFM_ENCODING_MS_BIG5 FXFM_ENC_TAG('b', 'i', 'g', '5')
-#define FXFM_ENCODING_MS_WANSUNG FXFM_ENC_TAG('w', 'a', 'n', 's')
-#define FXFM_ENCODING_MS_JOHAB FXFM_ENC_TAG('j', 'o', 'h', 'a')
-#define FXFM_ENCODING_ADOBE_STANDARD FXFM_ENC_TAG('A', 'D', 'O', 'B')
-#define FXFM_ENCODING_ADOBE_EXPERT FXFM_ENC_TAG('A', 'D', 'B', 'E')
-#define FXFM_ENCODING_ADOBE_CUSTOM FXFM_ENC_TAG('A', 'D', 'B', 'C')
-#define FXFM_ENCODING_ADOBE_LATIN_1 FXFM_ENC_TAG('l', 'a', 't', '1')
-#define FXFM_ENCODING_OLD_LATIN_2 FXFM_ENC_TAG('l', 'a', 't', '2')
-#define FXFM_ENCODING_APPLE_ROMAN FXFM_ENC_TAG('a', 'r', 'm', 'n')
-#endif // PDF_ENABLE_XFA
-
-class CFX_UnicodeEncoding {
- public:
- explicit CFX_UnicodeEncoding(CFX_Font* pFont);
- virtual ~CFX_UnicodeEncoding();
-
- virtual uint32_t GlyphFromCharCode(uint32_t charcode);
-
- protected:
- // Unowned, not nullptr.
- CFX_Font* m_pFont;
-};
-
-#ifdef PDF_ENABLE_XFA
-class CFX_UnicodeEncodingEx : public CFX_UnicodeEncoding {
- public:
- CFX_UnicodeEncodingEx(CFX_Font* pFont, uint32_t EncodingID);
- ~CFX_UnicodeEncodingEx() override;
-
- // CFX_UnicodeEncoding:
- uint32_t GlyphFromCharCode(uint32_t charcode) override;
-
- uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const;
-
- private:
- uint32_t m_nEncodingID;
-};
-CFX_UnicodeEncodingEx* FX_CreateFontEncodingEx(
- CFX_Font* pFont,
- uint32_t nEncodingID = FXFM_ENCODING_NONE);
-#endif // PDF_ENABLE_XFA
-
#define FXFONT_SUBST_MM 0x01
#define FXFONT_SUBST_GLYPHPATH 0x04
#define FXFONT_SUBST_CLEARTYPE 0x08
diff --git a/pdfium.gyp b/pdfium.gyp
index d8343944fb..148c319eda 100644
--- a/pdfium.gyp
+++ b/pdfium.gyp
@@ -746,6 +746,7 @@
'core/fxge/ge/cfx_graphstatedata.cpp',
'core/fxge/ge/cfx_pathdata.cpp',
'core/fxge/ge/cfx_renderdevice.cpp',
+ 'core/fxge/ge/cfx_unicodeencoding.cpp',
'core/fxge/ge/include/cfx_fontmapper.h',
'core/fxge/ge/include/cfx_fontmgr.h',
'core/fxge/ge/include/ifx_systemfontinfo.h',
@@ -762,6 +763,7 @@
'core/fxge/include/cfx_graphstatedata.h',
'core/fxge/include/cfx_pathdata.h',
'core/fxge/include/cfx_renderdevice.h',
+ 'core/fxge/include/cfx_unicodeencoding.h',
'core/fxge/include/cfx_windowsdevice.h',
'core/fxge/include/fx_dib.h',
'core/fxge/include/fx_font.h',
@@ -776,6 +778,12 @@
],
},
'conditions': [
+ ['pdf_enable_xfa==1', {
+ 'sources': [
+ 'core/fxge/ge/cfx_unicodeencodingex.cpp',
+ 'core/fxge/include/cfx_unicodeencodingex.h',
+ ]
+ }],
['pdf_use_skia==1', {
'sources': [
'core/fxge/skia/fx_skia_device.cpp',
diff --git a/xfa/fgas/font/fgas_gefont.cpp b/xfa/fgas/font/fgas_gefont.cpp
index 7492de246b..3a5b1cdbca 100644
--- a/xfa/fgas/font/fgas_gefont.cpp
+++ b/xfa/fgas/font/fgas_gefont.cpp
@@ -6,6 +6,8 @@
#include "xfa/fgas/font/fgas_gefont.h"
+#include "core/fxge/include/cfx_unicodeencoding.h"
+#include "core/fxge/include/cfx_unicodeencodingex.h"
#include "xfa/fgas/crt/fgas_codepage.h"
#include "xfa/fgas/font/fgas_fontutils.h"
#include "xfa/fxfa/include/xfa_fontmgr.h"
diff --git a/xfa/fgas/font/fgas_gefont.h b/xfa/fgas/font/fgas_gefont.h
index 37aa03eda9..cdb19338a2 100644
--- a/xfa/fgas/font/fgas_gefont.h
+++ b/xfa/fgas/font/fgas_gefont.h
@@ -15,6 +15,7 @@
#define FXFONT_SUBST_ITALIC 0x02
+class CFX_UnicodeEncoding;
class CXFA_PDFFontMgr;
class CFGAS_GEFont {
diff --git a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
index 6a914a91dc..5f10e842ac 100644
--- a/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
+++ b/xfa/fxbarcode/oned/BC_OneDimWriter.cpp
@@ -30,6 +30,7 @@
#include "core/fxge/include/cfx_graphstatedata.h"
#include "core/fxge/include/cfx_pathdata.h"
#include "core/fxge/include/cfx_renderdevice.h"
+#include "core/fxge/include/cfx_unicodeencodingex.h"
#include "xfa/fxbarcode/BC_Writer.h"
#include "xfa/fxbarcode/common/BC_CommonBitMatrix.h"
diff --git a/xfa/fxgraphics/cfx_graphics.cpp b/xfa/fxgraphics/cfx_graphics.cpp
index 083ef7bff4..068ed015f4 100644
--- a/xfa/fxgraphics/cfx_graphics.cpp
+++ b/xfa/fxgraphics/cfx_graphics.cpp
@@ -11,6 +11,7 @@
#include "core/fxge/include/cfx_fxgedevice.h"
#include "core/fxge/include/cfx_gemodule.h"
#include "core/fxge/include/cfx_renderdevice.h"
+#include "core/fxge/include/cfx_unicodeencoding.h"
#include "xfa/fxgraphics/cagg_graphics.h"
#include "xfa/fxgraphics/cfx_color.h"
#include "xfa/fxgraphics/cfx_path.h"