| 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 "../../public/fpdf_sysfontinfo.h" | 7 #include "../../public/fpdf_sysfontinfo.h" |
| 8 #include "../include/fsdk_define.h" | 8 #include "../include/fsdk_define.h" |
| 9 #include "../include/pdfwindow/PWL_FontMap.h" | 9 #include "../include/pdfwindow/PWL_FontMap.h" |
| 10 | 10 |
| 11 class CSysFontInfo_Ext final : public IFX_SystemFontInfo | 11 class CSysFontInfo_Ext final : public IFX_SystemFontInfo |
| 12 { | 12 { |
| 13 public: | 13 public: |
| 14 FPDF_SYSFONTINFO* m_pInfo; | 14 FPDF_SYSFONTINFO* m_pInfo; |
| 15 | 15 |
| 16 virtual void Release() override | 16 virtual void Release() override |
| 17 { | 17 { |
| 18 if (m_pInfo->Release) | 18 if (m_pInfo->Release) |
| 19 m_pInfo->Release(m_pInfo); | 19 m_pInfo->Release(m_pInfo); |
| 20 delete this; | 20 delete this; |
| 21 } | 21 } |
| 22 | 22 |
| 23 » virtual»FX_BOOL»» EnumFontList(CFX_FontMapper* pMapper) override | 23 » virtual»bool» » EnumFontList(CFX_FontMapper* pMapper) override |
| 24 { | 24 { |
| 25 if (m_pInfo->EnumFonts) { | 25 if (m_pInfo->EnumFonts) { |
| 26 m_pInfo->EnumFonts(m_pInfo, pMapper); | 26 m_pInfo->EnumFonts(m_pInfo, pMapper); |
| 27 » » » return TRUE; | 27 » » » return true; |
| 28 } | 28 } |
| 29 » » return FALSE; | 29 » » return false; |
| 30 } | 30 } |
| 31 | 31 |
| 32 » virtual void*» » MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, const FX_CHAR* family, int& iExact) override | 32 » virtual void*» » MapFont(int weight, bool bItalic, int charset, i
nt pitch_family, const FX_CHAR* family, int& iExact) override |
| 33 { | 33 { |
| 34 if (m_pInfo->MapFont) | 34 if (m_pInfo->MapFont) |
| 35 return m_pInfo->MapFont(m_pInfo, weight, bItalic, charse
t, pitch_family, family, &iExact); | 35 return m_pInfo->MapFont(m_pInfo, weight, bItalic, charse
t, pitch_family, family, &iExact); |
| 36 return NULL; | 36 return NULL; |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual void* GetFont(const FX_CHAR* family) override | 39 virtual void* GetFont(const FX_CHAR* family) override |
| 40 { | 40 { |
| 41 if (m_pInfo->GetFont) | 41 if (m_pInfo->GetFont) |
| 42 return m_pInfo->GetFont(m_pInfo, family); | 42 return m_pInfo->GetFont(m_pInfo, family); |
| 43 return NULL; | 43 return NULL; |
| 44 } | 44 } |
| 45 | 45 |
| 46 virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t
* buffer, FX_DWORD size) override | 46 virtual FX_DWORD GetFontData(void* hFont, FX_DWORD table, uint8_t
* buffer, FX_DWORD size) override |
| 47 { | 47 { |
| 48 if (m_pInfo->GetFontData) | 48 if (m_pInfo->GetFontData) |
| 49 return m_pInfo->GetFontData(m_pInfo, hFont, table, buffe
r, size); | 49 return m_pInfo->GetFontData(m_pInfo, hFont, table, buffe
r, size); |
| 50 return 0; | 50 return 0; |
| 51 } | 51 } |
| 52 | 52 |
| 53 » virtual FX_BOOL»» GetFaceName(void* hFont, CFX_ByteString& name)
override | 53 » virtual bool» » GetFaceName(void* hFont, CFX_ByteString& name)
override |
| 54 { | 54 { |
| 55 » » if (m_pInfo->GetFaceName == NULL) return FALSE; | 55 » » if (m_pInfo->GetFaceName == NULL) return false; |
| 56 FX_DWORD size = m_pInfo->GetFaceName(m_pInfo, hFont, NULL, 0); | 56 FX_DWORD size = m_pInfo->GetFaceName(m_pInfo, hFont, NULL, 0); |
| 57 » » if (size == 0) return FALSE; | 57 » » if (size == 0) return false; |
| 58 char* buffer = FX_Alloc(char, size); | 58 char* buffer = FX_Alloc(char, size); |
| 59 size = m_pInfo->GetFaceName(m_pInfo, hFont, buffer, size); | 59 size = m_pInfo->GetFaceName(m_pInfo, hFont, buffer, size); |
| 60 name = CFX_ByteString(buffer, size); | 60 name = CFX_ByteString(buffer, size); |
| 61 FX_Free(buffer); | 61 FX_Free(buffer); |
| 62 » » return TRUE; | 62 » » return true; |
| 63 } | 63 } |
| 64 | 64 |
| 65 » virtual FX_BOOL»» GetFontCharset(void* hFont, int& charset) overr
ide | 65 » virtual bool» » GetFontCharset(void* hFont, int& charset) overr
ide |
| 66 { | 66 { |
| 67 if (m_pInfo->GetFontCharset) { | 67 if (m_pInfo->GetFontCharset) { |
| 68 charset = m_pInfo->GetFontCharset(m_pInfo, hFont); | 68 charset = m_pInfo->GetFontCharset(m_pInfo, hFont); |
| 69 » » » return TRUE; | 69 » » » return true; |
| 70 } | 70 } |
| 71 » » return FALSE; | 71 » » return false; |
| 72 } | 72 } |
| 73 | 73 |
| 74 virtual void DeleteFont(void* hFont) override | 74 virtual void DeleteFont(void* hFont) override |
| 75 { | 75 { |
| 76 if (m_pInfo->DeleteFont) | 76 if (m_pInfo->DeleteFont) |
| 77 m_pInfo->DeleteFont(m_pInfo, hFont); | 77 m_pInfo->DeleteFont(m_pInfo, hFont); |
| 78 } | 78 } |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 ~CSysFontInfo_Ext() { } | 81 ~CSysFontInfo_Ext() { } |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 pFontInfoExt->GetFaceName = DefaultGetFaceName; | 163 pFontInfoExt->GetFaceName = DefaultGetFaceName; |
| 164 pFontInfoExt->GetFont = DefaultGetFont; | 164 pFontInfoExt->GetFont = DefaultGetFont; |
| 165 pFontInfoExt->GetFontCharset = DefaultGetFontCharset; | 165 pFontInfoExt->GetFontCharset = DefaultGetFontCharset; |
| 166 pFontInfoExt->GetFontData = DefaultGetFontData; | 166 pFontInfoExt->GetFontData = DefaultGetFontData; |
| 167 pFontInfoExt->MapFont = DefaultMapFont; | 167 pFontInfoExt->MapFont = DefaultMapFont; |
| 168 pFontInfoExt->Release = DefaultRelease; | 168 pFontInfoExt->Release = DefaultRelease; |
| 169 pFontInfoExt->version = 1; | 169 pFontInfoExt->version = 1; |
| 170 pFontInfoExt->m_pFontInfo = pFontInfo; | 170 pFontInfoExt->m_pFontInfo = pFontInfo; |
| 171 return pFontInfoExt; | 171 return pFontInfoExt; |
| 172 } | 172 } |
| OLD | NEW |