summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_font/include
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-09-29 11:58:38 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-29 11:58:38 -0700
commit166bc16e15a5be72fe19da97504b4837967333ff (patch)
treeec6d5e2e997840e51fc10d7bc9f709448bdb9152 /core/fpdfapi/fpdf_font/include
parent1771a71f8140944eafa66f0e1f0779de4c0631af (diff)
downloadpdfium-166bc16e15a5be72fe19da97504b4837967333ff.tar.xz
Move core/fpdfapi/fpdf_font/include to core/fpdfapi/fpdf_font
BUG=pdfium:611 Review-Url: https://codereview.chromium.org/2375283003
Diffstat (limited to 'core/fpdfapi/fpdf_font/include')
-rw-r--r--core/fpdfapi/fpdf_font/include/cpdf_font.h132
-rw-r--r--core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h61
2 files changed, 0 insertions, 193 deletions
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 <memory>
-#include <vector>
-
-#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<CPDF_Font> 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<uint32_t>(-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<std::unique_ptr<CFX_Font>> m_FontFallbacks;
-
- protected:
- CPDF_Font();
-
- virtual bool Load() = 0;
-
- void LoadUnicodeMap() const; // logically const only.
- void LoadPDFEncoding(CPDF_Object* pEncoding,
- int& iBaseEncoding,
- std::vector<CFX_ByteString>* pCharNames,
- bool bEmbedded,
- bool bTrueType);
- void LoadFontDescriptor(CPDF_Dictionary* pDict);
- void CheckFontMetrics();
-
- const FX_CHAR* GetAdobeCharName(int iBaseEncoding,
- const std::vector<CFX_ByteString>& charnames,
- int charcode);
-
- CFX_ByteString m_BaseFont;
- CPDF_StreamAcc* m_pFontFile;
- CPDF_Dictionary* m_pFontDict;
- mutable std::unique_ptr<CPDF_ToUnicodeMap> 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<CFX_ByteStringPool> pPool);
-
- public:
- FX_WCHAR m_Unicodes[256];
-};
-
-#endif // CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONTENCODING_H_