| 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 #include "../../../include/fxge/fx_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" |
| 8 | 8 |
| 9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ | 9 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ |
| 10 #include <crtdbg.h> | 10 #include <crtdbg.h> |
| 11 | 11 |
| 12 #include "../../../include/fxcodec/fx_codec.h" | 12 #include "../../../include/fxcodec/fx_codec.h" |
| 13 #include "../../../include/fxge/fx_freetype.h" | 13 #include "../../../include/fxge/fx_freetype.h" |
| 14 #include "../../../include/fxge/fx_ge_win32.h" | 14 #include "../../../include/fxge/fx_ge_win32.h" |
| 15 #include "../agg/include/fx_agg_driver.h" | 15 #include "../agg/include/fx_agg_driver.h" |
| 16 #include "../dib/dib_int.h" | 16 #include "../dib/dib_int.h" |
| 17 #include "../ge/text_int.h" | 17 #include "../ge/text_int.h" |
| 18 #include "dwrite_int.h" | 18 #include "dwrite_int.h" |
| 19 #include "win32_int.h" | 19 #include "win32_int.h" |
| 20 | 20 |
| 21 class CFX_Win32FontInfo final : public IFX_SystemFontInfo { | 21 class CFX_Win32FontInfo final : public IFX_SystemFontInfo { |
| 22 public: | 22 public: |
| 23 CFX_Win32FontInfo(); | 23 CFX_Win32FontInfo(); |
| 24 ~CFX_Win32FontInfo(); | 24 ~CFX_Win32FontInfo() override; |
| 25 virtual void Release(); | 25 |
| 26 virtual FX_BOOL EnumFontList(CFX_FontMapper* pMapper); | 26 // IFX_SystemFontInfo |
| 27 virtual void* MapFont(int weight, | 27 void Release() override; |
| 28 FX_BOOL bItalic, | 28 FX_BOOL EnumFontList(CFX_FontMapper* pMapper) override; |
| 29 int charset, | 29 void* MapFont(int weight, |
| 30 int pitch_family, | 30 FX_BOOL bItalic, |
| 31 const FX_CHAR* face, | 31 int charset, |
| 32 int& iExact); | 32 int pitch_family, |
| 33 virtual void* GetFont(const FX_CHAR* face) { return NULL; } | 33 const FX_CHAR* face, |
| 34 virtual FX_DWORD GetFontData(void* hFont, | 34 int& iExact) override; |
| 35 FX_DWORD table, | 35 void* GetFont(const FX_CHAR* face) override { return NULL; } |
| 36 uint8_t* buffer, | 36 FX_DWORD GetFontData(void* hFont, |
| 37 FX_DWORD size); | 37 FX_DWORD table, |
| 38 virtual void DeleteFont(void* hFont); | 38 uint8_t* buffer, |
| 39 virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name); | 39 FX_DWORD size) override; |
| 40 virtual FX_BOOL GetFontCharset(void* hFont, int& charset); | 40 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override; |
| 41 FX_BOOL GetFontCharset(void* hFont, int& charset) override; |
| 42 void DeleteFont(void* hFont) override; |
| 43 |
| 41 FX_BOOL IsOpenTypeFromDiv(const LOGFONTA* plf); | 44 FX_BOOL IsOpenTypeFromDiv(const LOGFONTA* plf); |
| 42 FX_BOOL IsSupportFontFormDiv(const LOGFONTA* plf); | 45 FX_BOOL IsSupportFontFormDiv(const LOGFONTA* plf); |
| 43 void AddInstalledFont(const LOGFONTA* plf, FX_DWORD FontType); | 46 void AddInstalledFont(const LOGFONTA* plf, FX_DWORD FontType); |
| 44 void GetGBPreference(CFX_ByteString& face, int weight, int picth_family); | 47 void GetGBPreference(CFX_ByteString& face, int weight, int picth_family); |
| 45 void GetJapanesePreference(CFX_ByteString& face, | 48 void GetJapanesePreference(CFX_ByteString& face, |
| 46 int weight, | 49 int weight, |
| 47 int picth_family); | 50 int picth_family); |
| 48 CFX_ByteString FindFont(const CFX_ByteString& name); | 51 CFX_ByteString FindFont(const CFX_ByteString& name); |
| 49 HDC m_hDC; | 52 HDC m_hDC; |
| 50 CFX_FontMapper* m_pMapper; | 53 CFX_FontMapper* m_pMapper; |
| 51 CFX_ByteString m_LastFamily; | 54 CFX_ByteString m_LastFamily; |
| 52 CFX_ByteString m_KaiTi, m_FangSong; | 55 CFX_ByteString m_KaiTi, m_FangSong; |
| 53 }; | 56 }; |
| 57 |
| 54 CFX_Win32FontInfo::CFX_Win32FontInfo() { | 58 CFX_Win32FontInfo::CFX_Win32FontInfo() { |
| 55 m_hDC = CreateCompatibleDC(NULL); | 59 m_hDC = CreateCompatibleDC(NULL); |
| 56 } | 60 } |
| 57 CFX_Win32FontInfo::~CFX_Win32FontInfo() { | 61 CFX_Win32FontInfo::~CFX_Win32FontInfo() { |
| 58 m_pMapper = NULL; | 62 m_pMapper = NULL; |
| 59 } | 63 } |
| 60 void CFX_Win32FontInfo::Release() { | 64 void CFX_Win32FontInfo::Release() { |
| 61 DeleteDC(m_hDC); | 65 DeleteDC(m_hDC); |
| 62 delete this; | 66 delete this; |
| 63 } | 67 } |
| (...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 SelectObject(m_hDC, m_hOldBitmap); | 1311 SelectObject(m_hDC, m_hOldBitmap); |
| 1308 DeleteDC(m_hDC); | 1312 DeleteDC(m_hDC); |
| 1309 } | 1313 } |
| 1310 if (m_hBitmap) { | 1314 if (m_hBitmap) { |
| 1311 DeleteObject(m_hBitmap); | 1315 DeleteObject(m_hBitmap); |
| 1312 } | 1316 } |
| 1313 delete GetBitmap(); | 1317 delete GetBitmap(); |
| 1314 } | 1318 } |
| 1315 | 1319 |
| 1316 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ | 1320 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ |
| OLD | NEW |