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

Side by Side Diff: core/include/fxge/fx_font.h

Issue 453133004: clang-format all code (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 6 years, 4 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 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 _FX_FONT_H_ 7 #ifndef _FX_FONT_H_
8 #define _FX_FONT_H_ 8 #define _FX_FONT_H_
9 #ifndef _FXCRT_EXTENSION_ 9 #ifndef _FXCRT_EXTENSION_
10 #include "../../include/fxcrt/fx_ext.h" 10 #include "../../include/fxcrt/fx_ext.h"
11 #endif 11 #endif
12 #ifndef _FX_DIB_H_ 12 #ifndef _FX_DIB_H_
13 #include "fx_dib.h" 13 #include "fx_dib.h"
14 #endif 14 #endif
15 typedef struct FT_FaceRec_* FXFT_Face; 15 typedef struct FT_FaceRec_* FXFT_Face;
16 typedef void* FXFT_Library; 16 typedef void* FXFT_Library;
17 class IFX_FontEncoding; 17 class IFX_FontEncoding;
18 class CFX_PathData; 18 class CFX_PathData;
19 class CFX_SubstFont; 19 class CFX_SubstFont;
20 class CFX_FaceCache; 20 class CFX_FaceCache;
21 class IFX_FontMapper; 21 class IFX_FontMapper;
22 class CFX_FontMapper; 22 class CFX_FontMapper;
23 class IFX_SystemFontInfo; 23 class IFX_SystemFontInfo;
24 class CFontFileFaceInfo; 24 class CFontFileFaceInfo;
25 #define FXFONT_FIXED_PITCH» » 0x01 25 #define FXFONT_FIXED_PITCH 0x01
26 #define FXFONT_SERIF» » » 0x02 26 #define FXFONT_SERIF 0x02
27 #define FXFONT_SYMBOLIC»» » 0x04 27 #define FXFONT_SYMBOLIC 0x04
28 #define FXFONT_SCRIPT» » » 0x08 28 #define FXFONT_SCRIPT 0x08
29 #define FXFONT_ITALIC» » » 0x40 29 #define FXFONT_ITALIC 0x40
30 #define FXFONT_BOLD» » » » 0x40000 30 #define FXFONT_BOLD 0x40000
31 #define FXFONT_USEEXTERNATTR» 0x80000 31 #define FXFONT_USEEXTERNATTR 0x80000
32 #define FXFONT_CIDFONT» » » 0x100000 32 #define FXFONT_CIDFONT 0x100000
33 #define FXFONT_ANSI_CHARSET» » 0 33 #define FXFONT_ANSI_CHARSET 0
34 #define FXFONT_DEFAULT_CHARSET» 1 34 #define FXFONT_DEFAULT_CHARSET 1
35 #define FXFONT_SYMBOL_CHARSET» 2 35 #define FXFONT_SYMBOL_CHARSET 2
36 #define FXFONT_SHIFTJIS_CHARSET»128 36 #define FXFONT_SHIFTJIS_CHARSET 128
37 #define FXFONT_HANGEUL_CHARSET» 129 37 #define FXFONT_HANGEUL_CHARSET 129
38 #define FXFONT_GB2312_CHARSET» 134 38 #define FXFONT_GB2312_CHARSET 134
39 #define FXFONT_CHINESEBIG5_CHARSET» 136 39 #define FXFONT_CHINESEBIG5_CHARSET 136
40 #define FXFONT_THAI_CHARSET» » 222 40 #define FXFONT_THAI_CHARSET 222
41 #define FXFONT_EASTEUROPE_CHARSET» 238 41 #define FXFONT_EASTEUROPE_CHARSET 238
42 #define FXFONT_RUSSIAN_CHARSET» 204 42 #define FXFONT_RUSSIAN_CHARSET 204
43 #define FXFONT_GREEK_CHARSET» 161 43 #define FXFONT_GREEK_CHARSET 161
44 #define FXFONT_TURKISH_CHARSET» 162 44 #define FXFONT_TURKISH_CHARSET 162
45 #define FXFONT_HEBREW_CHARSET» 177 45 #define FXFONT_HEBREW_CHARSET 177
46 #define FXFONT_ARABIC_CHARSET» 178 46 #define FXFONT_ARABIC_CHARSET 178
47 #define FXFONT_BALTIC_CHARSET» 186 47 #define FXFONT_BALTIC_CHARSET 186
48 #define FXFONT_FF_FIXEDPITCH» 1 48 #define FXFONT_FF_FIXEDPITCH 1
49 #define FXFONT_FF_ROMAN»» » (1<<4) 49 #define FXFONT_FF_ROMAN (1 << 4)
50 #define FXFONT_FF_SCRIPT» » (4<<4) 50 #define FXFONT_FF_SCRIPT (4 << 4)
51 #define FXFONT_FW_NORMAL» » 400 51 #define FXFONT_FW_NORMAL 400
52 #define FXFONT_FW_BOLD» » » 700 52 #define FXFONT_FW_BOLD 700
53 class CFX_Font : public CFX_Object 53 class CFX_Font : public CFX_Object {
54 { 54 public:
55 public: 55 CFX_Font();
56 CFX_Font(); 56 ~CFX_Font();
57 ~CFX_Font(); 57
58 58 FX_BOOL LoadSubst(const CFX_ByteString& face_name,
59 FX_BOOL» » » » » LoadSubst(const CFX_ByteString& face_name, FX_BOOL bTrueType, FX_DWORD flags, 59 FX_BOOL bTrueType,
60 int weight, int italic_angle, int CharsetC P, FX_BOOL bVertical = FALSE); 60 FX_DWORD flags,
61 61 int weight,
62 FX_BOOL» » » » » LoadEmbedded(FX_LPCBYTE data, FX _DWORD size); 62 int italic_angle,
63 63 int CharsetCP,
64 FX_BOOL» » » » » LoadFile(IFX_FileRead* pFile); 64 FX_BOOL bVertical = FALSE);
65 65
66 FXFT_Face» » » » GetFace() const 66 FX_BOOL LoadEmbedded(FX_LPCBYTE data, FX_DWORD size);
67 { 67
68 return m_Face; 68 FX_BOOL LoadFile(IFX_FileRead* pFile);
69 } 69
70 70 FXFT_Face GetFace() const { return m_Face; }
71 71
72 const CFX_SubstFont*» GetSubstFont() const 72 const CFX_SubstFont* GetSubstFont() const { return m_pSubstFont; }
73 { 73
74 return m_pSubstFont; 74 CFX_PathData* LoadGlyphPath(FX_DWORD glyph_index, int dest_width = 0);
75 } 75
76 76 int GetGlyphWidth(FX_DWORD glyph_index);
77 CFX_PathData*» » » LoadGlyphPath(FX_DWORD glyph_index, int dest_width = 0); 77
78 78 int GetAscent() const;
79 int»» » » » » GetGlyphWidth(FX_DWORD glyph_ind ex); 79
80 80 int GetDescent() const;
81 int»» » » » » GetAscent() const; 81
82 82 FX_BOOL GetGlyphBBox(FX_DWORD glyph_index, FX_RECT& bbox);
83 int»» » » » » GetDescent() const; 83
84 84 FX_BOOL IsItalic();
85 FX_BOOL GetGlyphBBox(FX_DWORD glyph_index, FX_RECT &bbox); 85
86 86 FX_BOOL IsBold();
87 FX_BOOL IsItalic(); 87
88 88 FX_BOOL IsFixedWidth();
89 FX_BOOL IsBold(); 89
90 90 FX_BOOL IsVertical() const { return m_bVertical; }
91 FX_BOOL IsFixedWidth(); 91
92 92 CFX_WideString GetPsName() const;
93 FX_BOOL» » » » » IsVertical() const 93
94 { 94 CFX_ByteString GetFamilyName() const;
95 return m_bVertical; 95
96 } 96 CFX_ByteString GetFaceName() const;
97 97
98 CFX_WideString GetPsName() const; 98 FX_BOOL IsTTFont();
99 99
100 100 FX_BOOL GetBBox(FX_RECT& bbox);
101 CFX_ByteString GetFamilyName() const; 101
102 102 int GetHeight();
103 CFX_ByteString GetFaceName() const; 103
104 104 int GetULPos();
105 105
106 FX_BOOL IsTTFont(); 106 int GetULthickness();
107 107
108 FX_BOOL GetBBox(FX_RECT &bbox); 108 int GetMaxAdvanceWidth();
109 109
110 int GetHeight(); 110 FXFT_Face m_Face;
111 111
112 int GetULPos(); 112 CFX_SubstFont* m_pSubstFont;
113 113 FX_BOOL IsEmbedded() { return m_bEmbedded; }
114 int GetULthickness(); 114
115 115 void AdjustMMParams(int glyph_index, int width, int weight);
116 int GetMaxAdvanceWidth(); 116 FX_LPBYTE m_pFontDataAllocation;
117 117 FX_LPBYTE m_pFontData;
118 FXFT_Face» » » » m_Face; 118 FX_LPBYTE m_pGsubData;
119 119 FX_DWORD m_dwSize;
120 CFX_SubstFont*» » » m_pSubstFont; 120 CFX_BinaryBuf m_OtfFontData;
121 FX_BOOL» » » » » IsEmbedded() 121 void* m_hHandle;
122 { 122 void* m_pPlatformFont;
123 return m_bEmbedded; 123 void* m_pPlatformFontCollection;
124 } 124 void* m_pDwFont;
125 125 FX_BOOL m_bDwLoaded;
126 void» » » » » AdjustMMParams(int glyph_index, int width, int weight); 126 void ReleasePlatformResource();
127 FX_LPBYTE» » » » m_pFontDataAllocation; 127
128 FX_LPBYTE m_pFontData; 128 void DeleteFace();
129 FX_LPBYTE» » » » m_pGsubData; 129
130 FX_DWORD m_dwSize; 130 protected:
131 CFX_BinaryBuf m_OtfFontData; 131 FX_BOOL m_bEmbedded;
132 void* m_hHandle; 132 FX_BOOL m_bVertical;
133 void* m_pPlatformFont; 133 void* m_pOwnedStream;
134 void* m_pPlatformFontCollection; 134 };
135 void* m_pDwFont; 135 #define ENCODING_INTERNAL 0
136 FX_BOOL m_bDwLoaded; 136 #define ENCODING_UNICODE 1
137 void ReleasePlatformResource(); 137 class IFX_FontEncoding : public CFX_Object {
138 138 public:
139 void» » » » » DeleteFace(); 139 virtual ~IFX_FontEncoding() {}
140 protected: 140
141 141 virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode) = 0;
142 FX_BOOL» » » » » m_bEmbedded; 142
143 FX_BOOL» » » » » m_bVertical; 143 virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const = 0;
144 void*» » » » » m_pOwnedStream; 144
145 }; 145 virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const = 0;
146 #define ENCODING_INTERNAL» » 0
147 #define ENCODING_UNICODE» » 1
148 class IFX_FontEncoding : public CFX_Object
149 {
150 public:
151 virtual ~IFX_FontEncoding() {}
152
153 virtual FX_DWORD» » GlyphFromCharCode(FX_DWORD charcode) = 0;
154
155 virtual CFX_WideString» UnicodeFromCharCode(FX_DWORD charcode) const = 0 ;
156
157 virtual FX_DWORD» » CharCodeFromUnicode(FX_WCHAR Unicode) const = 0;
158 }; 146 };
159 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont); 147 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont);
160 #define FXFONT_SUBST_MM»» » » 0x01 148 #define FXFONT_SUBST_MM 0x01
161 #define FXFONT_SUBST_GLYPHPATH» » 0x04 149 #define FXFONT_SUBST_GLYPHPATH 0x04
162 #define FXFONT_SUBST_CLEARTYPE» » 0x08 150 #define FXFONT_SUBST_CLEARTYPE 0x08
163 #define FXFONT_SUBST_TRANSFORM» » 0x10 151 #define FXFONT_SUBST_TRANSFORM 0x10
164 #define FXFONT_SUBST_NONSYMBOL» » 0x20 152 #define FXFONT_SUBST_NONSYMBOL 0x20
165 #define FXFONT_SUBST_EXACT» » » 0x40 153 #define FXFONT_SUBST_EXACT 0x40
166 #define FXFONT_SUBST_STANDARD» » 0x80 154 #define FXFONT_SUBST_STANDARD 0x80
167 class CFX_SubstFont : public CFX_Object 155 class CFX_SubstFont : public CFX_Object {
168 { 156 public:
169 public: 157 CFX_SubstFont();
170 158
171 CFX_SubstFont(); 159 FX_LPVOID m_ExtHandle;
172 160
173 FX_LPVOID» » » » m_ExtHandle; 161 CFX_ByteString m_Family;
174 162
175 CFX_ByteString» » » m_Family; 163 int m_Charset;
176 164
177 int»» » » » » m_Charset; 165 FX_DWORD m_SubstFlags;
178 166
179 FX_DWORD» » » » m_SubstFlags; 167 int m_Weight;
180 168
181 int»» » » » » m_Weight; 169 int m_ItalicAngle;
182 170
183 int»» » » » » m_ItalicAngle; 171 FX_BOOL m_bSubstOfCJK;
184 172
185 FX_BOOL» » » » » m_bSubstOfCJK; 173 int m_WeightCJK;
186 174
187 int»» » » » » m_WeightCJK; 175 FX_BOOL m_bItlicCJK;
188 176 };
189 FX_BOOL» » » » » m_bItlicCJK; 177 #define FX_FONT_FLAG_SERIF 0x01
190 }; 178 #define FX_FONT_FLAG_FIXEDPITCH 0x02
191 #define FX_FONT_FLAG_SERIF 0x01 179 #define FX_FONT_FLAG_ITALIC 0x04
192 #define FX_FONT_FLAG_FIXEDPITCH»» » 0x02 180 #define FX_FONT_FLAG_BOLD 0x08
193 #define FX_FONT_FLAG_ITALIC» » » » 0x04 181 #define FX_FONT_FLAG_SYMBOLIC_SYMBOL 0x10
194 #define FX_FONT_FLAG_BOLD» » » » 0x08 182 #define FX_FONT_FLAG_SYMBOLIC_DINGBATS 0x20
195 #define FX_FONT_FLAG_SYMBOLIC_SYMBOL» 0x10 183 #define FX_FONT_FLAG_MULTIPLEMASTER 0x40
196 #define FX_FONT_FLAG_SYMBOLIC_DINGBATS» 0x20
197 #define FX_FONT_FLAG_MULTIPLEMASTER» » 0x40
198 typedef struct { 184 typedef struct {
199 FX_LPCBYTE» m_pFontData; 185 FX_LPCBYTE m_pFontData;
200 FX_DWORD» m_dwSize; 186 FX_DWORD m_dwSize;
201 } FoxitFonts; 187 } FoxitFonts;
202 class CFX_FontMgr : public CFX_Object 188 class CFX_FontMgr : public CFX_Object {
203 { 189 public:
204 public: 190 CFX_FontMgr();
205 CFX_FontMgr(); 191 ~CFX_FontMgr();
206 ~CFX_FontMgr(); 192 void InitFTLibrary();
207 void InitFTLibrary(); 193 FXFT_Face GetCachedFace(const CFX_ByteString& face_name,
208 FXFT_Face GetCachedFace(const CFX_ByteString& face_name, 194 int weight,
209 int weight, FX_BOOL bItalic, FX_LPBYTE& pFontD ata); 195 FX_BOOL bItalic,
210 FXFT_Face AddCachedFace(const CFX_ByteString& face_name, 196 FX_LPBYTE& pFontData);
211 int weight, FX_BOOL bItalic, FX_LPBYTE pData, FX_DWORD size, int face_index); 197 FXFT_Face AddCachedFace(const CFX_ByteString& face_name,
212 FXFT_Face GetCachedTTCFace(int ttc_size, FX_DWORD checksum, 198 int weight,
213 int font_offset, FX_LPBYTE& pFontData); 199 FX_BOOL bItalic,
214 FXFT_Face AddCachedTTCFace(int ttc_size, FX_DWORD checksum, 200 FX_LPBYTE pData,
215 FX_LPBYTE pData, FX_DWORD size, int font_of fset); 201 FX_DWORD size,
216 FXFT_Face GetFileFace(FX_LPCSTR filename, int face_index); 202 int face_index);
217 FXFT_Face GetFixedFace(FX_LPCBYTE pData, FX_DWORD size, int face_i ndex); 203 FXFT_Face GetCachedTTCFace(int ttc_size,
218 void ReleaseFace(FXFT_Face face); 204 FX_DWORD checksum,
219 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) ; 205 int font_offset,
220 FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b TrueType, FX_DWORD flags, 206 FX_LPBYTE& pFontData);
221 int weight, int italic_angle, int CharsetCP, C FX_SubstFont* pSubstFont); 207 FXFT_Face AddCachedTTCFace(int ttc_size,
222 208 FX_DWORD checksum,
223 void FreeCache(); 209 FX_LPBYTE pData,
224 210 FX_DWORD size,
225 FX_BOOL GetStandardFont(FX_LPCBYTE& pFontData, FX_DWORD& size, int index); 211 int font_offset);
226 CFX_FontMapper* m_pBuiltinMapper; 212 FXFT_Face GetFileFace(FX_LPCSTR filename, int face_index);
227 IFX_FontMapper* m_pExtMapper; 213 FXFT_Face GetFixedFace(FX_LPCBYTE pData, FX_DWORD size, int face_index);
228 CFX_MapByteStringToPtr m_FaceMap; 214 void ReleaseFace(FXFT_Face face);
229 FXFT_Library m_FTLibrary; 215 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo);
230 FoxitFonts m_ExternalFonts[16]; 216 FXFT_Face FindSubstFont(const CFX_ByteString& face_name,
231 }; 217 FX_BOOL bTrueType,
232 class IFX_FontMapper : public CFX_Object 218 FX_DWORD flags,
233 { 219 int weight,
234 public: 220 int italic_angle,
235 221 int CharsetCP,
236 virtual ~IFX_FontMapper() {} 222 CFX_SubstFont* pSubstFont);
237 223
238 virtual FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b TrueType, FX_DWORD flags, 224 void FreeCache();
239 int weight, int italic_angle, int CharsetC P, CFX_SubstFont* pSubstFont) = 0; 225
240 226 FX_BOOL GetStandardFont(FX_LPCBYTE& pFontData, FX_DWORD& size, int index);
241 CFX_FontMgr* m_pFontMgr; 227 CFX_FontMapper* m_pBuiltinMapper;
242 }; 228 IFX_FontMapper* m_pExtMapper;
243 class IFX_FontEnumerator 229 CFX_MapByteStringToPtr m_FaceMap;
244 { 230 FXFT_Library m_FTLibrary;
245 public: 231 FoxitFonts m_ExternalFonts[16];
246 232 };
247 virtual void HitFont() = 0; 233 class IFX_FontMapper : public CFX_Object {
248 234 public:
249 virtual void Finish() = 0; 235 virtual ~IFX_FontMapper() {}
250 }; 236
251 class IFX_AdditionalFontEnum 237 virtual FXFT_Face FindSubstFont(const CFX_ByteString& face_name,
252 { 238 FX_BOOL bTrueType,
253 public: 239 FX_DWORD flags,
254 virtual int CountFiles() = 0; 240 int weight,
255 virtual IFX_FileStream* GetFontFile(int index) = 0; 241 int italic_angle,
256 }; 242 int CharsetCP,
257 class CFX_FontMapper : public IFX_FontMapper 243 CFX_SubstFont* pSubstFont) = 0;
258 { 244
259 public: 245 CFX_FontMgr* m_pFontMgr;
260 CFX_FontMapper(); 246 };
261 virtual ~CFX_FontMapper(); 247 class IFX_FontEnumerator {
262 void SetSystemFontInfo(IFX_SystemFontInfo* pF ontInfo); 248 public:
263 IFX_SystemFontInfo* GetSystemFontInfo() 249 virtual void HitFont() = 0;
264 { 250
265 return m_pFontInfo; 251 virtual void Finish() = 0;
266 } 252 };
267 void AddInstalledFont(const CFX_ByteString& n ame, int charset); 253 class IFX_AdditionalFontEnum {
268 void LoadInstalledFonts(); 254 public:
269 CFX_ByteStringArray m_InstalledTTFonts; 255 virtual int CountFiles() = 0;
270 void SetFontEnumerator(IFX_FontEnumerator* pF ontEnumerator) 256 virtual IFX_FileStream* GetFontFile(int index) = 0;
271 { 257 };
272 m_pFontEnumerator = pFontEnumerator; 258 class CFX_FontMapper : public IFX_FontMapper {
273 } 259 public:
274 IFX_FontEnumerator* GetFontEnumerator() const 260 CFX_FontMapper();
275 { 261 virtual ~CFX_FontMapper();
276 return m_pFontEnumerator; 262 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo);
277 } 263 IFX_SystemFontInfo* GetSystemFontInfo() { return m_pFontInfo; }
278 virtual FXFT_Face FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b TrueType, FX_DWORD flags, 264 void AddInstalledFont(const CFX_ByteString& name, int charset);
279 int weight, int italic_angle, int CharsetC P, CFX_SubstFont* pSubstFont); 265 void LoadInstalledFonts();
280 private: 266 CFX_ByteStringArray m_InstalledTTFonts;
281 CFX_ByteString GetPSNameFromTT(void* hFont); 267 void SetFontEnumerator(IFX_FontEnumerator* pFontEnumerator) {
282 CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_n ame); 268 m_pFontEnumerator = pFontEnumerator;
283 FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseFont, int italic_angle, int weight, int picthfamily); 269 }
284 270 IFX_FontEnumerator* GetFontEnumerator() const { return m_pFontEnumerator; }
285 FX_BOOL m_bListLoaded; 271 virtual FXFT_Face FindSubstFont(const CFX_ByteString& face_name,
286 FXFT_Face m_MMFaces[2]; 272 FX_BOOL bTrueType,
287 CFX_ByteString m_LastFamily; 273 FX_DWORD flags,
288 CFX_DWordArray m_CharsetArray; 274 int weight,
289 CFX_ByteStringArray m_FaceArray; 275 int italic_angle,
290 IFX_SystemFontInfo* m_pFontInfo; 276 int CharsetCP,
291 FXFT_Face m_FoxitFaces[14]; 277 CFX_SubstFont* pSubstFont);
292 IFX_FontEnumerator* m_pFontEnumerator; 278
293 }; 279 private:
294 class IFX_SystemFontInfo : public CFX_Object 280 CFX_ByteString GetPSNameFromTT(void* hFont);
295 { 281 CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_name);
296 public: 282 FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont,
297 static IFX_SystemFontInfo* CreateDefault(); 283 int iBaseFont,
298 virtual void Release() = 0; 284 int italic_angle,
299 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0; 285 int weight,
300 virtual void* MapFont(int weight, FX_BOOL bItalic, int charset , int pitch_family, FX_LPCSTR face, FX_BOOL& bExact) = 0; 286 int picthfamily);
301 virtual void* GetFont(FX_LPCSTR face) = 0; 287
302 virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffe r, FX_DWORD size) = 0; 288 FX_BOOL m_bListLoaded;
303 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0; 289 FXFT_Face m_MMFaces[2];
304 virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0; 290 CFX_ByteString m_LastFamily;
305 virtual int GetFaceIndex(void* hFont) 291 CFX_DWordArray m_CharsetArray;
306 { 292 CFX_ByteStringArray m_FaceArray;
307 return 0; 293 IFX_SystemFontInfo* m_pFontInfo;
308 } 294 FXFT_Face m_FoxitFaces[14];
309 virtual void DeleteFont(void* hFont) = 0; 295 IFX_FontEnumerator* m_pFontEnumerator;
310 virtual void* RetainFont(void* hFont) 296 };
311 { 297 class IFX_SystemFontInfo : public CFX_Object {
312 return NULL; 298 public:
313 } 299 static IFX_SystemFontInfo* CreateDefault();
314 }; 300 virtual void Release() = 0;
315 class CFX_FolderFontInfo : public IFX_SystemFontInfo 301 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper) = 0;
316 { 302 virtual void* MapFont(int weight,
317 public: 303 FX_BOOL bItalic,
318 CFX_FolderFontInfo(); 304 int charset,
319 virtual ~CFX_FolderFontInfo(); 305 int pitch_family,
320 void AddPath(FX_BSTR path); 306 FX_LPCSTR face,
321 virtual void Release(); 307 FX_BOOL& bExact) = 0;
322 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); 308 virtual void* GetFont(FX_LPCSTR face) = 0;
323 virtual void* MapFont(int weight, FX_BOOL bItalic, int charset , int pitch_family, FX_LPCSTR face, FX_BOOL& bExact); 309 virtual FX_DWORD GetFontData(void* hFont,
324 virtual void* GetFont(FX_LPCSTR face); 310 FX_DWORD table,
325 virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, FX_LPBYTE buffe r, FX_DWORD size); 311 FX_LPBYTE buffer,
326 virtual void DeleteFont(void* hFont); 312 FX_DWORD size) = 0;
327 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); 313 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0;
328 virtual FX_BOOL GetFontCharset(void* hFont, int& charset); 314 virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0;
329 protected: 315 virtual int GetFaceIndex(void* hFont) { return 0; }
330 CFX_MapByteStringToPtr m_FontList; 316 virtual void DeleteFont(void* hFont) = 0;
331 CFX_ByteStringArray m_PathList; 317 virtual void* RetainFont(void* hFont) { return NULL; }
332 CFX_FontMapper* m_pMapper; 318 };
333 void ScanPath(CFX_ByteString& path); 319 class CFX_FolderFontInfo : public IFX_SystemFontInfo {
334 void ScanFile(CFX_ByteString& path); 320 public:
335 void ReportFace(CFX_ByteString& path, FXSYS_F ILE* pFile, FX_DWORD filesize, FX_DWORD offset); 321 CFX_FolderFontInfo();
336 }; 322 virtual ~CFX_FolderFontInfo();
337 class CFX_CountedFaceCache : public CFX_Object 323 void AddPath(FX_BSTR path);
338 { 324 virtual void Release();
339 public: 325 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper);
340 CFX_FaceCache* m_Obj; 326 virtual void* MapFont(int weight,
341 FX_DWORD m_nCount; 327 FX_BOOL bItalic,
328 int charset,
329 int pitch_family,
330 FX_LPCSTR face,
331 FX_BOOL& bExact);
332 virtual void* GetFont(FX_LPCSTR face);
333 virtual FX_DWORD GetFontData(void* hFont,
334 FX_DWORD table,
335 FX_LPBYTE buffer,
336 FX_DWORD size);
337 virtual void DeleteFont(void* hFont);
338 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name);
339 virtual FX_BOOL GetFontCharset(void* hFont, int& charset);
340
341 protected:
342 CFX_MapByteStringToPtr m_FontList;
343 CFX_ByteStringArray m_PathList;
344 CFX_FontMapper* m_pMapper;
345 void ScanPath(CFX_ByteString& path);
346 void ScanFile(CFX_ByteString& path);
347 void ReportFace(CFX_ByteString& path,
348 FXSYS_FILE* pFile,
349 FX_DWORD filesize,
350 FX_DWORD offset);
351 };
352 class CFX_CountedFaceCache : public CFX_Object {
353 public:
354 CFX_FaceCache* m_Obj;
355 FX_DWORD m_nCount;
342 }; 356 };
343 typedef CFX_MapPtrTemplate<FXFT_Face, CFX_CountedFaceCache*> CFX_FTCacheMap; 357 typedef CFX_MapPtrTemplate<FXFT_Face, CFX_CountedFaceCache*> CFX_FTCacheMap;
344 class CFX_FontCache : public CFX_Object 358 class CFX_FontCache : public CFX_Object {
345 { 359 public:
346 public: 360 ~CFX_FontCache();
347 ~CFX_FontCache(); 361 CFX_FaceCache* GetCachedFace(CFX_Font* pFont);
348 CFX_FaceCache*» » » GetCachedFace(CFX_Font* pFont); 362 void ReleaseCachedFace(CFX_Font* pFont);
349 void» » » » » ReleaseCachedFace(CFX_Font* pFon t); 363 void FreeCache(FX_BOOL bRelease = FALSE);
350 void» » » » » FreeCache(FX_BOOL bRelease = FAL SE); 364
351 365 private:
352 private: 366 CFX_FTCacheMap m_FTFaceMap;
353 CFX_FTCacheMap» » » m_FTFaceMap; 367 CFX_FTCacheMap m_ExtFaceMap;
354 CFX_FTCacheMap» » » m_ExtFaceMap; 368 };
355 }; 369 class CFX_AutoFontCache {
356 class CFX_AutoFontCache 370 public:
357 { 371 CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont)
358 public: 372 : m_pFontCache(pFontCache), m_pFont(pFont) {}
359 CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont) 373 ~CFX_AutoFontCache() { m_pFontCache->ReleaseCachedFace(m_pFont); }
360 : m_pFontCache(pFontCache) 374 CFX_FontCache* m_pFontCache;
361 , m_pFont(pFont) 375 CFX_Font* m_pFont;
362 { 376 };
363 } 377 #define FX_FONTCACHE_DEFINE(pFontCache, pFont) \
364 ~CFX_AutoFontCache() 378 CFX_AutoFontCache autoFontCache((pFontCache), (pFont))
365 { 379 class CFX_GlyphBitmap : public CFX_Object {
366 m_pFontCache->ReleaseCachedFace(m_pFont); 380 public:
367 } 381 int m_Top;
368 CFX_FontCache* m_pFontCache; 382 int m_Left;
369 CFX_Font* m_pFont; 383 CFX_DIBitmap m_Bitmap;
370 }; 384 };
371 #define FX_FONTCACHE_DEFINE(pFontCache, pFont) CFX_AutoFontCache autoFontCache(( pFontCache), (pFont)) 385 class CFX_FaceCache : public CFX_Object {
372 class CFX_GlyphBitmap : public CFX_Object 386 public:
373 { 387 ~CFX_FaceCache();
374 public: 388 const CFX_GlyphBitmap* LoadGlyphBitmap(CFX_Font* pFont,
375 int»» » » » » m_Top; 389 FX_DWORD glyph_index,
376 int»» » » » » m_Left; 390 FX_BOOL bFontStyle,
377 CFX_DIBitmap» » » m_Bitmap; 391 const CFX_AffineMatrix* pMatrix,
378 }; 392 int dest_width,
379 class CFX_FaceCache : public CFX_Object 393 int anti_alias,
380 { 394 int& text_flags);
381 public: 395 const CFX_PathData* LoadGlyphPath(CFX_Font* pFont,
382 ~CFX_FaceCache(); 396 FX_DWORD glyph_index,
383 const CFX_GlyphBitmap*» LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD glyph_ index, FX_BOOL bFontStyle, const CFX_AffineMatrix* pMatrix, 397 int dest_width);
384 int dest_width, int anti_alias, int& text_flags); 398
385 const CFX_PathData*»» LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph_in dex, int dest_width); 399 CFX_FaceCache(FXFT_Face face);
386 400
387 401 private:
388 CFX_FaceCache(FXFT_Face face); 402 FXFT_Face m_Face;
389 private: 403 CFX_GlyphBitmap* RenderGlyph(CFX_Font* pFont,
390 FXFT_Face» » » » m_Face; 404 FX_DWORD glyph_index,
391 CFX_GlyphBitmap*» » RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde x, FX_BOOL bFontStyle, 405 FX_BOOL bFontStyle,
392 const CFX_AffineMatrix* pMatrix, int des t_width, int anti_alias); 406 const CFX_AffineMatrix* pMatrix,
393 CFX_GlyphBitmap*» » RenderGlyph_Nativetext(CFX_Font* pFont, FX_DWORD glyph_index, 407 int dest_width,
394 const CFX_AffineMatrix* pMatrix, int dest_width, int anti_alias); 408 int anti_alias);
395 CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, const CFX_AffineM atrix* pMatrix, CFX_ByteStringC& FaceGlyphsKey, 409 CFX_GlyphBitmap* RenderGlyph_Nativetext(CFX_Font* pFont,
396 FX_DWORD glyph_index, FX_BOOL bFontStyle, int dest_width, int anti_a lias); 410 FX_DWORD glyph_index,
397 CFX_MapByteStringToPtr» m_SizeMap; 411 const CFX_AffineMatrix* pMatrix,
398 CFX_MapPtrToPtr» » » m_PathMap; 412 int dest_width,
399 CFX_DIBitmap* m_pBitmap; 413 int anti_alias);
400 void* m_pPlatformGraphics; 414 CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont,
401 void* m_pPlatformBitmap; 415 const CFX_AffineMatrix* pMatrix,
402 void* m_hDC; 416 CFX_ByteStringC& FaceGlyphsKey,
403 void* m_hBitmap; 417 FX_DWORD glyph_index,
404 void* m_hOldBitmap; 418 FX_BOOL bFontStyle,
405 void* m_hGdiFont; 419 int dest_width,
406 void* m_hOldGdiFont; 420 int anti_alias);
407 421 CFX_MapByteStringToPtr m_SizeMap;
408 void» » » » InitPlatform(); 422 CFX_MapPtrToPtr m_PathMap;
409 void» » » » DestroyPlatform(); 423 CFX_DIBitmap* m_pBitmap;
424 void* m_pPlatformGraphics;
425 void* m_pPlatformBitmap;
426 void* m_hDC;
427 void* m_hBitmap;
428 void* m_hOldBitmap;
429 void* m_hGdiFont;
430 void* m_hOldGdiFont;
431
432 void InitPlatform();
433 void DestroyPlatform();
410 }; 434 };
411 typedef struct { 435 typedef struct {
412 const CFX_GlyphBitmap*» m_pGlyph; 436 const CFX_GlyphBitmap* m_pGlyph;
413 int»» » » » m_OriginX, m_OriginY; 437 int m_OriginX, m_OriginY;
414 FX_FLOAT» » » m_fOriginX, m_fOriginY; 438 FX_FLOAT m_fOriginX, m_fOriginY;
415 } FXTEXT_GLYPHPOS; 439 } FXTEXT_GLYPHPOS;
416 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, int nChars, int anti_a lias, FX_FLOAT retinaScaleX = 1.0f, FX_FLOAT retinaScaleY = 1.0f); 440 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos,
417 FX_BOOL»OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, double font_size, 441 int nChars,
418 CFX_AffineMatrix* pMatrix, unsigned long glyph_index, unsign ed long argb); 442 int anti_alias,
419 FX_BOOL»OutputText(void* dib, int x, int y, CFX_Font* pFont, double font_size, 443 FX_FLOAT retinaScaleX = 1.0f,
420 CFX_AffineMatrix* pText_matrix, unsigned short const* text, u nsigned long argb); 444 FX_FLOAT retinaScaleY = 1.0f);
421 class IFX_GSUBTable 445 FX_BOOL OutputGlyph(void* dib,
422 { 446 int x,
423 public: 447 int y,
424 virtual void» Release() = 0; 448 CFX_Font* pFont,
425 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0 ; 449 double font_size,
450 CFX_AffineMatrix* pMatrix,
451 unsigned long glyph_index,
452 unsigned long argb);
453 FX_BOOL OutputText(void* dib,
454 int x,
455 int y,
456 CFX_Font* pFont,
457 double font_size,
458 CFX_AffineMatrix* pText_matrix,
459 unsigned short const* text,
460 unsigned long argb);
461 class IFX_GSUBTable {
462 public:
463 virtual void Release() = 0;
464 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0;
426 }; 465 };
427 IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont); 466 IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont);
428 #endif 467 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698