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/fsdk_define.h" | 7 #include "../include/fsdk_define.h" |
8 #include "../include/fpdf_sysfontinfo.h" | 8 #include "../include/fpdf_sysfontinfo.h" |
9 | 9 |
10 class CSysFontInfo_Ext FX_FINAL : public IFX_SystemFontInfo | 10 class CSysFontInfo_Ext FX_FINAL : public IFX_SystemFontInfo |
11 { | 11 { |
12 public: | 12 public: |
13 FPDF_SYSFONTINFO* m_pInfo; | 13 FPDF_SYSFONTINFO* m_pInfo; |
14 | 14 |
15 » virtual void» » Release() | 15 » virtual void» » Release() FX_OVERRIDE |
16 { | 16 { |
17 if (m_pInfo->Release) | 17 if (m_pInfo->Release) |
18 m_pInfo->Release(m_pInfo); | 18 m_pInfo->Release(m_pInfo); |
19 delete this; | 19 delete this; |
20 } | 20 } |
21 | 21 |
22 » virtual»FX_BOOL»» EnumFontList(CFX_FontMapper* pMapper) | 22 » virtual»FX_BOOL»» EnumFontList(CFX_FontMapper* pMapper) FX_OVERRID
E |
23 { | 23 { |
24 if (m_pInfo->EnumFonts) { | 24 if (m_pInfo->EnumFonts) { |
25 m_pInfo->EnumFonts(m_pInfo, pMapper); | 25 m_pInfo->EnumFonts(m_pInfo, pMapper); |
26 return TRUE; | 26 return TRUE; |
27 } | 27 } |
28 return FALSE; | 28 return FALSE; |
29 } | 29 } |
30 | 30 |
31 » virtual void*» » MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, FX_LPCSTR family, FX_BOOL& bExact) | 31 » virtual void*» » MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, FX_LPCSTR family, FX_BOOL& bExact) FX_OVERRIDE |
32 { | 32 { |
33 if (m_pInfo->MapFont) | 33 if (m_pInfo->MapFont) |
34 return m_pInfo->MapFont(m_pInfo, weight, bItalic, charse
t, pitch_family, family, &bExact); | 34 return m_pInfo->MapFont(m_pInfo, weight, bItalic, charse
t, pitch_family, family, &bExact); |
35 return NULL; | 35 return NULL; |
36 } | 36 } |
37 | 37 |
38 » virtual void*» » GetFont(FX_LPCSTR family) | 38 » virtual void*» » GetFont(FX_LPCSTR family) FX_OVERRIDE |
39 { | 39 { |
40 if (m_pInfo->GetFont) | 40 if (m_pInfo->GetFont) |
41 return m_pInfo->GetFont(m_pInfo, family); | 41 return m_pInfo->GetFont(m_pInfo, family); |
42 return NULL; | 42 return NULL; |
43 } | 43 } |
44 | 44 |
45 » virtual FX_DWORD» GetFontData(void* hFont, FX_DWORD table, FX_LPBY
TE buffer, FX_DWORD size) | 45 » virtual FX_DWORD» GetFontData(void* hFont, FX_DWORD table, FX_LPBY
TE buffer, FX_DWORD size) FX_OVERRIDE |
46 { | 46 { |
47 if (m_pInfo->GetFontData) | 47 if (m_pInfo->GetFontData) |
48 return m_pInfo->GetFontData(m_pInfo, hFont, table, buffe
r, size); | 48 return m_pInfo->GetFontData(m_pInfo, hFont, table, buffe
r, size); |
49 return 0; | 49 return 0; |
50 } | 50 } |
51 | 51 |
52 » virtual FX_BOOL»» GetFaceName(void* hFont, CFX_ByteString& name) | 52 » virtual FX_BOOL»» GetFaceName(void* hFont, CFX_ByteString& name)
FX_OVERRIDE |
53 { | 53 { |
54 if (m_pInfo->GetFaceName == NULL) return FALSE; | 54 if (m_pInfo->GetFaceName == NULL) return FALSE; |
55 FX_DWORD size = m_pInfo->GetFaceName(m_pInfo, hFont, NULL, 0); | 55 FX_DWORD size = m_pInfo->GetFaceName(m_pInfo, hFont, NULL, 0); |
56 if (size == 0) return FALSE; | 56 if (size == 0) return FALSE; |
57 char* buffer = FX_Alloc(char, size); | 57 char* buffer = FX_Alloc(char, size); |
58 size = m_pInfo->GetFaceName(m_pInfo, hFont, buffer, size); | 58 size = m_pInfo->GetFaceName(m_pInfo, hFont, buffer, size); |
59 name = CFX_ByteString(buffer, size); | 59 name = CFX_ByteString(buffer, size); |
60 FX_Free(buffer); | 60 FX_Free(buffer); |
61 return TRUE; | 61 return TRUE; |
62 } | 62 } |
63 | 63 |
64 » virtual FX_BOOL»» GetFontCharset(void* hFont, int& charset) | 64 » virtual FX_BOOL»» GetFontCharset(void* hFont, int& charset) FX_OV
ERRIDE |
65 { | 65 { |
66 if (m_pInfo->GetFontCharset) { | 66 if (m_pInfo->GetFontCharset) { |
67 charset = m_pInfo->GetFontCharset(m_pInfo, hFont); | 67 charset = m_pInfo->GetFontCharset(m_pInfo, hFont); |
68 return TRUE; | 68 return TRUE; |
69 } | 69 } |
70 return FALSE; | 70 return FALSE; |
71 } | 71 } |
72 | 72 |
73 » virtual void» » DeleteFont(void* hFont) | 73 » virtual void» » DeleteFont(void* hFont) FX_OVERRIDE |
74 { | 74 { |
75 if (m_pInfo->DeleteFont) | 75 if (m_pInfo->DeleteFont) |
76 m_pInfo->DeleteFont(m_pInfo, hFont); | 76 m_pInfo->DeleteFont(m_pInfo, hFont); |
77 } | 77 } |
78 }; | 78 }; |
79 | 79 |
80 DLLEXPORT void STDCALL FPDF_AddInstalledFont(void* mapper, const char* name, int
charset) | 80 DLLEXPORT void STDCALL FPDF_AddInstalledFont(void* mapper, const char* name, int
charset) |
81 { | 81 { |
82 ((CFX_FontMapper*)mapper)->AddInstalledFont(name, charset); | 82 ((CFX_FontMapper*)mapper)->AddInstalledFont(name, charset); |
83 } | 83 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 pFontInfoExt->GetFaceName = DefaultGetFaceName; | 154 pFontInfoExt->GetFaceName = DefaultGetFaceName; |
155 pFontInfoExt->GetFont = DefaultGetFont; | 155 pFontInfoExt->GetFont = DefaultGetFont; |
156 pFontInfoExt->GetFontCharset = DefaultGetFontCharset; | 156 pFontInfoExt->GetFontCharset = DefaultGetFontCharset; |
157 pFontInfoExt->GetFontData = DefaultGetFontData; | 157 pFontInfoExt->GetFontData = DefaultGetFontData; |
158 pFontInfoExt->MapFont = DefaultMapFont; | 158 pFontInfoExt->MapFont = DefaultMapFont; |
159 pFontInfoExt->Release = DefaultRelease; | 159 pFontInfoExt->Release = DefaultRelease; |
160 pFontInfoExt->version = 1; | 160 pFontInfoExt->version = 1; |
161 pFontInfoExt->m_pFontInfo = pFontInfo; | 161 pFontInfoExt->m_pFontInfo = pFontInfo; |
162 return pFontInfoExt; | 162 return pFontInfoExt; |
163 } | 163 } |
OLD | NEW |