OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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_INCLUDE_FXGE_FX_FONT_H_ | 7 #ifndef CORE_INCLUDE_FXGE_FX_FONT_H_ |
8 #define CORE_INCLUDE_FXGE_FX_FONT_H_ | 8 #define CORE_INCLUDE_FXGE_FX_FONT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #define FXFONT_GREEK_CHARSET 161 | 47 #define FXFONT_GREEK_CHARSET 161 |
48 #define FXFONT_TURKISH_CHARSET 162 | 48 #define FXFONT_TURKISH_CHARSET 162 |
49 #define FXFONT_HEBREW_CHARSET 177 | 49 #define FXFONT_HEBREW_CHARSET 177 |
50 #define FXFONT_ARABIC_CHARSET 178 | 50 #define FXFONT_ARABIC_CHARSET 178 |
51 #define FXFONT_BALTIC_CHARSET 186 | 51 #define FXFONT_BALTIC_CHARSET 186 |
52 #define FXFONT_FF_FIXEDPITCH 1 | 52 #define FXFONT_FF_FIXEDPITCH 1 |
53 #define FXFONT_FF_ROMAN (1 << 4) | 53 #define FXFONT_FF_ROMAN (1 << 4) |
54 #define FXFONT_FF_SCRIPT (4 << 4) | 54 #define FXFONT_FF_SCRIPT (4 << 4) |
55 #define FXFONT_FW_NORMAL 400 | 55 #define FXFONT_FW_NORMAL 400 |
56 #define FXFONT_FW_BOLD 700 | 56 #define FXFONT_FW_BOLD 700 |
| 57 |
57 class CFX_Font { | 58 class CFX_Font { |
58 public: | 59 public: |
59 CFX_Font(); | 60 CFX_Font(); |
60 ~CFX_Font(); | 61 ~CFX_Font(); |
61 | 62 |
62 FX_BOOL LoadSubst(const CFX_ByteString& face_name, | 63 FX_BOOL LoadSubst(const CFX_ByteString& face_name, |
63 FX_BOOL bTrueType, | 64 FX_BOOL bTrueType, |
64 FX_DWORD flags, | 65 FX_DWORD flags, |
65 int weight, | 66 int weight, |
66 int italic_angle, | 67 int italic_angle, |
67 int CharsetCP, | 68 int CharsetCP, |
68 FX_BOOL bVertical = FALSE); | 69 FX_BOOL bVertical = FALSE); |
| 70 FX_BOOL LoadEmbedded(const uint8_t* data, FX_DWORD size); |
| 71 FXFT_Face GetFace() const { return m_Face; } |
| 72 const CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; } |
| 73 CFX_PathData* LoadGlyphPath(FX_DWORD glyph_index, int dest_width = 0); |
| 74 int GetGlyphWidth(FX_DWORD glyph_index); |
| 75 int GetAscent() const; |
| 76 int GetDescent() const; |
| 77 FX_BOOL GetGlyphBBox(FX_DWORD glyph_index, FX_RECT& bbox); |
| 78 FX_BOOL IsItalic() const; |
| 79 FX_BOOL IsBold() const; |
| 80 FX_BOOL IsFixedWidth() const; |
| 81 FX_BOOL IsVertical() const { return m_bVertical; } |
| 82 CFX_WideString GetPsName() const; |
| 83 CFX_ByteString GetFamilyName() const; |
| 84 CFX_ByteString GetFaceName() const; |
| 85 FX_BOOL IsTTFont() const; |
| 86 FX_BOOL GetBBox(FX_RECT& bbox); |
| 87 int GetHeight() const; |
| 88 int GetULPos() const; |
| 89 int GetULthickness() const; |
| 90 int GetMaxAdvanceWidth() const; |
| 91 FX_BOOL IsEmbedded() const { return m_bEmbedded; } |
| 92 uint8_t* GetSubData() const { return m_pGsubData; } |
| 93 void SetSubData(uint8_t* data) { m_pGsubData = data; } |
| 94 void AdjustMMParams(int glyph_index, int width, int weight); |
69 | 95 |
70 FX_BOOL LoadEmbedded(const uint8_t* data, FX_DWORD size); | 96 private: |
71 | 97 void ReleasePlatformResource(); |
72 FX_BOOL LoadFile(IFX_FileRead* pFile); | 98 void DeleteFace(); |
73 | |
74 FXFT_Face GetFace() const { return m_Face; } | |
75 | |
76 const CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; } | |
77 | |
78 CFX_PathData* LoadGlyphPath(FX_DWORD glyph_index, int dest_width = 0); | |
79 | |
80 int GetGlyphWidth(FX_DWORD glyph_index); | |
81 | |
82 int GetAscent() const; | |
83 | |
84 int GetDescent() const; | |
85 | |
86 FX_BOOL GetGlyphBBox(FX_DWORD glyph_index, FX_RECT& bbox); | |
87 | |
88 FX_BOOL IsItalic(); | |
89 | |
90 FX_BOOL IsBold(); | |
91 | |
92 FX_BOOL IsFixedWidth(); | |
93 | |
94 FX_BOOL IsVertical() const { return m_bVertical; } | |
95 | |
96 CFX_WideString GetPsName() const; | |
97 | |
98 CFX_ByteString GetFamilyName() const; | |
99 | |
100 CFX_ByteString GetFaceName() const; | |
101 | |
102 FX_BOOL IsTTFont(); | |
103 | |
104 FX_BOOL GetBBox(FX_RECT& bbox); | |
105 | |
106 int GetHeight(); | |
107 | |
108 int GetULPos(); | |
109 | |
110 int GetULthickness(); | |
111 | |
112 int GetMaxAdvanceWidth(); | |
113 | 99 |
114 FXFT_Face m_Face; | 100 FXFT_Face m_Face; |
115 | |
116 CFX_SubstFont* m_pSubstFont; | 101 CFX_SubstFont* m_pSubstFont; |
117 FX_BOOL IsEmbedded() { return m_bEmbedded; } | |
118 | |
119 void AdjustMMParams(int glyph_index, int width, int weight); | |
120 uint8_t* m_pFontDataAllocation; | 102 uint8_t* m_pFontDataAllocation; |
121 uint8_t* m_pFontData; | 103 uint8_t* m_pFontData; |
122 uint8_t* m_pGsubData; | 104 uint8_t* m_pGsubData; |
123 FX_DWORD m_dwSize; | 105 FX_DWORD m_dwSize; |
124 CFX_BinaryBuf m_OtfFontData; | 106 CFX_BinaryBuf m_OtfFontData; |
125 void* m_hHandle; | 107 void* m_hHandle; |
126 void* m_pPlatformFont; | 108 void* m_pPlatformFont; |
127 void* m_pPlatformFontCollection; | 109 void* m_pPlatformFontCollection; |
128 void* m_pDwFont; | 110 void* m_pDwFont; |
129 FX_BOOL m_bDwLoaded; | 111 FX_BOOL m_bDwLoaded; |
130 void ReleasePlatformResource(); | |
131 | |
132 void DeleteFace(); | |
133 | |
134 protected: | |
135 FX_BOOL m_bEmbedded; | 112 FX_BOOL m_bEmbedded; |
136 FX_BOOL m_bVertical; | 113 FX_BOOL m_bVertical; |
137 void* m_pOwnedStream; | |
138 }; | 114 }; |
| 115 |
139 #define ENCODING_INTERNAL 0 | 116 #define ENCODING_INTERNAL 0 |
140 #define ENCODING_UNICODE 1 | 117 #define ENCODING_UNICODE 1 |
141 | 118 |
142 class CFX_UnicodeEncoding { | 119 class CFX_UnicodeEncoding { |
143 public: | 120 public: |
144 explicit CFX_UnicodeEncoding(CFX_Font* pFont); | 121 explicit CFX_UnicodeEncoding(CFX_Font* pFont); |
145 ~CFX_UnicodeEncoding(); | 122 ~CFX_UnicodeEncoding(); |
146 | 123 |
147 FX_DWORD GlyphFromCharCode(FX_DWORD charcode); | 124 FX_DWORD GlyphFromCharCode(FX_DWORD charcode); |
148 | 125 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 class IFX_GSUBTable { | 426 class IFX_GSUBTable { |
450 public: | 427 public: |
451 static IFX_GSUBTable* Create(CFX_Font* pFont); | 428 static IFX_GSUBTable* Create(CFX_Font* pFont); |
452 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; | 429 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; |
453 | 430 |
454 protected: | 431 protected: |
455 virtual ~IFX_GSUBTable() {} | 432 virtual ~IFX_GSUBTable() {} |
456 }; | 433 }; |
457 | 434 |
458 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 435 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
OLD | NEW |