From 166bc16e15a5be72fe19da97504b4837967333ff Mon Sep 17 00:00:00 2001 From: dsinclair Date: Thu, 29 Sep 2016 11:58:38 -0700 Subject: Move core/fpdfapi/fpdf_font/include to core/fpdfapi/fpdf_font BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2375283003 --- BUILD.gn | 4 +- core/fpdfapi/fpdf_font/cpdf_cidfont.cpp | 2 +- core/fpdfapi/fpdf_font/cpdf_cidfont.h | 2 +- core/fpdfapi/fpdf_font/cpdf_font.cpp | 4 +- core/fpdfapi/fpdf_font/cpdf_font.h | 132 +++++++++++++++++++++ core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp | 2 +- core/fpdfapi/fpdf_font/cpdf_fontencoding.h | 61 ++++++++++ core/fpdfapi/fpdf_font/cpdf_simplefont.h | 4 +- core/fpdfapi/fpdf_font/include/cpdf_font.h | 132 --------------------- core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h | 61 ---------- core/fpdfapi/fpdf_page/cpdf_textobject.cpp | 2 +- core/fpdfapi/fpdf_page/cpdf_textstate.cpp | 2 +- core/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 2 +- core/fpdfapi/fpdf_parser/cpdf_document.cpp | 2 +- core/fpdfapi/fpdf_render/fpdf_render_text.cpp | 2 +- core/fpdfdoc/cpdf_interform.cpp | 4 +- core/fpdfdoc/cpdf_variabletext.cpp | 2 +- core/fpdfdoc/cpvt_fontmap.cpp | 2 +- core/fpdfdoc/cpvt_generateap.cpp | 2 +- core/fpdftext/cpdf_textpage.cpp | 2 +- core/fxge/ge/cfx_font.cpp | 2 +- core/fxge/ge/cfx_unicodeencodingex.cpp | 2 +- fpdfsdk/formfiller/DEPS | 2 +- fpdfsdk/formfiller/cba_fontmap.cpp | 2 +- fpdfsdk/fxedit/DEPS | 2 +- fpdfsdk/fxedit/fxet_ap.cpp | 2 +- fpdfsdk/fxedit/fxet_edit.cpp | 2 +- fpdfsdk/javascript/DEPS | 2 +- fpdfsdk/javascript/Document.cpp | 2 +- fpdfsdk/javascript/Field.cpp | 2 +- fpdfsdk/pdfwindow/DEPS | 2 +- fpdfsdk/pdfwindow/PWL_Edit.cpp | 2 +- fpdfsdk/pdfwindow/PWL_FontMap.cpp | 4 +- xfa/fxfa/app/DEPS | 2 +- xfa/fxfa/app/xfa_fontmgr.cpp | 2 +- 35 files changed, 229 insertions(+), 229 deletions(-) create mode 100644 core/fpdfapi/fpdf_font/cpdf_font.h create mode 100644 core/fpdfapi/fpdf_font/cpdf_fontencoding.h delete mode 100644 core/fpdfapi/fpdf_font/include/cpdf_font.h delete mode 100644 core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h diff --git a/BUILD.gn b/BUILD.gn index 5fb57192c3..bd36891a38 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -400,7 +400,9 @@ static_library("fpdfapi") { "core/fpdfapi/fpdf_font/cpdf_cidfont.cpp", "core/fpdfapi/fpdf_font/cpdf_cidfont.h", "core/fpdfapi/fpdf_font/cpdf_font.cpp", + "core/fpdfapi/fpdf_font/cpdf_font.h", "core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp", + "core/fpdfapi/fpdf_font/cpdf_fontencoding.h", "core/fpdfapi/fpdf_font/cpdf_simplefont.cpp", "core/fpdfapi/fpdf_font/cpdf_simplefont.h", "core/fpdfapi/fpdf_font/cpdf_truetypefont.cpp", @@ -414,8 +416,6 @@ static_library("fpdfapi") { "core/fpdfapi/fpdf_font/font_int.h", "core/fpdfapi/fpdf_font/fpdf_font.cpp", "core/fpdfapi/fpdf_font/fpdf_font_cid.cpp", - "core/fpdfapi/fpdf_font/include/cpdf_font.h", - "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h", "core/fpdfapi/fpdf_font/ttgsubtable.cpp", "core/fpdfapi/fpdf_font/ttgsubtable.h", "core/fpdfapi/fpdf_page/cpdf_allstates.cpp", diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp index dbad4e547a..03bf2c45fc 100644 --- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp @@ -10,8 +10,8 @@ #include #include "core/fpdfapi/fpdf_cmaps/cmap_int.h" +#include "core/fpdfapi/fpdf_font/cpdf_fontencoding.h" #include "core/fpdfapi/fpdf_font/font_int.h" -#include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" #include "core/fpdfapi/fpdf_font/ttgsubtable.h" #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.h b/core/fpdfapi/fpdf_font/cpdf_cidfont.h index 400bcca8c6..c79e97bdf2 100644 --- a/core/fpdfapi/fpdf_font/cpdf_cidfont.h +++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.h @@ -9,7 +9,7 @@ #include -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" diff --git a/core/fpdfapi/fpdf_font/cpdf_font.cpp b/core/fpdfapi/fpdf_font/cpdf_font.cpp index 5d89752714..15fb4c5add 100644 --- a/core/fpdfapi/fpdf_font/cpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_font.cpp @@ -4,16 +4,16 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include #include +#include "core/fpdfapi/fpdf_font/cpdf_fontencoding.h" #include "core/fpdfapi/fpdf_font/cpdf_truetypefont.h" #include "core/fpdfapi/fpdf_font/cpdf_type1font.h" #include "core/fpdfapi/fpdf_font/cpdf_type3font.h" #include "core/fpdfapi/fpdf_font/font_int.h" -#include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h" #include "core/fpdfapi/fpdf_page/pageint.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" diff --git a/core/fpdfapi/fpdf_font/cpdf_font.h b/core/fpdfapi/fpdf_font/cpdf_font.h new file mode 100644 index 0000000000..f94758c309 --- /dev/null +++ b/core/fpdfapi/fpdf_font/cpdf_font.h @@ -0,0 +1,132 @@ +// 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_FPDFAPI_FPDF_FONT_CPDF_FONT_H_ +#define CORE_FPDFAPI_FPDF_FONT_CPDF_FONT_H_ + +#include +#include + +#include "core/fxcrt/include/fx_string.h" +#include "core/fxcrt/include/fx_system.h" +#include "core/fxge/include/fx_font.h" + +#define PDFFONT_FIXEDPITCH 1 +#define PDFFONT_SERIF 2 +#define PDFFONT_SYMBOLIC 4 +#define PDFFONT_SCRIPT 8 +#define PDFFONT_NONSYMBOLIC 32 +#define PDFFONT_ITALIC 64 +#define PDFFONT_ALLCAP 0x10000 +#define PDFFONT_SMALLCAP 0x20000 +#define PDFFONT_FORCEBOLD 0x40000 +#define PDFFONT_USEEXTERNATTR 0x80000 + +class CFX_SubstFont; +class CPDF_CIDFont; +class CPDF_Dictionary; +class CPDF_Document; +class CPDF_Object; +class CPDF_StreamAcc; +class CPDF_TrueTypeFont; +class CPDF_Type1Font; +class CPDF_Type3Font; +class CPDF_ToUnicodeMap; + +class CPDF_Font { + public: + static std::unique_ptr Create(CPDF_Document* pDoc, + CPDF_Dictionary* pFontDict); + static CPDF_Font* GetStockFont(CPDF_Document* pDoc, + const CFX_ByteStringC& fontname); + static const uint32_t kInvalidCharCode = static_cast(-1); + + virtual ~CPDF_Font(); + + virtual bool IsType1Font() const; + virtual bool IsTrueTypeFont() const; + virtual bool IsType3Font() const; + virtual bool IsCIDFont() const; + virtual const CPDF_Type1Font* AsType1Font() const; + virtual CPDF_Type1Font* AsType1Font(); + virtual const CPDF_TrueTypeFont* AsTrueTypeFont() const; + virtual CPDF_TrueTypeFont* AsTrueTypeFont(); + virtual const CPDF_Type3Font* AsType3Font() const; + virtual CPDF_Type3Font* AsType3Font(); + virtual const CPDF_CIDFont* AsCIDFont() const; + virtual CPDF_CIDFont* AsCIDFont(); + + virtual bool IsVertWriting() const; + virtual bool IsUnicodeCompatible() const; + virtual uint32_t GetNextChar(const FX_CHAR* pString, + int nStrLen, + int& offset) const; + virtual int CountChar(const FX_CHAR* pString, int size) const; + virtual int AppendChar(FX_CHAR* buf, uint32_t charcode) const; + virtual int GetCharSize(uint32_t charcode) const; + virtual int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) = 0; + virtual int GlyphFromCharCodeExt(uint32_t charcode); + virtual CFX_WideString UnicodeFromCharCode(uint32_t charcode) const; + virtual uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const; + + const CFX_ByteString& GetBaseFont() const { return m_BaseFont; } + CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); } + uint32_t GetFlags() const { return m_Flags; } + bool IsEmbedded() const { return IsType3Font() || m_pFontFile != nullptr; } + CPDF_StreamAcc* GetFontFile() const { return m_pFontFile; } + CPDF_Dictionary* GetFontDict() const { return m_pFontDict; } + bool IsStandardFont() const; + FXFT_Face GetFace() const { return m_Font.GetFace(); } + void AppendChar(CFX_ByteString& str, uint32_t charcode) const; + + void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; } + int GetTypeAscent() const { return m_Ascent; } + int GetTypeDescent() const { return m_Descent; } + int GetItalicAngle() const { return m_ItalicAngle; } + int GetStemV() const { return m_StemV; } + int GetStringWidth(const FX_CHAR* pString, int size); + uint32_t FallbackFontFromCharcode(uint32_t charcode); + int FallbackGlyphFromCharcode(int fallbackFont, uint32_t charcode); + + virtual int GetCharWidthF(uint32_t charcode, int level = 0) = 0; + virtual FX_RECT GetCharBBox(uint32_t charcode, int level = 0) = 0; + + CPDF_Document* m_pDocument; + CFX_Font m_Font; + std::vector> m_FontFallbacks; + + protected: + CPDF_Font(); + + virtual bool Load() = 0; + + void LoadUnicodeMap() const; // logically const only. + void LoadPDFEncoding(CPDF_Object* pEncoding, + int& iBaseEncoding, + std::vector* pCharNames, + bool bEmbedded, + bool bTrueType); + void LoadFontDescriptor(CPDF_Dictionary* pDict); + void CheckFontMetrics(); + + const FX_CHAR* GetAdobeCharName(int iBaseEncoding, + const std::vector& charnames, + int charcode); + + CFX_ByteString m_BaseFont; + CPDF_StreamAcc* m_pFontFile; + CPDF_Dictionary* m_pFontDict; + mutable std::unique_ptr m_pToUnicodeMap; + mutable bool m_bToUnicodeLoaded; + int m_Flags; + FX_RECT m_FontBBox; + int m_StemV; + int m_Ascent; + int m_Descent; + int m_ItalicAngle; +}; + +#endif // CORE_FPDFAPI_FPDF_FONT_CPDF_FONT_H_ diff --git a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp index d0e5f16aea..dbe31b57c5 100644 --- a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" +#include "core/fpdfapi/fpdf_font/cpdf_fontencoding.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" diff --git a/core/fpdfapi/fpdf_font/cpdf_fontencoding.h b/core/fpdfapi/fpdf_font/cpdf_fontencoding.h new file mode 100644 index 0000000000..da0f262fc4 --- /dev/null +++ b/core/fpdfapi/fpdf_font/cpdf_fontencoding.h @@ -0,0 +1,61 @@ +// 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_FPDFAPI_FPDF_FONT_CPDF_FONTENCODING_H_ +#define CORE_FPDFAPI_FPDF_FONT_CPDF_FONTENCODING_H_ + +#include "core/fxcrt/include/cfx_string_pool_template.h" +#include "core/fxcrt/include/cfx_weak_ptr.h" +#include "core/fxcrt/include/fx_string.h" + +#define PDFFONT_ENCODING_BUILTIN 0 +#define PDFFONT_ENCODING_WINANSI 1 +#define PDFFONT_ENCODING_MACROMAN 2 +#define PDFFONT_ENCODING_MACEXPERT 3 +#define PDFFONT_ENCODING_STANDARD 4 +#define PDFFONT_ENCODING_ADOBE_SYMBOL 5 +#define PDFFONT_ENCODING_ZAPFDINGBATS 6 +#define PDFFONT_ENCODING_PDFDOC 7 +#define PDFFONT_ENCODING_MS_SYMBOL 8 +#define PDFFONT_ENCODING_UNICODE 9 + +uint32_t FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode); +FX_WCHAR FT_UnicodeFromCharCode(int encoding, uint32_t charcode); + +FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name); +CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode); + +const uint16_t* PDF_UnicodesForPredefinedCharSet(int encoding); +const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, + uint8_t charcode); + +class CPDF_Object; + +class CPDF_FontEncoding { + public: + CPDF_FontEncoding(); + explicit CPDF_FontEncoding(int PredefinedEncoding); + + void LoadEncoding(CPDF_Object* pEncoding); + + FX_BOOL IsIdentical(CPDF_FontEncoding* pAnother) const; + + FX_WCHAR UnicodeFromCharCode(uint8_t charcode) const { + return m_Unicodes[charcode]; + } + int CharCodeFromUnicode(FX_WCHAR unicode) const; + + void SetUnicode(uint8_t charcode, FX_WCHAR unicode) { + m_Unicodes[charcode] = unicode; + } + + CPDF_Object* Realize(CFX_WeakPtr pPool); + + public: + FX_WCHAR m_Unicodes[256]; +}; + +#endif // CORE_FPDFAPI_FPDF_FONT_CPDF_FONTENCODING_H_ diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.h b/core/fpdfapi/fpdf_font/cpdf_simplefont.h index 40a4baeeb8..0d4da46351 100644 --- a/core/fpdfapi/fpdf_font/cpdf_simplefont.h +++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.h @@ -9,8 +9,8 @@ #include -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" -#include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_fontencoding.h" #include "core/fxcrt/include/fx_string.h" #include "core/fxcrt/include/fx_system.h" diff --git a/core/fpdfapi/fpdf_font/include/cpdf_font.h b/core/fpdfapi/fpdf_font/include/cpdf_font.h deleted file mode 100644 index f3985546fe..0000000000 --- a/core/fpdfapi/fpdf_font/include/cpdf_font.h +++ /dev/null @@ -1,132 +0,0 @@ -// 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_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONT_H_ -#define CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONT_H_ - -#include -#include - -#include "core/fxcrt/include/fx_string.h" -#include "core/fxcrt/include/fx_system.h" -#include "core/fxge/include/fx_font.h" - -#define PDFFONT_FIXEDPITCH 1 -#define PDFFONT_SERIF 2 -#define PDFFONT_SYMBOLIC 4 -#define PDFFONT_SCRIPT 8 -#define PDFFONT_NONSYMBOLIC 32 -#define PDFFONT_ITALIC 64 -#define PDFFONT_ALLCAP 0x10000 -#define PDFFONT_SMALLCAP 0x20000 -#define PDFFONT_FORCEBOLD 0x40000 -#define PDFFONT_USEEXTERNATTR 0x80000 - -class CFX_SubstFont; -class CPDF_CIDFont; -class CPDF_Dictionary; -class CPDF_Document; -class CPDF_Object; -class CPDF_StreamAcc; -class CPDF_TrueTypeFont; -class CPDF_Type1Font; -class CPDF_Type3Font; -class CPDF_ToUnicodeMap; - -class CPDF_Font { - public: - static std::unique_ptr Create(CPDF_Document* pDoc, - CPDF_Dictionary* pFontDict); - static CPDF_Font* GetStockFont(CPDF_Document* pDoc, - const CFX_ByteStringC& fontname); - static const uint32_t kInvalidCharCode = static_cast(-1); - - virtual ~CPDF_Font(); - - virtual bool IsType1Font() const; - virtual bool IsTrueTypeFont() const; - virtual bool IsType3Font() const; - virtual bool IsCIDFont() const; - virtual const CPDF_Type1Font* AsType1Font() const; - virtual CPDF_Type1Font* AsType1Font(); - virtual const CPDF_TrueTypeFont* AsTrueTypeFont() const; - virtual CPDF_TrueTypeFont* AsTrueTypeFont(); - virtual const CPDF_Type3Font* AsType3Font() const; - virtual CPDF_Type3Font* AsType3Font(); - virtual const CPDF_CIDFont* AsCIDFont() const; - virtual CPDF_CIDFont* AsCIDFont(); - - virtual bool IsVertWriting() const; - virtual bool IsUnicodeCompatible() const; - virtual uint32_t GetNextChar(const FX_CHAR* pString, - int nStrLen, - int& offset) const; - virtual int CountChar(const FX_CHAR* pString, int size) const; - virtual int AppendChar(FX_CHAR* buf, uint32_t charcode) const; - virtual int GetCharSize(uint32_t charcode) const; - virtual int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) = 0; - virtual int GlyphFromCharCodeExt(uint32_t charcode); - virtual CFX_WideString UnicodeFromCharCode(uint32_t charcode) const; - virtual uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const; - - const CFX_ByteString& GetBaseFont() const { return m_BaseFont; } - CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); } - uint32_t GetFlags() const { return m_Flags; } - bool IsEmbedded() const { return IsType3Font() || m_pFontFile != nullptr; } - CPDF_StreamAcc* GetFontFile() const { return m_pFontFile; } - CPDF_Dictionary* GetFontDict() const { return m_pFontDict; } - bool IsStandardFont() const; - FXFT_Face GetFace() const { return m_Font.GetFace(); } - void AppendChar(CFX_ByteString& str, uint32_t charcode) const; - - void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; } - int GetTypeAscent() const { return m_Ascent; } - int GetTypeDescent() const { return m_Descent; } - int GetItalicAngle() const { return m_ItalicAngle; } - int GetStemV() const { return m_StemV; } - int GetStringWidth(const FX_CHAR* pString, int size); - uint32_t FallbackFontFromCharcode(uint32_t charcode); - int FallbackGlyphFromCharcode(int fallbackFont, uint32_t charcode); - - virtual int GetCharWidthF(uint32_t charcode, int level = 0) = 0; - virtual FX_RECT GetCharBBox(uint32_t charcode, int level = 0) = 0; - - CPDF_Document* m_pDocument; - CFX_Font m_Font; - std::vector> m_FontFallbacks; - - protected: - CPDF_Font(); - - virtual bool Load() = 0; - - void LoadUnicodeMap() const; // logically const only. - void LoadPDFEncoding(CPDF_Object* pEncoding, - int& iBaseEncoding, - std::vector* pCharNames, - bool bEmbedded, - bool bTrueType); - void LoadFontDescriptor(CPDF_Dictionary* pDict); - void CheckFontMetrics(); - - const FX_CHAR* GetAdobeCharName(int iBaseEncoding, - const std::vector& charnames, - int charcode); - - CFX_ByteString m_BaseFont; - CPDF_StreamAcc* m_pFontFile; - CPDF_Dictionary* m_pFontDict; - mutable std::unique_ptr m_pToUnicodeMap; - mutable bool m_bToUnicodeLoaded; - int m_Flags; - FX_RECT m_FontBBox; - int m_StemV; - int m_Ascent; - int m_Descent; - int m_ItalicAngle; -}; - -#endif // CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONT_H_ diff --git a/core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h b/core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h deleted file mode 100644 index 8ded0ac708..0000000000 --- a/core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h +++ /dev/null @@ -1,61 +0,0 @@ -// 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_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONTENCODING_H_ -#define CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONTENCODING_H_ - -#include "core/fxcrt/include/cfx_string_pool_template.h" -#include "core/fxcrt/include/cfx_weak_ptr.h" -#include "core/fxcrt/include/fx_string.h" - -#define PDFFONT_ENCODING_BUILTIN 0 -#define PDFFONT_ENCODING_WINANSI 1 -#define PDFFONT_ENCODING_MACROMAN 2 -#define PDFFONT_ENCODING_MACEXPERT 3 -#define PDFFONT_ENCODING_STANDARD 4 -#define PDFFONT_ENCODING_ADOBE_SYMBOL 5 -#define PDFFONT_ENCODING_ZAPFDINGBATS 6 -#define PDFFONT_ENCODING_PDFDOC 7 -#define PDFFONT_ENCODING_MS_SYMBOL 8 -#define PDFFONT_ENCODING_UNICODE 9 - -uint32_t FT_CharCodeFromUnicode(int encoding, FX_WCHAR unicode); -FX_WCHAR FT_UnicodeFromCharCode(int encoding, uint32_t charcode); - -FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name); -CFX_ByteString PDF_AdobeNameFromUnicode(FX_WCHAR unicode); - -const uint16_t* PDF_UnicodesForPredefinedCharSet(int encoding); -const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, - uint8_t charcode); - -class CPDF_Object; - -class CPDF_FontEncoding { - public: - CPDF_FontEncoding(); - explicit CPDF_FontEncoding(int PredefinedEncoding); - - void LoadEncoding(CPDF_Object* pEncoding); - - FX_BOOL IsIdentical(CPDF_FontEncoding* pAnother) const; - - FX_WCHAR UnicodeFromCharCode(uint8_t charcode) const { - return m_Unicodes[charcode]; - } - int CharCodeFromUnicode(FX_WCHAR unicode) const; - - void SetUnicode(uint8_t charcode, FX_WCHAR unicode) { - m_Unicodes[charcode] = unicode; - } - - CPDF_Object* Realize(CFX_WeakPtr pPool); - - public: - FX_WCHAR m_Unicodes[256]; -}; - -#endif // CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONTENCODING_H_ diff --git a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp index 1c6f37cad4..e027dee8c3 100644 --- a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp @@ -7,7 +7,7 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_textobject.h" #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h" -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" CPDF_TextObject::CPDF_TextObject() : m_PosX(0), diff --git a/core/fpdfapi/fpdf_page/cpdf_textstate.cpp b/core/fpdfapi/fpdf_page/cpdf_textstate.cpp index 4967cca4e8..45281a7b8f 100644 --- a/core/fpdfapi/fpdf_page/cpdf_textstate.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_textstate.cpp @@ -6,7 +6,7 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_textstate.h" -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfapi/fpdf_page/pageint.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 55943fdfe5..5cd06244ed 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -11,8 +11,8 @@ #include #include "core/fpdfapi/fpdf_edit/cpdf_creator.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfapi/fpdf_font/cpdf_type3font.h" -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" #include "core/fpdfapi/fpdf_page/cpdf_allstates.h" #include "core/fpdfapi/fpdf_page/cpdf_meshstream.h" #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp index 7e75a437a8..5b402731b6 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp @@ -10,7 +10,7 @@ #include #include -#include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" +#include "core/fpdfapi/fpdf_font/cpdf_fontencoding.h" #include "core/fpdfapi/fpdf_page/cpdf_pagemodule.h" #include "core/fpdfapi/fpdf_page/pageint.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp index 4c1daa40f0..6a6d667086 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -9,9 +9,9 @@ #include #include "core/fpdfapi/fpdf_font/cpdf_cidfont.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfapi/fpdf_font/cpdf_type3char.h" #include "core/fpdfapi/fpdf_font/cpdf_type3font.h" -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" #include "core/fpdfapi/fpdf_page/include/cpdf_imageobject.h" #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" diff --git a/core/fpdfdoc/cpdf_interform.cpp b/core/fpdfdoc/cpdf_interform.cpp index af72bd2750..b5d78bad54 100644 --- a/core/fpdfdoc/cpdf_interform.cpp +++ b/core/fpdfdoc/cpdf_interform.cpp @@ -6,8 +6,8 @@ #include -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" -#include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_fontencoding.h" #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cfdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" diff --git a/core/fpdfdoc/cpdf_variabletext.cpp b/core/fpdfdoc/cpdf_variabletext.cpp index 8356c1620b..d8f8f5a9aa 100644 --- a/core/fpdfdoc/cpdf_variabletext.cpp +++ b/core/fpdfdoc/cpdf_variabletext.cpp @@ -6,7 +6,7 @@ #include "core/fpdfdoc/include/cpdf_variabletext.h" -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfdoc/cline.h" #include "core/fpdfdoc/cpvt_wordinfo.h" #include "core/fpdfdoc/csection.h" diff --git a/core/fpdfdoc/cpvt_fontmap.cpp b/core/fpdfdoc/cpvt_fontmap.cpp index eb209664fd..34225fc5f7 100644 --- a/core/fpdfdoc/cpvt_fontmap.cpp +++ b/core/fpdfdoc/cpvt_fontmap.cpp @@ -6,7 +6,7 @@ #include "core/fpdfdoc/cpvt_fontmap.h" -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfdoc/include/cpdf_interform.h" diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp index 4c7a56352b..23c99412e6 100644 --- a/core/fpdfdoc/cpvt_generateap.cpp +++ b/core/fpdfdoc/cpvt_generateap.cpp @@ -8,7 +8,7 @@ #include -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" diff --git a/core/fpdftext/cpdf_textpage.cpp b/core/fpdftext/cpdf_textpage.cpp index b6eb87eea1..f064c90545 100644 --- a/core/fpdftext/cpdf_textpage.cpp +++ b/core/fpdftext/cpdf_textpage.cpp @@ -10,7 +10,7 @@ #include #include -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" #include "core/fpdfapi/fpdf_page/include/cpdf_formobject.h" #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" diff --git a/core/fxge/ge/cfx_font.cpp b/core/fxge/ge/cfx_font.cpp index a291b59ad4..461cf6f57b 100644 --- a/core/fxge/ge/cfx_font.cpp +++ b/core/fxge/ge/cfx_font.cpp @@ -6,7 +6,7 @@ #include "core/fxge/include/fx_font.h" -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fxge/ge/fx_text_int.h" #include "core/fxge/include/cfx_facecache.h" #include "core/fxge/include/cfx_fontcache.h" diff --git a/core/fxge/ge/cfx_unicodeencodingex.cpp b/core/fxge/ge/cfx_unicodeencodingex.cpp index 030a1e9674..5ff5b03e50 100644 --- a/core/fxge/ge/cfx_unicodeencodingex.cpp +++ b/core/fxge/ge/cfx_unicodeencodingex.cpp @@ -6,7 +6,7 @@ #include "core/fxge/include/cfx_unicodeencodingex.h" -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fxge/include/fx_font.h" #include "core/fxge/include/fx_freetype.h" diff --git a/fpdfsdk/formfiller/DEPS b/fpdfsdk/formfiller/DEPS index 8e0928c269..1450b21aa6 100644 --- a/fpdfsdk/formfiller/DEPS +++ b/fpdfsdk/formfiller/DEPS @@ -1,3 +1,3 @@ include_rules = [ - '+core/fpdfapi/fpdf_font/include', + '+core/fpdfapi/fpdf_font', ] diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp index 09c54ca6f3..311b48f596 100644 --- a/fpdfsdk/formfiller/cba_fontmap.cpp +++ b/fpdfsdk/formfiller/cba_fontmap.cpp @@ -6,7 +6,7 @@ #include "fpdfsdk/formfiller/cba_fontmap.h" -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_simple_parser.h" diff --git a/fpdfsdk/fxedit/DEPS b/fpdfsdk/fxedit/DEPS index cf99b35f95..973ea055cf 100644 --- a/fpdfsdk/fxedit/DEPS +++ b/fpdfsdk/fxedit/DEPS @@ -1,4 +1,4 @@ include_rules = [ - '+core/fpdfapi/fpdf_font/include', + '+core/fpdfapi/fpdf_font', '+core/fpdfdoc/include', ] diff --git a/fpdfsdk/fxedit/fxet_ap.cpp b/fpdfsdk/fxedit/fxet_ap.cpp index 8484e5de63..1db6400be3 100644 --- a/fpdfsdk/fxedit/fxet_ap.cpp +++ b/fpdfsdk/fxedit/fxet_ap.cpp @@ -4,7 +4,7 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" #include "core/fpdfdoc/include/cpvt_word.h" #include "core/fpdfdoc/include/ipvt_fontmap.h" diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index ce16a21a17..202b5dc000 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -10,7 +10,7 @@ #include #include -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" #include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" #include "core/fpdfapi/fpdf_page/include/cpdf_pathobject.h" diff --git a/fpdfsdk/javascript/DEPS b/fpdfsdk/javascript/DEPS index 1f6ae10df2..2598fba87a 100644 --- a/fpdfsdk/javascript/DEPS +++ b/fpdfsdk/javascript/DEPS @@ -1,5 +1,5 @@ include_rules = [ '+core/fdrm/crypto', - '+core/fpdfapi/fpdf_font/include', + '+core/fpdfapi/fpdf_font', '+fxjs/include' ] diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index b7b03b2174..cf68df1f4c 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -9,7 +9,7 @@ #include #include -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp index 0534f47749..21ebf27cd5 100644 --- a/fpdfsdk/javascript/Field.cpp +++ b/fpdfsdk/javascript/Field.cpp @@ -11,7 +11,7 @@ #include #include -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfdoc/include/cpdf_interform.h" diff --git a/fpdfsdk/pdfwindow/DEPS b/fpdfsdk/pdfwindow/DEPS index cf99b35f95..973ea055cf 100644 --- a/fpdfsdk/pdfwindow/DEPS +++ b/fpdfsdk/pdfwindow/DEPS @@ -1,4 +1,4 @@ include_rules = [ - '+core/fpdfapi/fpdf_font/include', + '+core/fpdfapi/fpdf_font', '+core/fpdfdoc/include', ] diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index bd9d3aac61..fc7d04cdef 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -8,7 +8,7 @@ #include -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfdoc/include/cpvt_word.h" #include "core/fxcrt/include/fx_safe_types.h" #include "core/fxcrt/include/fx_xml.h" diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp index 9f1c854914..312e4a0cff 100644 --- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp @@ -6,8 +6,8 @@ #include "fpdfsdk/pdfwindow/PWL_FontMap.h" -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" -#include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_fontencoding.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" #include "core/fpdfapi/include/cpdf_modulemgr.h" diff --git a/xfa/fxfa/app/DEPS b/xfa/fxfa/app/DEPS index 2f7428f6bf..3c47627df8 100644 --- a/xfa/fxfa/app/DEPS +++ b/xfa/fxfa/app/DEPS @@ -1,6 +1,6 @@ include_rules = [ '+core/fdrm/crypto', - '+core/fpdfapi/fpdf_font/include', + '+core/fpdfapi/fpdf_font', '+core/fpdfapi/fpdf_page/include', '+core/fpdfapi/fpdf_parser/include', '+core/fpdfdoc/include', diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp index be5081d857..57e0baffa0 100644 --- a/xfa/fxfa/app/xfa_fontmgr.cpp +++ b/xfa/fxfa/app/xfa_fontmgr.cpp @@ -10,7 +10,7 @@ #include #include -#include "core/fpdfapi/fpdf_font/include/cpdf_font.h" +#include "core/fpdfapi/fpdf_font/cpdf_font.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" #include "xfa/fgas/font/fgas_gefont.h" -- cgit v1.2.3