| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | 53 class CFX_Font |
| 54 { | 54 { |
| 55 public: | 55 public: |
| 56 CFX_Font(); | 56 CFX_Font(); |
| 57 ~CFX_Font(); | 57 ~CFX_Font(); |
| 58 | 58 |
| 59 FX_BOOL» » » » » LoadSubst(const CFX_ByteString&
face_name, FX_BOOL bTrueType, FX_DWORD flags, | 59 bool» » » » » LoadSubst(const CFX_ByteString&
face_name, bool bTrueType, FX_DWORD flags, |
| 60 int weight, int italic_angle, int CharsetC
P, FX_BOOL bVertical = FALSE); | 60 int weight, int italic_angle, int CharsetC
P, bool bVertical = false); |
| 61 | 61 |
| 62 FX_BOOL» » » » » LoadEmbedded(const uint8_t* data
, FX_DWORD size); | 62 bool» » » » » LoadEmbedded(const uint8_t* data
, FX_DWORD size); |
| 63 | 63 |
| 64 FX_BOOL» » » » » LoadFile(IFX_FileRead* pFile); | 64 bool» » » » » LoadFile(IFX_FileRead* pFile); |
| 65 | 65 |
| 66 FXFT_Face GetFace() const | 66 FXFT_Face GetFace() const |
| 67 { | 67 { |
| 68 return m_Face; | 68 return m_Face; |
| 69 } | 69 } |
| 70 | 70 |
| 71 | 71 |
| 72 const CFX_SubstFont* GetSubstFont() const | 72 const CFX_SubstFont* GetSubstFont() const |
| 73 { | 73 { |
| 74 return m_pSubstFont; | 74 return m_pSubstFont; |
| 75 } | 75 } |
| 76 | 76 |
| 77 CFX_PathData* LoadGlyphPath(FX_DWORD glyph_index, int
dest_width = 0); | 77 CFX_PathData* LoadGlyphPath(FX_DWORD glyph_index, int
dest_width = 0); |
| 78 | 78 |
| 79 int GetGlyphWidth(FX_DWORD glyph_ind
ex); | 79 int GetGlyphWidth(FX_DWORD glyph_ind
ex); |
| 80 | 80 |
| 81 int GetAscent() const; | 81 int GetAscent() const; |
| 82 | 82 |
| 83 int GetDescent() const; | 83 int GetDescent() const; |
| 84 | 84 |
| 85 FX_BOOL GetGlyphBBox(FX_DWORD glyph_index, FX_RECT &bbox); | 85 bool GetGlyphBBox(FX_DWORD glyph_index, FX_RECT &bbox); |
| 86 | 86 |
| 87 FX_BOOL IsItalic(); | 87 bool IsItalic(); |
| 88 | 88 |
| 89 FX_BOOL IsBold(); | 89 bool IsBold(); |
| 90 | 90 |
| 91 FX_BOOL IsFixedWidth(); | 91 bool IsFixedWidth(); |
| 92 | 92 |
| 93 FX_BOOL» » » » » IsVertical() const | 93 bool» » » » » IsVertical() const |
| 94 { | 94 { |
| 95 return m_bVertical; | 95 return m_bVertical; |
| 96 } | 96 } |
| 97 | 97 |
| 98 CFX_WideString GetPsName() const; | 98 CFX_WideString GetPsName() const; |
| 99 | 99 |
| 100 | 100 |
| 101 CFX_ByteString GetFamilyName() const; | 101 CFX_ByteString GetFamilyName() const; |
| 102 | 102 |
| 103 CFX_ByteString GetFaceName() const; | 103 CFX_ByteString GetFaceName() const; |
| 104 | 104 |
| 105 | 105 |
| 106 FX_BOOL IsTTFont(); | 106 bool IsTTFont(); |
| 107 | 107 |
| 108 FX_BOOL GetBBox(FX_RECT &bbox); | 108 bool GetBBox(FX_RECT &bbox); |
| 109 | 109 |
| 110 int GetHeight(); | 110 int GetHeight(); |
| 111 | 111 |
| 112 int GetULPos(); | 112 int GetULPos(); |
| 113 | 113 |
| 114 int GetULthickness(); | 114 int GetULthickness(); |
| 115 | 115 |
| 116 int GetMaxAdvanceWidth(); | 116 int GetMaxAdvanceWidth(); |
| 117 | 117 |
| 118 FXFT_Face m_Face; | 118 FXFT_Face m_Face; |
| 119 | 119 |
| 120 CFX_SubstFont* m_pSubstFont; | 120 CFX_SubstFont* m_pSubstFont; |
| 121 FX_BOOL» » » » » IsEmbedded() | 121 bool» » » » » IsEmbedded() |
| 122 { | 122 { |
| 123 return m_bEmbedded; | 123 return m_bEmbedded; |
| 124 } | 124 } |
| 125 | 125 |
| 126 void AdjustMMParams(int glyph_index,
int width, int weight); | 126 void AdjustMMParams(int glyph_index,
int width, int weight); |
| 127 uint8_t* m_pFontDataAllocation; | 127 uint8_t* m_pFontDataAllocation; |
| 128 uint8_t* m_pFontData; | 128 uint8_t* m_pFontData; |
| 129 uint8_t* m_pGsubData; | 129 uint8_t* m_pGsubData; |
| 130 FX_DWORD m_dwSize; | 130 FX_DWORD m_dwSize; |
| 131 CFX_BinaryBuf m_OtfFontData; | 131 CFX_BinaryBuf m_OtfFontData; |
| 132 void* m_hHandle; | 132 void* m_hHandle; |
| 133 void* m_pPlatformFont; | 133 void* m_pPlatformFont; |
| 134 void* m_pPlatformFontCollection; | 134 void* m_pPlatformFontCollection; |
| 135 void* m_pDwFont; | 135 void* m_pDwFont; |
| 136 FX_BOOL m_bDwLoaded; | 136 bool m_bDwLoaded; |
| 137 void ReleasePlatformResource(); | 137 void ReleasePlatformResource(); |
| 138 | 138 |
| 139 void DeleteFace(); | 139 void DeleteFace(); |
| 140 protected: | 140 protected: |
| 141 | 141 |
| 142 FX_BOOL» » » » » m_bEmbedded; | 142 bool» » » » » m_bEmbedded; |
| 143 FX_BOOL» » » » » m_bVertical; | 143 bool» » » » » m_bVertical; |
| 144 void* m_pOwnedStream; | 144 void* m_pOwnedStream; |
| 145 }; | 145 }; |
| 146 #define ENCODING_INTERNAL 0 | 146 #define ENCODING_INTERNAL 0 |
| 147 #define ENCODING_UNICODE 1 | 147 #define ENCODING_UNICODE 1 |
| 148 class IFX_FontEncoding | 148 class IFX_FontEncoding |
| 149 { | 149 { |
| 150 public: | 150 public: |
| 151 virtual ~IFX_FontEncoding() {} | 151 virtual ~IFX_FontEncoding() {} |
| 152 | 152 |
| 153 virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode) = 0; | 153 virtual FX_DWORD GlyphFromCharCode(FX_DWORD charcode) = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 175 CFX_ByteString m_Family; | 175 CFX_ByteString m_Family; |
| 176 | 176 |
| 177 int m_Charset; | 177 int m_Charset; |
| 178 | 178 |
| 179 FX_DWORD m_SubstFlags; | 179 FX_DWORD m_SubstFlags; |
| 180 | 180 |
| 181 int m_Weight; | 181 int m_Weight; |
| 182 | 182 |
| 183 int m_ItalicAngle; | 183 int m_ItalicAngle; |
| 184 | 184 |
| 185 FX_BOOL» » » » » m_bSubstOfCJK; | 185 bool» » » » » m_bSubstOfCJK; |
| 186 | 186 |
| 187 int m_WeightCJK; | 187 int m_WeightCJK; |
| 188 | 188 |
| 189 FX_BOOL» » » » » m_bItlicCJK; | 189 bool» » » » » m_bItlicCJK; |
| 190 }; | 190 }; |
| 191 #define FX_FONT_FLAG_SERIF 0x01 | 191 #define FX_FONT_FLAG_SERIF 0x01 |
| 192 #define FX_FONT_FLAG_FIXEDPITCH 0x02 | 192 #define FX_FONT_FLAG_FIXEDPITCH 0x02 |
| 193 #define FX_FONT_FLAG_ITALIC 0x04 | 193 #define FX_FONT_FLAG_ITALIC 0x04 |
| 194 #define FX_FONT_FLAG_BOLD 0x08 | 194 #define FX_FONT_FLAG_BOLD 0x08 |
| 195 #define FX_FONT_FLAG_SYMBOLIC_SYMBOL 0x10 | 195 #define FX_FONT_FLAG_SYMBOLIC_SYMBOL 0x10 |
| 196 #define FX_FONT_FLAG_SYMBOLIC_DINGBATS 0x20 | 196 #define FX_FONT_FLAG_SYMBOLIC_DINGBATS 0x20 |
| 197 #define FX_FONT_FLAG_MULTIPLEMASTER 0x40 | 197 #define FX_FONT_FLAG_MULTIPLEMASTER 0x40 |
| 198 typedef struct { | 198 typedef struct { |
| 199 const uint8_t* m_pFontData; | 199 const uint8_t* m_pFontData; |
| 200 FX_DWORD m_dwSize; | 200 FX_DWORD m_dwSize; |
| 201 } FoxitFonts; | 201 } FoxitFonts; |
| 202 class CFX_FontMgr | 202 class CFX_FontMgr |
| 203 { | 203 { |
| 204 public: | 204 public: |
| 205 CFX_FontMgr(); | 205 CFX_FontMgr(); |
| 206 ~CFX_FontMgr(); | 206 ~CFX_FontMgr(); |
| 207 void InitFTLibrary(); | 207 void InitFTLibrary(); |
| 208 FXFT_Face GetCachedFace(const CFX_ByteString& face_name, | 208 FXFT_Face GetCachedFace(const CFX_ByteString& face_name, |
| 209 int weight, FX_BOOL bItalic, uint8_t*& pFontDa
ta); | 209 int weight, bool bItalic, uint8_t*& pFontData)
; |
| 210 FXFT_Face AddCachedFace(const CFX_ByteString& face_name, | 210 FXFT_Face AddCachedFace(const CFX_ByteString& face_name, |
| 211 int weight, FX_BOOL bItalic, uint8_t* pData, F
X_DWORD size, int face_index); | 211 int weight, bool bItalic, uint8_t* pData, FX_D
WORD size, int face_index); |
| 212 FXFT_Face GetCachedTTCFace(int ttc_size, FX_DWORD checksum, | 212 FXFT_Face GetCachedTTCFace(int ttc_size, FX_DWORD checksum, |
| 213 int font_offset, uint8_t*& pFontData); | 213 int font_offset, uint8_t*& pFontData); |
| 214 FXFT_Face AddCachedTTCFace(int ttc_size, FX_DWORD checksum, | 214 FXFT_Face AddCachedTTCFace(int ttc_size, FX_DWORD checksum, |
| 215 uint8_t* pData, FX_DWORD size, int font_off
set); | 215 uint8_t* pData, FX_DWORD size, int font_off
set); |
| 216 FXFT_Face GetFileFace(const FX_CHAR* filename, int face_index); | 216 FXFT_Face GetFileFace(const FX_CHAR* filename, int face_index); |
| 217 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int fa
ce_index); | 217 FXFT_Face GetFixedFace(const uint8_t* pData, FX_DWORD size, int fa
ce_index); |
| 218 void ReleaseFace(FXFT_Face face); | 218 void ReleaseFace(FXFT_Face face); |
| 219 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo)
; | 219 void SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo)
; |
| 220 FXFT_Face» » FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b
TrueType, FX_DWORD flags, | 220 FXFT_Face» » FindSubstFont(const CFX_ByteString& face_name, bool bTru
eType, FX_DWORD flags, |
| 221 int weight, int italic_angle, int CharsetCP, C
FX_SubstFont* pSubstFont); | 221 int weight, int italic_angle, int CharsetCP, C
FX_SubstFont* pSubstFont); |
| 222 | 222 |
| 223 void FreeCache(); | 223 void FreeCache(); |
| 224 | 224 |
| 225 FX_BOOL» » » GetStandardFont(const uint8_t*& pFontData, FX_DW
ORD& size, int index); | 225 bool» » » GetStandardFont(const uint8_t*& pFontData, FX_DW
ORD& size, int index); |
| 226 CFX_FontMapper* m_pBuiltinMapper; | 226 CFX_FontMapper* m_pBuiltinMapper; |
| 227 IFX_FontMapper* m_pExtMapper; | 227 IFX_FontMapper* m_pExtMapper; |
| 228 CFX_MapByteStringToPtr m_FaceMap; | 228 CFX_MapByteStringToPtr m_FaceMap; |
| 229 FXFT_Library m_FTLibrary; | 229 FXFT_Library m_FTLibrary; |
| 230 FoxitFonts m_ExternalFonts[16]; | 230 FoxitFonts m_ExternalFonts[16]; |
| 231 }; | 231 }; |
| 232 class IFX_FontMapper | 232 class IFX_FontMapper |
| 233 { | 233 { |
| 234 public: | 234 public: |
| 235 | 235 |
| 236 virtual ~IFX_FontMapper() {} | 236 virtual ~IFX_FontMapper() {} |
| 237 | 237 |
| 238 virtual FXFT_Face» FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b
TrueType, FX_DWORD flags, | 238 virtual FXFT_Face» FindSubstFont(const CFX_ByteString& face_name, bool bTru
eType, FX_DWORD flags, |
| 239 int weight, int italic_angle, int CharsetC
P, CFX_SubstFont* pSubstFont) = 0; | 239 int weight, int italic_angle, int CharsetC
P, CFX_SubstFont* pSubstFont) = 0; |
| 240 | 240 |
| 241 CFX_FontMgr* m_pFontMgr; | 241 CFX_FontMgr* m_pFontMgr; |
| 242 }; | 242 }; |
| 243 class IFX_FontEnumerator | 243 class IFX_FontEnumerator |
| 244 { | 244 { |
| 245 public: | 245 public: |
| 246 virtual ~IFX_FontEnumerator() { } | 246 virtual ~IFX_FontEnumerator() { } |
| 247 | 247 |
| 248 virtual void HitFont() = 0; | 248 virtual void HitFont() = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 270 void LoadInstalledFonts(); | 270 void LoadInstalledFonts(); |
| 271 CFX_ByteStringArray m_InstalledTTFonts; | 271 CFX_ByteStringArray m_InstalledTTFonts; |
| 272 void SetFontEnumerator(IFX_FontEnumerator* pF
ontEnumerator) | 272 void SetFontEnumerator(IFX_FontEnumerator* pF
ontEnumerator) |
| 273 { | 273 { |
| 274 m_pFontEnumerator = pFontEnumerator; | 274 m_pFontEnumerator = pFontEnumerator; |
| 275 } | 275 } |
| 276 IFX_FontEnumerator* GetFontEnumerator() const | 276 IFX_FontEnumerator* GetFontEnumerator() const |
| 277 { | 277 { |
| 278 return m_pFontEnumerator; | 278 return m_pFontEnumerator; |
| 279 } | 279 } |
| 280 virtual FXFT_Face» FindSubstFont(const CFX_ByteString& face_name, FX_BOOL b
TrueType, FX_DWORD flags, | 280 virtual FXFT_Face» FindSubstFont(const CFX_ByteString& face_name, bool bTru
eType, FX_DWORD flags, |
| 281 int weight, int italic_angle, int CharsetC
P, CFX_SubstFont* pSubstFont); | 281 int weight, int italic_angle, int CharsetC
P, CFX_SubstFont* pSubstFont); |
| 282 private: | 282 private: |
| 283 CFX_ByteString GetPSNameFromTT(void* hFont); | 283 CFX_ByteString GetPSNameFromTT(void* hFont); |
| 284 CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_n
ame); | 284 CFX_ByteString MatchInstalledFonts(const CFX_ByteString& norm_n
ame); |
| 285 FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont, int
iBaseFont, int italic_angle, int weight, int picthfamily); | 285 FXFT_Face UseInternalSubst(CFX_SubstFont* pSubstFont, int
iBaseFont, int italic_angle, int weight, int picthfamily); |
| 286 | 286 |
| 287 FX_BOOL» » » » m_bListLoaded; | 287 bool» » » » m_bListLoaded; |
| 288 FXFT_Face m_MMFaces[2]; | 288 FXFT_Face m_MMFaces[2]; |
| 289 CFX_ByteString m_LastFamily; | 289 CFX_ByteString m_LastFamily; |
| 290 CFX_DWordArray m_CharsetArray; | 290 CFX_DWordArray m_CharsetArray; |
| 291 CFX_ByteStringArray m_FaceArray; | 291 CFX_ByteStringArray m_FaceArray; |
| 292 IFX_SystemFontInfo* m_pFontInfo; | 292 IFX_SystemFontInfo* m_pFontInfo; |
| 293 FXFT_Face m_FoxitFaces[14]; | 293 FXFT_Face m_FoxitFaces[14]; |
| 294 IFX_FontEnumerator* m_pFontEnumerator; | 294 IFX_FontEnumerator* m_pFontEnumerator; |
| 295 }; | 295 }; |
| 296 class IFX_SystemFontInfo | 296 class IFX_SystemFontInfo |
| 297 { | 297 { |
| 298 public: | 298 public: |
| 299 static IFX_SystemFontInfo* CreateDefault(); | 299 static IFX_SystemFontInfo* CreateDefault(); |
| 300 virtual void Release() = 0; | 300 virtual void Release() = 0; |
| 301 | 301 |
| 302 virtual» FX_BOOL»» EnumFontList(CFX_FontMapper* pMapper) = 0; | 302 virtual» bool» » EnumFontList(CFX_FontMapper* pMapper) = 0; |
| 303 virtual void*» » MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact) = 0; | 303 virtual void*» » MapFont(int weight, bool bItalic, int charset, i
nt pitch_family, const FX_CHAR* face, int& iExact) = 0; |
| 304 virtual void* GetFont(const FX_CHAR* face) = 0; | 304 virtual void* GetFont(const FX_CHAR* face) = 0; |
| 305 virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer
, FX_DWORD size) = 0; | 305 virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer
, FX_DWORD size) = 0; |
| 306 virtual FX_BOOL» » GetFaceName(void* hFont, CFX_ByteString& name) =
0; | 306 virtual bool» » GetFaceName(void* hFont, CFX_ByteString& name) =
0; |
| 307 virtual FX_BOOL» » GetFontCharset(void* hFont, int& charset) = 0; | 307 virtual bool» » GetFontCharset(void* hFont, int& charset) = 0; |
| 308 virtual int GetFaceIndex(void* hFont) | 308 virtual int GetFaceIndex(void* hFont) |
| 309 { | 309 { |
| 310 return 0; | 310 return 0; |
| 311 } | 311 } |
| 312 virtual void DeleteFont(void* hFont) = 0; | 312 virtual void DeleteFont(void* hFont) = 0; |
| 313 virtual void* RetainFont(void* hFont) | 313 virtual void* RetainFont(void* hFont) |
| 314 { | 314 { |
| 315 return NULL; | 315 return NULL; |
| 316 } | 316 } |
| 317 protected: | 317 protected: |
| 318 ~IFX_SystemFontInfo() { } | 318 ~IFX_SystemFontInfo() { } |
| 319 }; | 319 }; |
| 320 class CFX_FolderFontInfo : public IFX_SystemFontInfo | 320 class CFX_FolderFontInfo : public IFX_SystemFontInfo |
| 321 { | 321 { |
| 322 public: | 322 public: |
| 323 CFX_FolderFontInfo(); | 323 CFX_FolderFontInfo(); |
| 324 virtual ~CFX_FolderFontInfo(); | 324 virtual ~CFX_FolderFontInfo(); |
| 325 void AddPath(const CFX_ByteStringC& path); | 325 void AddPath(const CFX_ByteStringC& path); |
| 326 virtual void Release(); | 326 virtual void Release(); |
| 327 virtual» FX_BOOL»» EnumFontList(CFX_FontMapper* pMapper); | 327 virtual» bool» » EnumFontList(CFX_FontMapper* pMapper); |
| 328 virtual void*» » MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, const FX_CHAR* face, FX_BOOL& bExact); | 328 virtual void*» » MapFont(int weight, bool bItalic, int charset, i
nt pitch_family, const FX_CHAR* face, bool& bExact); |
| 329 virtual void* GetFont(const FX_CHAR* face); | 329 virtual void* GetFont(const FX_CHAR* face); |
| 330 virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer
, FX_DWORD size); | 330 virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t* buffer
, FX_DWORD size); |
| 331 virtual void DeleteFont(void* hFont); | 331 virtual void DeleteFont(void* hFont); |
| 332 virtual» FX_BOOL»» GetFaceName(void* hFont, CFX_ByteString& name); | 332 virtual» bool» » GetFaceName(void* hFont, CFX_ByteString& name); |
| 333 virtual FX_BOOL» » GetFontCharset(void* hFont, int& charset); | 333 virtual bool» » GetFontCharset(void* hFont, int& charset); |
| 334 protected: | 334 protected: |
| 335 CFX_MapByteStringToPtr m_FontList; | 335 CFX_MapByteStringToPtr m_FontList; |
| 336 CFX_ByteStringArray m_PathList; | 336 CFX_ByteStringArray m_PathList; |
| 337 CFX_FontMapper* m_pMapper; | 337 CFX_FontMapper* m_pMapper; |
| 338 void ScanPath(CFX_ByteString& path); | 338 void ScanPath(CFX_ByteString& path); |
| 339 void ScanFile(CFX_ByteString& path); | 339 void ScanFile(CFX_ByteString& path); |
| 340 void ReportFace(CFX_ByteString& path, FXSYS_F
ILE* pFile, FX_DWORD filesize, FX_DWORD offset); | 340 void ReportFace(CFX_ByteString& path, FXSYS_F
ILE* pFile, FX_DWORD filesize, FX_DWORD offset); |
| 341 }; | 341 }; |
| 342 class CFX_CountedFaceCache | 342 class CFX_CountedFaceCache |
| 343 { | 343 { |
| 344 public: | 344 public: |
| 345 CFX_FaceCache* m_Obj; | 345 CFX_FaceCache* m_Obj; |
| 346 FX_DWORD m_nCount; | 346 FX_DWORD m_nCount; |
| 347 }; | 347 }; |
| 348 | 348 |
| 349 class CFX_FontCache | 349 class CFX_FontCache |
| 350 { | 350 { |
| 351 public: | 351 public: |
| 352 ~CFX_FontCache(); | 352 ~CFX_FontCache(); |
| 353 CFX_FaceCache* GetCachedFace(CFX_Font* pFont); | 353 CFX_FaceCache* GetCachedFace(CFX_Font* pFont); |
| 354 void ReleaseCachedFace(CFX_Font* pFon
t); | 354 void ReleaseCachedFace(CFX_Font* pFon
t); |
| 355 void» » » » » FreeCache(FX_BOOL bRelease = FAL
SE); | 355 void» » » » » FreeCache(bool bRelease = false)
; |
| 356 | 356 |
| 357 private: | 357 private: |
| 358 using CFX_FTCacheMap = std::map<FXFT_Face, CFX_CountedFaceCache*>; | 358 using CFX_FTCacheMap = std::map<FXFT_Face, CFX_CountedFaceCache*>; |
| 359 CFX_FTCacheMap m_FTFaceMap; | 359 CFX_FTCacheMap m_FTFaceMap; |
| 360 CFX_FTCacheMap m_ExtFaceMap; | 360 CFX_FTCacheMap m_ExtFaceMap; |
| 361 }; | 361 }; |
| 362 class CFX_AutoFontCache | 362 class CFX_AutoFontCache |
| 363 { | 363 { |
| 364 public: | 364 public: |
| 365 CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont) | 365 CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 379 { | 379 { |
| 380 public: | 380 public: |
| 381 int m_Top; | 381 int m_Top; |
| 382 int m_Left; | 382 int m_Left; |
| 383 CFX_DIBitmap m_Bitmap; | 383 CFX_DIBitmap m_Bitmap; |
| 384 }; | 384 }; |
| 385 class CFX_FaceCache | 385 class CFX_FaceCache |
| 386 { | 386 { |
| 387 public: | 387 public: |
| 388 ~CFX_FaceCache(); | 388 ~CFX_FaceCache(); |
| 389 const CFX_GlyphBitmap*» LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD glyph_
index, FX_BOOL bFontStyle, const CFX_AffineMatrix* pMatrix, | 389 const CFX_GlyphBitmap*» LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD glyph_
index, bool bFontStyle, const CFX_AffineMatrix* pMatrix, |
| 390 int dest_width, int anti_alias, int&
text_flags); | 390 int dest_width, int anti_alias, int&
text_flags); |
| 391 const CFX_PathData* LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph_in
dex, int dest_width); | 391 const CFX_PathData* LoadGlyphPath(CFX_Font* pFont, FX_DWORD glyph_in
dex, int dest_width); |
| 392 | 392 |
| 393 | 393 |
| 394 CFX_FaceCache(FXFT_Face face); | 394 CFX_FaceCache(FXFT_Face face); |
| 395 private: | 395 private: |
| 396 FXFT_Face m_Face; | 396 FXFT_Face m_Face; |
| 397 CFX_GlyphBitmap*» » RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde
x, FX_BOOL bFontStyle, | 397 CFX_GlyphBitmap*» » RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde
x, bool bFontStyle, |
| 398 const CFX_AffineMatrix* pMatrix, int des
t_width, int anti_alias); | 398 const CFX_AffineMatrix* pMatrix, int des
t_width, int anti_alias); |
| 399 CFX_GlyphBitmap* RenderGlyph_Nativetext(CFX_Font* pFont, FX_DWORD
glyph_index, | 399 CFX_GlyphBitmap* RenderGlyph_Nativetext(CFX_Font* pFont, FX_DWORD
glyph_index, |
| 400 const CFX_AffineMatrix* pMatrix, int dest_width, int anti_alias); | 400 const CFX_AffineMatrix* pMatrix, int dest_width, int anti_alias); |
| 401 CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, const CFX_AffineM
atrix* pMatrix, CFX_ByteStringC& FaceGlyphsKey, | 401 CFX_GlyphBitmap* LookUpGlyphBitmap(CFX_Font* pFont, const CFX_AffineM
atrix* pMatrix, CFX_ByteStringC& FaceGlyphsKey, |
| 402 FX_DWORD glyph_index, FX_BOOL bFontStyle, int dest_width, int anti_a
lias); | 402 FX_DWORD glyph_index, bool bFontStyle, int dest_width, int anti_alia
s); |
| 403 CFX_MapByteStringToPtr m_SizeMap; | 403 CFX_MapByteStringToPtr m_SizeMap; |
| 404 CFX_MapPtrToPtr m_PathMap; | 404 CFX_MapPtrToPtr m_PathMap; |
| 405 CFX_DIBitmap* m_pBitmap; | 405 CFX_DIBitmap* m_pBitmap; |
| 406 void* m_pPlatformGraphics; | 406 void* m_pPlatformGraphics; |
| 407 void* m_pPlatformBitmap; | 407 void* m_pPlatformBitmap; |
| 408 void* m_hDC; | 408 void* m_hDC; |
| 409 void* m_hBitmap; | 409 void* m_hBitmap; |
| 410 void* m_hOldBitmap; | 410 void* m_hOldBitmap; |
| 411 void* m_hGdiFont; | 411 void* m_hGdiFont; |
| 412 void* m_hOldGdiFont; | 412 void* m_hOldGdiFont; |
| 413 | 413 |
| 414 void InitPlatform(); | 414 void InitPlatform(); |
| 415 void DestroyPlatform(); | 415 void DestroyPlatform(); |
| 416 }; | 416 }; |
| 417 typedef struct { | 417 typedef struct { |
| 418 const CFX_GlyphBitmap* m_pGlyph; | 418 const CFX_GlyphBitmap* m_pGlyph; |
| 419 int m_OriginX, m_OriginY; | 419 int m_OriginX, m_OriginY; |
| 420 FX_FLOAT m_fOriginX, m_fOriginY; | 420 FX_FLOAT m_fOriginX, m_fOriginY; |
| 421 } FXTEXT_GLYPHPOS; | 421 } FXTEXT_GLYPHPOS; |
| 422 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, int nChars, int anti_a
lias, FX_FLOAT retinaScaleX = 1.0f, FX_FLOAT retinaScaleY = 1.0f); | 422 FX_RECT FXGE_GetGlyphsBBox(FXTEXT_GLYPHPOS* pGlyphAndPos, int nChars, int anti_a
lias, FX_FLOAT retinaScaleX = 1.0f, FX_FLOAT retinaScaleY = 1.0f); |
| 423 FX_BOOL»OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, double font_size, | 423 bool» OutputGlyph(void* dib, int x, int y, CFX_Font* pFont, double font_size, |
| 424 CFX_AffineMatrix* pMatrix, unsigned long glyph_index, unsign
ed long argb); | 424 CFX_AffineMatrix* pMatrix, unsigned long glyph_index, unsign
ed long argb); |
| 425 FX_BOOL»OutputText(void* dib, int x, int y, CFX_Font* pFont, double font_size, | 425 bool» OutputText(void* dib, int x, int y, CFX_Font* pFont, double font_size, |
| 426 CFX_AffineMatrix* pText_matrix, unsigned short const* text, u
nsigned long argb); | 426 CFX_AffineMatrix* pText_matrix, unsigned short const* text, u
nsigned long argb); |
| 427 class IFX_GSUBTable | 427 class IFX_GSUBTable |
| 428 { | 428 { |
| 429 public: | 429 public: |
| 430 static IFX_GSUBTable* Create(CFX_Font* pFont); | 430 static IFX_GSUBTable* Create(CFX_Font* pFont); |
| 431 virtual ~IFX_GSUBTable() { } | 431 virtual ~IFX_GSUBTable() { } |
| 432 virtual FX_BOOL GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0
; | 432 virtual bool GetVerticalGlyph(FX_DWORD glyphnum, FX_DWORD* vglyphnum) = 0; |
| 433 }; | 433 }; |
| 434 | 434 |
| 435 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ | 435 #endif // CORE_INCLUDE_FXGE_FX_FONT_H_ |
| OLD | NEW |