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 XFA_FGAS_FONT_FGAS_FONT_H_ | 7 #ifndef XFA_FGAS_FONT_FGAS_FONT_H_ |
8 #define XFA_FGAS_FONT_FGAS_FONT_H_ | 8 #define XFA_FGAS_FONT_FGAS_FONT_H_ |
9 | 9 |
10 #include "core/fxge/include/fx_font.h" | 10 #include "core/fxge/include/fx_font.h" |
11 #include "xfa/fgas/crt/fgas_stream.h" | 11 #include "xfa/fgas/crt/fgas_stream.h" |
12 | 12 |
13 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 13 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
14 #include "xfa/fgas/crt/fgas_memory.h" | 14 #include "xfa/fgas/crt/fgas_memory.h" |
15 #include "xfa/fgas/crt/fgas_utils.h" | 15 #include "xfa/fgas/crt/fgas_utils.h" |
16 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 16 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
17 | 17 |
| 18 class CFX_FontSourceEnum_File; |
| 19 class CXFA_PDFFontMgr; |
18 class IFX_Font; | 20 class IFX_Font; |
19 class IFX_FontMgr; | 21 class IFX_FontMgr; |
20 | 22 |
21 #define FX_FONTSTYLE_Normal 0x00 | 23 #define FX_FONTSTYLE_Normal 0x00 |
22 #define FX_FONTSTYLE_FixedPitch 0x01 | 24 #define FX_FONTSTYLE_FixedPitch 0x01 |
23 #define FX_FONTSTYLE_Serif 0x02 | 25 #define FX_FONTSTYLE_Serif 0x02 |
24 #define FX_FONTSTYLE_Symbolic 0x04 | 26 #define FX_FONTSTYLE_Symbolic 0x04 |
25 #define FX_FONTSTYLE_Script 0x08 | 27 #define FX_FONTSTYLE_Script 0x08 |
26 #define FX_FONTSTYLE_Italic 0x40 | 28 #define FX_FONTSTYLE_Italic 0x40 |
27 #define FX_FONTSTYLE_Bold 0x40000 | 29 #define FX_FONTSTYLE_Bold 0x40000 |
(...skipping 13 matching lines...) Expand all Loading... |
41 #define FX_FONTDECORATION_Shadow 0x00000400 | 43 #define FX_FONTDECORATION_Shadow 0x00000400 |
42 #define FX_FONTDECORATION_BoundingShape 0x20000000 | 44 #define FX_FONTDECORATION_BoundingShape 0x20000000 |
43 #define FX_FONTDECORATION_Hide 0x40000000 | 45 #define FX_FONTDECORATION_Hide 0x40000000 |
44 #define FX_FONTDECORATION_StrokeFill 0x80000000 | 46 #define FX_FONTDECORATION_StrokeFill 0x80000000 |
45 #define FX_BOUNDINGSHAPE_None 0 | 47 #define FX_BOUNDINGSHAPE_None 0 |
46 #define FX_BOUNDINGSHAPE_Circle 1 | 48 #define FX_BOUNDINGSHAPE_Circle 1 |
47 #define FX_BOUNDINGSHAPE_Square 2 | 49 #define FX_BOUNDINGSHAPE_Square 2 |
48 #define FX_BOUNDINGSHAPE_Triangle 3 | 50 #define FX_BOUNDINGSHAPE_Triangle 3 |
49 #define FX_BOUNDINGSHAPE_Diamond 4 | 51 #define FX_BOUNDINGSHAPE_Diamond 4 |
50 | 52 |
51 class IFX_FontProvider { | |
52 public: | |
53 virtual ~IFX_FontProvider() {} | |
54 virtual FX_BOOL GetCharWidth(IFX_Font* pFont, | |
55 FX_WCHAR wUnicode, | |
56 int32_t& iWidth, | |
57 FX_BOOL bCharCode = FALSE) = 0; | |
58 }; | |
59 | |
60 class IFX_Font { | 53 class IFX_Font { |
61 public: | 54 public: |
62 static IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, | 55 static IFX_Font* LoadFont(const FX_WCHAR* pszFontFamily, |
63 uint32_t dwFontStyles, | 56 uint32_t dwFontStyles, |
64 uint16_t wCodePage, | 57 uint16_t wCodePage, |
65 IFX_FontMgr* pFontMgr); | 58 IFX_FontMgr* pFontMgr); |
66 static IFX_Font* LoadFont(const uint8_t* pBuffer, | 59 static IFX_Font* LoadFont(const uint8_t* pBuffer, |
67 int32_t iLength, | 60 int32_t iLength, |
68 IFX_FontMgr* pFontMgr); | 61 IFX_FontMgr* pFontMgr); |
69 static IFX_Font* LoadFont(const FX_WCHAR* pszFileName, IFX_FontMgr* pFontMgr); | 62 static IFX_Font* LoadFont(const FX_WCHAR* pszFileName, IFX_FontMgr* pFontMgr); |
(...skipping 19 matching lines...) Expand all Loading... |
89 virtual int32_t GetAscent() const = 0; | 82 virtual int32_t GetAscent() const = 0; |
90 virtual int32_t GetDescent() const = 0; | 83 virtual int32_t GetDescent() const = 0; |
91 virtual FX_BOOL GetCharBBox(FX_WCHAR wUnicode, | 84 virtual FX_BOOL GetCharBBox(FX_WCHAR wUnicode, |
92 CFX_Rect& bbox, | 85 CFX_Rect& bbox, |
93 FX_BOOL bCharCode = FALSE) = 0; | 86 FX_BOOL bCharCode = FALSE) = 0; |
94 virtual FX_BOOL GetBBox(CFX_Rect& bbox) = 0; | 87 virtual FX_BOOL GetBBox(CFX_Rect& bbox) = 0; |
95 virtual int32_t GetItalicAngle() const = 0; | 88 virtual int32_t GetItalicAngle() const = 0; |
96 virtual void Reset() = 0; | 89 virtual void Reset() = 0; |
97 virtual IFX_Font* GetSubstFont(int32_t iGlyphIndex) const = 0; | 90 virtual IFX_Font* GetSubstFont(int32_t iGlyphIndex) const = 0; |
98 virtual void* GetDevFont() const = 0; | 91 virtual void* GetDevFont() const = 0; |
99 virtual void SetFontProvider(IFX_FontProvider* pProvider) = 0; | 92 virtual void SetFontProvider(CXFA_PDFFontMgr* pProvider) = 0; |
100 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 93 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
101 virtual void SetLogicalFontStyle(uint32_t dwLogFontStyle) = 0; | 94 virtual void SetLogicalFontStyle(uint32_t dwLogFontStyle) = 0; |
102 #endif | 95 #endif |
103 }; | 96 }; |
104 | 97 |
105 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 98 #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
106 struct FX_FONTMATCHPARAMS { | 99 struct FX_FONTMATCHPARAMS { |
107 const FX_WCHAR* pwsFamily; | 100 const FX_WCHAR* pwsFamily; |
108 uint32_t dwFontStyles; | 101 uint32_t dwFontStyles; |
109 uint32_t dwUSB; | 102 uint32_t dwUSB; |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 FX_BOOL bSaveStream = FALSE) = 0; | 178 FX_BOOL bSaveStream = FALSE) = 0; |
186 virtual IFX_Font* LoadFont(IFX_Font* pSrcFont, | 179 virtual IFX_Font* LoadFont(IFX_Font* pSrcFont, |
187 uint32_t dwFontStyles, | 180 uint32_t dwFontStyles, |
188 uint16_t wCodePage = 0xFFFF) = 0; | 181 uint16_t wCodePage = 0xFFFF) = 0; |
189 virtual void ClearFontCache() = 0; | 182 virtual void ClearFontCache() = 0; |
190 virtual void RemoveFont(IFX_Font* pFont) = 0; | 183 virtual void RemoveFont(IFX_Font* pFont) = 0; |
191 }; | 184 }; |
192 | 185 |
193 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 186 #else // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
194 | 187 |
195 class IFX_FontSourceEnum { | |
196 public: | |
197 virtual ~IFX_FontSourceEnum() {} | |
198 virtual void Release() = 0; | |
199 virtual FX_POSITION GetStartPosition() = 0; | |
200 virtual IFX_FileAccess* GetNext(FX_POSITION& pos) = 0; | |
201 }; | |
202 IFX_FontSourceEnum* FX_CreateDefaultFontSourceEnum(); | |
203 class IFX_FontMgr { | 188 class IFX_FontMgr { |
204 public: | 189 public: |
205 static IFX_FontMgr* Create(IFX_FontSourceEnum* pFontEnum); | 190 static IFX_FontMgr* Create(CFX_FontSourceEnum_File* pFontEnum); |
206 virtual ~IFX_FontMgr() {} | 191 virtual ~IFX_FontMgr() {} |
207 virtual void Release() = 0; | 192 virtual void Release() = 0; |
208 virtual IFX_Font* GetDefFontByCodePage( | 193 virtual IFX_Font* GetDefFontByCodePage( |
209 uint16_t wCodePage, | 194 uint16_t wCodePage, |
210 uint32_t dwFontStyles, | 195 uint32_t dwFontStyles, |
211 const FX_WCHAR* pszFontFamily = NULL) = 0; | 196 const FX_WCHAR* pszFontFamily = NULL) = 0; |
212 virtual IFX_Font* GetDefFontByCharset( | 197 virtual IFX_Font* GetDefFontByCharset( |
213 uint8_t nCharset, | 198 uint8_t nCharset, |
214 uint32_t dwFontStyles, | 199 uint32_t dwFontStyles, |
215 const FX_WCHAR* pszFontFamily = NULL) = 0; | 200 const FX_WCHAR* pszFontFamily = NULL) = 0; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 int32_t iFaceIndex, | 234 int32_t iFaceIndex, |
250 int32_t* pFaceCount = NULL, | 235 int32_t* pFaceCount = NULL, |
251 FX_BOOL bSaveStream = FALSE) = 0; | 236 FX_BOOL bSaveStream = FALSE) = 0; |
252 | 237 |
253 virtual void ClearFontCache() = 0; | 238 virtual void ClearFontCache() = 0; |
254 virtual void RemoveFont(IFX_Font* pFont) = 0; | 239 virtual void RemoveFont(IFX_Font* pFont) = 0; |
255 }; | 240 }; |
256 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ | 241 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ |
257 | 242 |
258 #endif // XFA_FGAS_FONT_FGAS_FONT_H_ | 243 #endif // XFA_FGAS_FONT_FGAS_FONT_H_ |
OLD | NEW |