Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Side by Side Diff: core/fpdfapi/fpdf_font/include/cpdf_font.h

Issue 1824033002: Split core/include/fpdfapi/fpdf_resource.h (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONT_H_
8 #define CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONT_H_
9
10 #include "core/fxcrt/include/fx_string.h"
11 #include "core/fxcrt/include/fx_system.h"
12 #include "core/include/fxge/fx_font.h"
13
14 #define PDFFONT_FIXEDPITCH 1
15 #define PDFFONT_SERIF 2
16 #define PDFFONT_SYMBOLIC 4
17 #define PDFFONT_SCRIPT 8
18 #define PDFFONT_NONSYMBOLIC 32
19 #define PDFFONT_ITALIC 64
20 #define PDFFONT_ALLCAP 0x10000
21 #define PDFFONT_SMALLCAP 0x20000
22 #define PDFFONT_FORCEBOLD 0x40000
23 #define PDFFONT_USEEXTERNATTR 0x80000
24
25 class CFX_SubstFont;
26 class CPDF_CIDFont;
27 class CPDF_Dictionary;
28 class CPDF_Document;
29 class CPDF_Object;
30 class CPDF_StreamAcc;
31 class CPDF_TrueTypeFont;
32 class CPDF_Type1Font;
33 class CPDF_Type3Font;
34 class CPDF_ToUnicodeMap;
35
36 class CPDF_Font {
37 public:
38 static CPDF_Font* CreateFontF(CPDF_Document* pDoc,
39 CPDF_Dictionary* pFontDict);
40 static CPDF_Font* GetStockFont(CPDF_Document* pDoc,
41 const CFX_ByteStringC& fontname);
42 static const FX_DWORD kInvalidCharCode = static_cast<FX_DWORD>(-1);
43
44 virtual ~CPDF_Font();
45
46 virtual bool IsType1Font() const;
47 virtual bool IsTrueTypeFont() const;
48 virtual bool IsType3Font() const;
49 virtual bool IsCIDFont() const;
50 virtual const CPDF_Type1Font* AsType1Font() const;
51 virtual CPDF_Type1Font* AsType1Font();
52 virtual const CPDF_TrueTypeFont* AsTrueTypeFont() const;
53 virtual CPDF_TrueTypeFont* AsTrueTypeFont();
54 virtual const CPDF_Type3Font* AsType3Font() const;
55 virtual CPDF_Type3Font* AsType3Font();
56 virtual const CPDF_CIDFont* AsCIDFont() const;
57 virtual CPDF_CIDFont* AsCIDFont();
58
59 virtual FX_BOOL IsVertWriting() const;
60 virtual FX_BOOL IsUnicodeCompatible() const;
61 virtual FX_DWORD GetNextChar(const FX_CHAR* pString,
62 int nStrLen,
63 int& offset) const;
64 virtual int CountChar(const FX_CHAR* pString, int size) const;
65 virtual int AppendChar(FX_CHAR* buf, FX_DWORD charcode) const;
66 virtual int GetCharSize(FX_DWORD charcode) const;
67 virtual int GlyphFromCharCode(FX_DWORD charcode,
68 FX_BOOL* pVertGlyph = nullptr);
69 virtual int GlyphFromCharCodeExt(FX_DWORD charcode);
70 virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const;
71 virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const;
72
73 const CFX_ByteString& GetBaseFont() const { return m_BaseFont; }
74 const CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); }
75 FX_DWORD GetFlags() const { return m_Flags; }
76 FX_BOOL IsEmbedded() const { return IsType3Font() || m_pFontFile != nullptr; }
77 CPDF_StreamAcc* GetFontFile() const { return m_pFontFile; }
78 CPDF_Dictionary* GetFontDict() const { return m_pFontDict; }
79 FX_BOOL IsStandardFont() const;
80 FXFT_Face GetFace() const { return m_Font.GetFace(); }
81 void AppendChar(CFX_ByteString& str, FX_DWORD charcode) const;
82
83 void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; }
84 int GetTypeAscent() const { return m_Ascent; }
85 int GetTypeDescent() const { return m_Descent; }
86 int GetItalicAngle() const { return m_ItalicAngle; }
87 int GetStemV() const { return m_StemV; }
88 int GetStringWidth(const FX_CHAR* pString, int size);
89
90 virtual int GetCharWidthF(FX_DWORD charcode, int level = 0) = 0;
91 virtual FX_RECT GetCharBBox(FX_DWORD charcode, int level = 0) = 0;
92
93 CPDF_Document* m_pDocument;
94 CFX_Font m_Font;
95
96 protected:
97 CPDF_Font();
98
99 virtual FX_BOOL Load() = 0;
100
101 FX_BOOL Initialize();
102 void LoadUnicodeMap();
103 void LoadPDFEncoding(CPDF_Object* pEncoding,
104 int& iBaseEncoding,
105 CFX_ByteString*& pCharNames,
106 FX_BOOL bEmbedded,
107 FX_BOOL bTrueType);
108 void LoadFontDescriptor(CPDF_Dictionary* pDict);
109 void CheckFontMetrics();
110
111 const FX_CHAR* GetAdobeCharName(int iBaseEncoding,
112 const CFX_ByteString* pCharNames,
113 int charcode);
114
115 CFX_ByteString m_BaseFont;
116 CPDF_StreamAcc* m_pFontFile;
117 CPDF_Dictionary* m_pFontDict;
118 CPDF_ToUnicodeMap* m_pToUnicodeMap;
119 FX_BOOL m_bToUnicodeLoaded;
120 int m_Flags;
121 FX_RECT m_FontBBox;
122 int m_StemV;
123 int m_Ascent;
124 int m_Descent;
125 int m_ItalicAngle;
126 };
127
128 #endif // CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONT_H_
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_font/fpdf_font_cid.cpp ('k') | core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698