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

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

Issue 2276653002: Add fallback fonts in pdfium (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Nits Created 4 years, 3 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
1 // Copyright 2016 PDFium Authors. All rights reserved. 1 // Copyright 2016 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONT_H_ 7 #ifndef CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONT_H_
8 #define CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONT_H_ 8 #define CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONT_H_
9 9
10 #include <memory> 10 #include <memory>
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 virtual uint32_t GetNextChar(const FX_CHAR* pString, 64 virtual uint32_t GetNextChar(const FX_CHAR* pString,
65 int nStrLen, 65 int nStrLen,
66 int& offset) const; 66 int& offset) const;
67 virtual int CountChar(const FX_CHAR* pString, int size) const; 67 virtual int CountChar(const FX_CHAR* pString, int size) const;
68 virtual int AppendChar(FX_CHAR* buf, uint32_t charcode) const; 68 virtual int AppendChar(FX_CHAR* buf, uint32_t charcode) const;
69 virtual int GetCharSize(uint32_t charcode) const; 69 virtual int GetCharSize(uint32_t charcode) const;
70 virtual int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) = 0; 70 virtual int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) = 0;
71 virtual int GlyphFromCharCodeExt(uint32_t charcode); 71 virtual int GlyphFromCharCodeExt(uint32_t charcode);
72 virtual CFX_WideString UnicodeFromCharCode(uint32_t charcode) const; 72 virtual CFX_WideString UnicodeFromCharCode(uint32_t charcode) const;
73 virtual uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const; 73 virtual uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const;
74 virtual uint32_t FallbackFontFromCharcode(uint32_t charcode,
dsinclair 2016/08/23 19:41:18 Are either of these overridden by subclasses? If n
npm 2016/08/23 20:36:57 Done.
75 bool* pVertGlyph);
76 virtual int FallbackGlyphFromCharcode(int fallbackFont,
77 uint32_t charcode,
78 bool* pVertGlyph);
74 79
75 const CFX_ByteString& GetBaseFont() const { return m_BaseFont; } 80 const CFX_ByteString& GetBaseFont() const { return m_BaseFont; }
76 CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); } 81 CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); }
77 uint32_t GetFlags() const { return m_Flags; } 82 uint32_t GetFlags() const { return m_Flags; }
78 FX_BOOL IsEmbedded() const { return IsType3Font() || m_pFontFile != nullptr; } 83 FX_BOOL IsEmbedded() const { return IsType3Font() || m_pFontFile != nullptr; }
79 CPDF_StreamAcc* GetFontFile() const { return m_pFontFile; } 84 CPDF_StreamAcc* GetFontFile() const { return m_pFontFile; }
80 CPDF_Dictionary* GetFontDict() const { return m_pFontDict; } 85 CPDF_Dictionary* GetFontDict() const { return m_pFontDict; }
81 FX_BOOL IsStandardFont() const; 86 FX_BOOL IsStandardFont() const;
82 FXFT_Face GetFace() const { return m_Font.GetFace(); } 87 FXFT_Face GetFace() const { return m_Font.GetFace(); }
83 void AppendChar(CFX_ByteString& str, uint32_t charcode) const; 88 void AppendChar(CFX_ByteString& str, uint32_t charcode) const;
84 89
85 void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; } 90 void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; }
86 int GetTypeAscent() const { return m_Ascent; } 91 int GetTypeAscent() const { return m_Ascent; }
87 int GetTypeDescent() const { return m_Descent; } 92 int GetTypeDescent() const { return m_Descent; }
88 int GetItalicAngle() const { return m_ItalicAngle; } 93 int GetItalicAngle() const { return m_ItalicAngle; }
89 int GetStemV() const { return m_StemV; } 94 int GetStemV() const { return m_StemV; }
90 int GetStringWidth(const FX_CHAR* pString, int size); 95 int GetStringWidth(const FX_CHAR* pString, int size);
91 96
92 virtual int GetCharWidthF(uint32_t charcode, int level = 0) = 0; 97 virtual int GetCharWidthF(uint32_t charcode, int level = 0) = 0;
93 virtual FX_RECT GetCharBBox(uint32_t charcode, int level = 0) = 0; 98 virtual FX_RECT GetCharBBox(uint32_t charcode, int level = 0) = 0;
94 99
95 CPDF_Document* m_pDocument; 100 CPDF_Document* m_pDocument;
96 CFX_Font m_Font; 101 CFX_Font m_Font;
102 std::vector<CFX_Font*> m_FontPlusFallbacks;
97 103
98 protected: 104 protected:
99 CPDF_Font(); 105 CPDF_Font();
100 106
101 virtual FX_BOOL Load() = 0; 107 virtual FX_BOOL Load() = 0;
102 108
103 FX_BOOL Initialize(); 109 FX_BOOL Initialize();
104 void LoadUnicodeMap() const; // logically const only. 110 void LoadUnicodeMap() const; // logically const only.
105 void LoadPDFEncoding(CPDF_Object* pEncoding, 111 void LoadPDFEncoding(CPDF_Object* pEncoding,
106 int& iBaseEncoding, 112 int& iBaseEncoding,
(...skipping 14 matching lines...) Expand all
121 mutable FX_BOOL m_bToUnicodeLoaded; 127 mutable FX_BOOL m_bToUnicodeLoaded;
122 int m_Flags; 128 int m_Flags;
123 FX_RECT m_FontBBox; 129 FX_RECT m_FontBBox;
124 int m_StemV; 130 int m_StemV;
125 int m_Ascent; 131 int m_Ascent;
126 int m_Descent; 132 int m_Descent;
127 int m_ItalicAngle; 133 int m_ItalicAngle;
128 }; 134 };
129 135
130 #endif // CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONT_H_ 136 #endif // CORE_FPDFAPI_FPDF_FONT_INCLUDE_CPDF_FONT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698