summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/include
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfdoc/include')
-rw-r--r--core/fpdfdoc/include/cpdf_variabletext.h253
-rw-r--r--core/fpdfdoc/include/cpvt_line.h26
-rw-r--r--core/fpdfdoc/include/cpvt_secprops.h30
-rw-r--r--core/fpdfdoc/include/cpvt_section.h22
-rw-r--r--core/fpdfdoc/include/cpvt_word.h37
-rw-r--r--core/fpdfdoc/include/cpvt_wordplace.h73
-rw-r--r--core/fpdfdoc/include/cpvt_wordprops.h58
-rw-r--r--core/fpdfdoc/include/cpvt_wordrange.h59
-rw-r--r--core/fpdfdoc/include/ipvt_fontmap.h29
9 files changed, 587 insertions, 0 deletions
diff --git a/core/fpdfdoc/include/cpdf_variabletext.h b/core/fpdfdoc/include/cpdf_variabletext.h
new file mode 100644
index 0000000000..b73d3df8c1
--- /dev/null
+++ b/core/fpdfdoc/include/cpdf_variabletext.h
@@ -0,0 +1,253 @@
+// 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_FPDFDOC_INCLUDE_CPDF_VARIABLETEXT_H_
+#define CORE_FPDFDOC_INCLUDE_CPDF_VARIABLETEXT_H_
+
+#include "core/fpdfdoc/cpvt_floatrect.h"
+#include "core/fpdfdoc/cpvt_lineinfo.h"
+#include "core/fpdfdoc/include/cpvt_line.h"
+#include "core/fpdfdoc/include/cpvt_wordplace.h"
+#include "core/fpdfdoc/include/cpvt_wordrange.h"
+#include "core/fpdfdoc/pdf_vt.h"
+#include "core/fxcrt/include/fx_coordinates.h"
+#include "core/fxcrt/include/fx_string.h"
+#include "core/fxcrt/include/fx_system.h"
+
+class CSection;
+class IPVT_FontMap;
+
+struct CPVT_SecProps;
+struct CPVT_Section;
+struct CPVT_SectionInfo;
+struct CPVT_Word;
+struct CPVT_WordProps;
+struct CPVT_WordInfo;
+
+#define VARIABLETEXT_HALF 0.5f
+
+class CPDF_VariableText : private CPDF_EditContainer {
+ public:
+ enum class ScriptType { Normal, Super, Sub };
+
+ class Iterator {
+ public:
+ explicit Iterator(CPDF_VariableText* pVT);
+ ~Iterator();
+
+ FX_BOOL NextWord();
+ FX_BOOL PrevWord();
+ FX_BOOL NextLine();
+ FX_BOOL PrevLine();
+ FX_BOOL NextSection();
+ FX_BOOL PrevSection();
+ FX_BOOL SetWord(const CPVT_Word& word);
+ FX_BOOL GetWord(CPVT_Word& word) const;
+ FX_BOOL GetLine(CPVT_Line& line) const;
+ FX_BOOL GetSection(CPVT_Section& section) const;
+ FX_BOOL SetSection(const CPVT_Section& section);
+ void SetAt(int32_t nWordIndex);
+ void SetAt(const CPVT_WordPlace& place);
+ const CPVT_WordPlace& GetAt() const { return m_CurPos; }
+
+ private:
+ CPVT_WordPlace m_CurPos;
+ CPDF_VariableText* const m_pVT;
+ };
+
+ class Provider {
+ public:
+ Provider(IPVT_FontMap* pFontMap);
+ virtual ~Provider();
+
+ virtual int32_t GetCharWidth(int32_t nFontIndex,
+ uint16_t word,
+ int32_t nWordStyle);
+ virtual int32_t GetTypeAscent(int32_t nFontIndex);
+ virtual int32_t GetTypeDescent(int32_t nFontIndex);
+ virtual int32_t GetWordFontIndex(uint16_t word,
+ int32_t charset,
+ int32_t nFontIndex);
+ virtual FX_BOOL IsLatinWord(uint16_t word);
+ virtual int32_t GetDefaultFontIndex();
+
+ private:
+ IPVT_FontMap* m_pFontMap;
+ };
+
+ CPDF_VariableText();
+ virtual ~CPDF_VariableText();
+
+ CPDF_VariableText::Provider* SetProvider(
+ CPDF_VariableText::Provider* pProvider);
+ CPDF_VariableText::Iterator* GetIterator();
+
+ // CPDF_EditContainer.
+ void SetPlateRect(const CFX_FloatRect& rect) override {
+ CPDF_EditContainer::SetPlateRect(rect);
+ }
+ CFX_FloatRect GetContentRect() const override;
+ const CFX_FloatRect& GetPlateRect() const override {
+ return CPDF_EditContainer::GetPlateRect();
+ }
+
+ void SetAlignment(int32_t nFormat = 0) { m_nAlignment = nFormat; }
+ void SetPasswordChar(uint16_t wSubWord = '*') { m_wSubWord = wSubWord; }
+ void SetLimitChar(int32_t nLimitChar = 0) { m_nLimitChar = nLimitChar; }
+ void SetCharSpace(FX_FLOAT fCharSpace = 0.0f) { m_fCharSpace = fCharSpace; }
+ void SetHorzScale(int32_t nHorzScale = 100) { m_nHorzScale = nHorzScale; }
+ void SetMultiLine(FX_BOOL bMultiLine = TRUE) { m_bMultiLine = bMultiLine; }
+ void SetAutoReturn(FX_BOOL bAuto = TRUE) { m_bLimitWidth = bAuto; }
+ void SetFontSize(FX_FLOAT fFontSize) { m_fFontSize = fFontSize; }
+ void SetCharArray(int32_t nCharArray = 0) { m_nCharArray = nCharArray; }
+ void SetAutoFontSize(FX_BOOL bAuto = TRUE) { m_bAutoFontSize = bAuto; }
+ void SetRichText(FX_BOOL bRichText) { m_bRichText = bRichText; }
+ void SetLineLeading(FX_FLOAT fLineLeading) { m_fLineLeading = fLineLeading; }
+ void Initialize();
+ FX_BOOL IsValid() const { return m_bInitial; }
+ FX_BOOL IsRichText() const { return m_bRichText; }
+ void RearrangeAll();
+ void RearrangePart(const CPVT_WordRange& PlaceRange);
+ void ResetAll();
+ void SetText(const FX_WCHAR* text,
+ int32_t charset = 1,
+ const CPVT_SecProps* pSecProps = NULL,
+ const CPVT_WordProps* pWordProps = NULL);
+ CPVT_WordPlace InsertWord(const CPVT_WordPlace& place,
+ uint16_t word,
+ int32_t charset = 1,
+ const CPVT_WordProps* pWordProps = NULL);
+ CPVT_WordPlace InsertSection(const CPVT_WordPlace& place,
+ const CPVT_SecProps* pSecProps = NULL,
+ const CPVT_WordProps* pWordProps = NULL);
+ CPVT_WordPlace InsertText(const CPVT_WordPlace& place,
+ const FX_WCHAR* text,
+ int32_t charset = 1,
+ const CPVT_SecProps* pSecProps = NULL,
+ const CPVT_WordProps* pWordProps = NULL);
+ CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange);
+ CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place);
+ CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place);
+
+ int32_t GetTotalWords() const;
+ FX_FLOAT GetFontSize() const { return m_fFontSize; }
+ int32_t GetAlignment() const { return m_nAlignment; }
+ uint16_t GetPasswordChar() const { return GetSubWord(); }
+ int32_t GetCharArray() const { return m_nCharArray; }
+ int32_t GetLimitChar() const { return m_nLimitChar; }
+ FX_BOOL IsMultiLine() const { return m_bMultiLine; }
+ int32_t GetHorzScale() const { return m_nHorzScale; }
+ FX_FLOAT GetCharSpace() const { return m_fCharSpace; }
+ CPVT_WordPlace GetBeginWordPlace() const;
+ CPVT_WordPlace GetEndWordPlace() const;
+ CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const;
+ CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const;
+ CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const;
+ CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place,
+ const CFX_FloatPoint& point) const;
+ CPVT_WordPlace GetDownWordPlace(const CPVT_WordPlace& place,
+ const CFX_FloatPoint& point) const;
+ CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const;
+ CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const;
+ CPVT_WordPlace GetSectionBeginPlace(const CPVT_WordPlace& place) const;
+ CPVT_WordPlace GetSectionEndPlace(const CPVT_WordPlace& place) const;
+ void UpdateWordPlace(CPVT_WordPlace& place) const;
+ CPVT_WordPlace AdjustLineHeader(const CPVT_WordPlace& place,
+ FX_BOOL bPrevOrNext) const;
+ int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const;
+ CPVT_WordPlace WordIndexToWordPlace(int32_t index) const;
+
+ uint16_t GetSubWord() const { return m_wSubWord; }
+
+ private:
+ friend class CTypeset;
+ friend class CSection;
+
+ int32_t GetCharWidth(int32_t nFontIndex,
+ uint16_t Word,
+ uint16_t SubWord,
+ int32_t nWordStyle);
+ int32_t GetTypeAscent(int32_t nFontIndex);
+ int32_t GetTypeDescent(int32_t nFontIndex);
+ int32_t GetWordFontIndex(uint16_t word, int32_t charset, int32_t nFontIndex);
+ int32_t GetDefaultFontIndex();
+ FX_BOOL IsLatinWord(uint16_t word);
+
+ CPVT_WordPlace AddSection(const CPVT_WordPlace& place,
+ const CPVT_SectionInfo& secinfo);
+ CPVT_WordPlace AddLine(const CPVT_WordPlace& place,
+ const CPVT_LineInfo& lineinfo);
+ CPVT_WordPlace AddWord(const CPVT_WordPlace& place,
+ const CPVT_WordInfo& wordinfo);
+ FX_BOOL GetWordInfo(const CPVT_WordPlace& place, CPVT_WordInfo& wordinfo);
+ FX_BOOL SetWordInfo(const CPVT_WordPlace& place,
+ const CPVT_WordInfo& wordinfo);
+ FX_BOOL GetLineInfo(const CPVT_WordPlace& place, CPVT_LineInfo& lineinfo);
+ FX_BOOL GetSectionInfo(const CPVT_WordPlace& place,
+ CPVT_SectionInfo& secinfo);
+ FX_FLOAT GetWordFontSize(const CPVT_WordInfo& WordInfo,
+ FX_BOOL bFactFontSize = FALSE);
+ FX_FLOAT GetWordWidth(int32_t nFontIndex,
+ uint16_t Word,
+ uint16_t SubWord,
+ FX_FLOAT fCharSpace,
+ int32_t nHorzScale,
+ FX_FLOAT fFontSize,
+ FX_FLOAT fWordTail,
+ int32_t nWordStyle);
+ FX_FLOAT GetWordWidth(const CPVT_WordInfo& WordInfo);
+ FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize);
+ FX_FLOAT GetWordDescent(const CPVT_WordInfo& WordInfo, FX_FLOAT fFontSize);
+ FX_FLOAT GetWordAscent(const CPVT_WordInfo& WordInfo,
+ FX_BOOL bFactFontSize = FALSE);
+ FX_FLOAT GetWordDescent(const CPVT_WordInfo& WordInfo,
+ FX_BOOL bFactFontSize = FALSE);
+ FX_FLOAT GetLineAscent(const CPVT_SectionInfo& SecInfo);
+ FX_FLOAT GetLineDescent(const CPVT_SectionInfo& SecInfo);
+ FX_FLOAT GetFontAscent(int32_t nFontIndex, FX_FLOAT fFontSize);
+ FX_FLOAT GetFontDescent(int32_t nFontIndex, FX_FLOAT fFontSize);
+ int32_t GetWordFontIndex(const CPVT_WordInfo& WordInfo);
+ FX_FLOAT GetCharSpace(const CPVT_WordInfo& WordInfo);
+ int32_t GetHorzScale(const CPVT_WordInfo& WordInfo);
+ FX_FLOAT GetLineLeading(const CPVT_SectionInfo& SecInfo);
+ FX_FLOAT GetLineIndent(const CPVT_SectionInfo& SecInfo);
+ int32_t GetAlignment(const CPVT_SectionInfo& SecInfo);
+
+ void ClearSectionRightWords(const CPVT_WordPlace& place);
+
+ FX_BOOL ClearEmptySection(const CPVT_WordPlace& place);
+ void ClearEmptySections(const CPVT_WordRange& PlaceRange);
+ void LinkLatterSection(const CPVT_WordPlace& place);
+ void ClearWords(const CPVT_WordRange& PlaceRange);
+ CPVT_WordPlace ClearLeftWord(const CPVT_WordPlace& place);
+ CPVT_WordPlace ClearRightWord(const CPVT_WordPlace& place);
+
+ CPVT_FloatRect Rearrange(const CPVT_WordRange& PlaceRange);
+ FX_FLOAT GetAutoFontSize();
+ FX_BOOL IsBigger(FX_FLOAT fFontSize);
+ CPVT_FloatRect RearrangeSections(const CPVT_WordRange& PlaceRange);
+
+ void ResetSectionArray();
+
+ CPVT_ArrayTemplate<CSection*> m_SectionArray;
+ int32_t m_nLimitChar;
+ int32_t m_nCharArray;
+ FX_BOOL m_bMultiLine;
+ FX_BOOL m_bLimitWidth;
+ FX_BOOL m_bAutoFontSize;
+ int32_t m_nAlignment;
+ FX_FLOAT m_fLineLeading;
+ FX_FLOAT m_fCharSpace;
+ int32_t m_nHorzScale;
+ uint16_t m_wSubWord;
+ FX_FLOAT m_fFontSize;
+ FX_BOOL m_bInitial;
+ FX_BOOL m_bRichText;
+ CPDF_VariableText::Provider* m_pVTProvider;
+ CPDF_VariableText::Iterator* m_pVTIterator;
+};
+
+#endif // CORE_FPDFDOC_INCLUDE_CPDF_VARIABLETEXT_H_
diff --git a/core/fpdfdoc/include/cpvt_line.h b/core/fpdfdoc/include/cpvt_line.h
new file mode 100644
index 0000000000..ea0f899e19
--- /dev/null
+++ b/core/fpdfdoc/include/cpvt_line.h
@@ -0,0 +1,26 @@
+// 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_FPDFDOC_INCLUDE_CPVT_LINE_H_
+#define CORE_FPDFDOC_INCLUDE_CPVT_LINE_H_
+
+#include "core/fpdfdoc/include/cpvt_wordplace.h"
+#include "core/fxcrt/include/fx_coordinates.h"
+#include "core/fxcrt/include/fx_system.h"
+
+struct CPVT_Line {
+ CPVT_Line()
+ : ptLine(0, 0), fLineWidth(0.0f), fLineAscent(0.0f), fLineDescent(0.0f) {}
+
+ CPVT_WordPlace lineplace;
+ CPVT_WordPlace lineEnd;
+ CFX_FloatPoint ptLine;
+ FX_FLOAT fLineWidth;
+ FX_FLOAT fLineAscent;
+ FX_FLOAT fLineDescent;
+};
+
+#endif // CORE_FPDFDOC_INCLUDE_CPVT_LINE_H_
diff --git a/core/fpdfdoc/include/cpvt_secprops.h b/core/fpdfdoc/include/cpvt_secprops.h
new file mode 100644
index 0000000000..67878f8625
--- /dev/null
+++ b/core/fpdfdoc/include/cpvt_secprops.h
@@ -0,0 +1,30 @@
+// 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_FPDFDOC_INCLUDE_CPVT_SECPROPS_H_
+#define CORE_FPDFDOC_INCLUDE_CPVT_SECPROPS_H_
+
+#include "core/fxcrt/include/fx_system.h"
+
+struct CPVT_SecProps {
+ CPVT_SecProps() : fLineLeading(0.0f), fLineIndent(0.0f), nAlignment(0) {}
+
+ CPVT_SecProps(FX_FLOAT lineLeading, FX_FLOAT lineIndent, int32_t alignment)
+ : fLineLeading(lineLeading),
+ fLineIndent(lineIndent),
+ nAlignment(alignment) {}
+
+ CPVT_SecProps(const CPVT_SecProps& other)
+ : fLineLeading(other.fLineLeading),
+ fLineIndent(other.fLineIndent),
+ nAlignment(other.nAlignment) {}
+
+ FX_FLOAT fLineLeading;
+ FX_FLOAT fLineIndent;
+ int32_t nAlignment;
+};
+
+#endif // CORE_FPDFDOC_INCLUDE_CPVT_SECPROPS_H_
diff --git a/core/fpdfdoc/include/cpvt_section.h b/core/fpdfdoc/include/cpvt_section.h
new file mode 100644
index 0000000000..a9820bd5f9
--- /dev/null
+++ b/core/fpdfdoc/include/cpvt_section.h
@@ -0,0 +1,22 @@
+// 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_FPDFDOC_INCLUDE_CPVT_SECTION_H_
+#define CORE_FPDFDOC_INCLUDE_CPVT_SECTION_H_
+
+#include "core/fpdfdoc/include/cpvt_secprops.h"
+#include "core/fpdfdoc/include/cpvt_wordplace.h"
+#include "core/fpdfdoc/include/cpvt_wordprops.h"
+#include "core/fxcrt/include/fx_coordinates.h"
+
+struct CPVT_Section {
+ CPVT_WordPlace secplace;
+ CFX_FloatRect rcSection;
+ CPVT_SecProps SecProps;
+ CPVT_WordProps WordProps;
+};
+
+#endif // CORE_FPDFDOC_INCLUDE_CPVT_SECTION_H_
diff --git a/core/fpdfdoc/include/cpvt_word.h b/core/fpdfdoc/include/cpvt_word.h
new file mode 100644
index 0000000000..7d022dda5d
--- /dev/null
+++ b/core/fpdfdoc/include/cpvt_word.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_FPDFDOC_INCLUDE_CPVT_WORD_H_
+#define CORE_FPDFDOC_INCLUDE_CPVT_WORD_H_
+
+#include "core/fpdfdoc/include/cpvt_wordplace.h"
+#include "core/fpdfdoc/include/cpvt_wordprops.h"
+#include "core/fxcrt/include/fx_system.h"
+
+struct CPVT_Word {
+ CPVT_Word()
+ : Word(0),
+ nCharset(0),
+ ptWord(0, 0),
+ fAscent(0.0f),
+ fDescent(0.0f),
+ fWidth(0.0f),
+ fFontSize(0),
+ WordProps() {}
+
+ uint16_t Word;
+ int32_t nCharset;
+ CPVT_WordPlace WordPlace;
+ CFX_FloatPoint ptWord;
+ FX_FLOAT fAscent;
+ FX_FLOAT fDescent;
+ FX_FLOAT fWidth;
+ int32_t nFontIndex;
+ FX_FLOAT fFontSize;
+ CPVT_WordProps WordProps;
+};
+
+#endif // CORE_FPDFDOC_INCLUDE_CPVT_WORD_H_
diff --git a/core/fpdfdoc/include/cpvt_wordplace.h b/core/fpdfdoc/include/cpvt_wordplace.h
new file mode 100644
index 0000000000..ef7907797e
--- /dev/null
+++ b/core/fpdfdoc/include/cpvt_wordplace.h
@@ -0,0 +1,73 @@
+// 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_FPDFDOC_INCLUDE_CPVT_WORDPLACE_H_
+#define CORE_FPDFDOC_INCLUDE_CPVT_WORDPLACE_H_
+
+#include "core/fxcrt/include/fx_system.h"
+
+struct CPVT_WordPlace {
+ CPVT_WordPlace() : nSecIndex(-1), nLineIndex(-1), nWordIndex(-1) {}
+
+ CPVT_WordPlace(int32_t other_nSecIndex,
+ int32_t other_nLineIndex,
+ int32_t other_nWordIndex) {
+ nSecIndex = other_nSecIndex;
+ nLineIndex = other_nLineIndex;
+ nWordIndex = other_nWordIndex;
+ }
+
+ void Default() { nSecIndex = nLineIndex = nWordIndex = -1; }
+
+ bool operator==(const CPVT_WordPlace& wp) const {
+ return wp.nSecIndex == nSecIndex && wp.nLineIndex == nLineIndex &&
+ wp.nWordIndex == nWordIndex;
+ }
+
+ FX_BOOL operator!=(const CPVT_WordPlace& wp) const { return !(*this == wp); }
+
+ inline int32_t WordCmp(const CPVT_WordPlace& wp) const {
+ if (nSecIndex > wp.nSecIndex)
+ return 1;
+ if (nSecIndex < wp.nSecIndex)
+ return -1;
+ if (nLineIndex > wp.nLineIndex)
+ return 1;
+ if (nLineIndex < wp.nLineIndex)
+ return -1;
+ if (nWordIndex > wp.nWordIndex)
+ return 1;
+ if (nWordIndex < wp.nWordIndex)
+ return -1;
+ return 0;
+ }
+
+ inline int32_t LineCmp(const CPVT_WordPlace& wp) const {
+ if (nSecIndex > wp.nSecIndex)
+ return 1;
+ if (nSecIndex < wp.nSecIndex)
+ return -1;
+ if (nLineIndex > wp.nLineIndex)
+ return 1;
+ if (nLineIndex < wp.nLineIndex)
+ return -1;
+ return 0;
+ }
+
+ inline int32_t SecCmp(const CPVT_WordPlace& wp) const {
+ if (nSecIndex > wp.nSecIndex)
+ return 1;
+ if (nSecIndex < wp.nSecIndex)
+ return -1;
+ return 0;
+ }
+
+ int32_t nSecIndex;
+ int32_t nLineIndex;
+ int32_t nWordIndex;
+};
+
+#endif // CORE_FPDFDOC_INCLUDE_CPVT_WORDPLACE_H_
diff --git a/core/fpdfdoc/include/cpvt_wordprops.h b/core/fpdfdoc/include/cpvt_wordprops.h
new file mode 100644
index 0000000000..e091579239
--- /dev/null
+++ b/core/fpdfdoc/include/cpvt_wordprops.h
@@ -0,0 +1,58 @@
+// 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_FPDFDOC_INCLUDE_CPVT_WORDPROPS_H_
+#define CORE_FPDFDOC_INCLUDE_CPVT_WORDPROPS_H_
+
+#include "core/fpdfdoc/include/cpdf_variabletext.h"
+#include "core/fxcrt/include/fx_system.h"
+#include "core/include/fxge/fx_dib.h"
+
+struct CPVT_WordProps {
+ CPVT_WordProps()
+ : nFontIndex(-1),
+ fFontSize(0.0f),
+ dwWordColor(0),
+ nScriptType(CPDF_VariableText::ScriptType::Normal),
+ nWordStyle(0),
+ fCharSpace(0.0f),
+ nHorzScale(0) {}
+
+ CPVT_WordProps(int32_t fontIndex,
+ FX_FLOAT fontSize,
+ FX_COLORREF wordColor = 0,
+ CPDF_VariableText::ScriptType scriptType =
+ CPDF_VariableText::ScriptType::Normal,
+ int32_t wordStyle = 0,
+ FX_FLOAT charSpace = 0,
+ int32_t horzScale = 100)
+ : nFontIndex(fontIndex),
+ fFontSize(fontSize),
+ dwWordColor(wordColor),
+ nScriptType(scriptType),
+ nWordStyle(wordStyle),
+ fCharSpace(charSpace),
+ nHorzScale(horzScale) {}
+
+ CPVT_WordProps(const CPVT_WordProps& other)
+ : nFontIndex(other.nFontIndex),
+ fFontSize(other.fFontSize),
+ dwWordColor(other.dwWordColor),
+ nScriptType(other.nScriptType),
+ nWordStyle(other.nWordStyle),
+ fCharSpace(other.fCharSpace),
+ nHorzScale(other.nHorzScale) {}
+
+ int32_t nFontIndex;
+ FX_FLOAT fFontSize;
+ FX_COLORREF dwWordColor;
+ CPDF_VariableText::ScriptType nScriptType;
+ int32_t nWordStyle;
+ FX_FLOAT fCharSpace;
+ int32_t nHorzScale;
+};
+
+#endif // CORE_FPDFDOC_INCLUDE_CPVT_WORDPROPS_H_
diff --git a/core/fpdfdoc/include/cpvt_wordrange.h b/core/fpdfdoc/include/cpvt_wordrange.h
new file mode 100644
index 0000000000..3c6f05b159
--- /dev/null
+++ b/core/fpdfdoc/include/cpvt_wordrange.h
@@ -0,0 +1,59 @@
+// 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_FPDFDOC_INCLUDE_CPVT_WORDRANGE_H_
+#define CORE_FPDFDOC_INCLUDE_CPVT_WORDRANGE_H_
+
+#include "core/fpdfdoc/include/cpvt_wordplace.h"
+#include "core/fxcrt/include/fx_system.h"
+
+struct CPVT_WordRange {
+ CPVT_WordRange() {}
+
+ CPVT_WordRange(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) {
+ Set(begin, end);
+ }
+
+ void Default() {
+ BeginPos.Default();
+ EndPos.Default();
+ }
+
+ void Set(const CPVT_WordPlace& begin, const CPVT_WordPlace& end) {
+ BeginPos = begin;
+ EndPos = end;
+ SwapWordPlace();
+ }
+
+ void SetBeginPos(const CPVT_WordPlace& begin) {
+ BeginPos = begin;
+ SwapWordPlace();
+ }
+
+ void SetEndPos(const CPVT_WordPlace& end) {
+ EndPos = end;
+ SwapWordPlace();
+ }
+
+ FX_BOOL IsExist() const { return BeginPos != EndPos; }
+
+ FX_BOOL operator!=(const CPVT_WordRange& wr) const {
+ return wr.BeginPos != BeginPos || wr.EndPos != EndPos;
+ }
+
+ void SwapWordPlace() {
+ if (BeginPos.WordCmp(EndPos) > 0) {
+ CPVT_WordPlace place = EndPos;
+ EndPos = BeginPos;
+ BeginPos = place;
+ }
+ }
+
+ CPVT_WordPlace BeginPos;
+ CPVT_WordPlace EndPos;
+};
+
+#endif // CORE_FPDFDOC_INCLUDE_CPVT_WORDRANGE_H_
diff --git a/core/fpdfdoc/include/ipvt_fontmap.h b/core/fpdfdoc/include/ipvt_fontmap.h
new file mode 100644
index 0000000000..9835d5ec12
--- /dev/null
+++ b/core/fpdfdoc/include/ipvt_fontmap.h
@@ -0,0 +1,29 @@
+// 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_FPDFDOC_INCLUDE_IPVT_FONTMAP_H_
+#define CORE_FPDFDOC_INCLUDE_IPVT_FONTMAP_H_
+
+#include <stdint.h>
+
+#include "core/fxcrt/include/fx_string.h"
+
+class CPDF_Font;
+
+class IPVT_FontMap {
+ public:
+ virtual ~IPVT_FontMap() {}
+
+ virtual CPDF_Font* GetPDFFont(int32_t nFontIndex) = 0;
+ virtual CFX_ByteString GetPDFFontAlias(int32_t nFontIndex) = 0;
+ virtual int32_t GetWordFontIndex(uint16_t word,
+ int32_t charset,
+ int32_t nFontIndex) = 0;
+ virtual int32_t CharCodeFromUnicode(int32_t nFontIndex, uint16_t word) = 0;
+ virtual int32_t CharSetFromUnicode(uint16_t word, int32_t nOldCharset) = 0;
+};
+
+#endif // CORE_FPDFDOC_INCLUDE_IPVT_FONTMAP_H_