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 | 8 |
9 #include "fpdfsdk/include/fsdk_define.h" | 9 #include "fpdfsdk/include/fsdk_define.h" |
10 #include "fpdfsdk/pdfwindow/PWL_FontMap.h" | 10 #include "fpdfsdk/pdfwindow/PWL_FontMap.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 family, &iExact); | 38 family, &iExact); |
39 return NULL; | 39 return NULL; |
40 } | 40 } |
41 | 41 |
42 void* GetFont(const FX_CHAR* family) override { | 42 void* GetFont(const FX_CHAR* family) override { |
43 if (m_pInfo->GetFont) | 43 if (m_pInfo->GetFont) |
44 return m_pInfo->GetFont(m_pInfo, family); | 44 return m_pInfo->GetFont(m_pInfo, family); |
45 return NULL; | 45 return NULL; |
46 } | 46 } |
47 | 47 |
48 FX_DWORD GetFontData(void* hFont, | 48 uint32_t GetFontData(void* hFont, |
49 FX_DWORD table, | 49 uint32_t table, |
50 uint8_t* buffer, | 50 uint8_t* buffer, |
51 FX_DWORD size) override { | 51 uint32_t size) override { |
52 if (m_pInfo->GetFontData) | 52 if (m_pInfo->GetFontData) |
53 return m_pInfo->GetFontData(m_pInfo, hFont, table, buffer, size); | 53 return m_pInfo->GetFontData(m_pInfo, hFont, table, buffer, size); |
54 return 0; | 54 return 0; |
55 } | 55 } |
56 | 56 |
57 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override { | 57 FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override { |
58 if (!m_pInfo->GetFaceName) | 58 if (!m_pInfo->GetFaceName) |
59 return FALSE; | 59 return FALSE; |
60 FX_DWORD size = m_pInfo->GetFaceName(m_pInfo, hFont, NULL, 0); | 60 uint32_t size = m_pInfo->GetFaceName(m_pInfo, hFont, NULL, 0); |
61 if (size == 0) | 61 if (size == 0) |
62 return FALSE; | 62 return FALSE; |
63 char* buffer = FX_Alloc(char, size); | 63 char* buffer = FX_Alloc(char, size); |
64 size = m_pInfo->GetFaceName(m_pInfo, hFont, buffer, size); | 64 size = m_pInfo->GetFaceName(m_pInfo, hFont, buffer, size); |
65 name = CFX_ByteString(buffer, size); | 65 name = CFX_ByteString(buffer, size); |
66 FX_Free(buffer); | 66 FX_Free(buffer); |
67 return TRUE; | 67 return TRUE; |
68 } | 68 } |
69 | 69 |
70 FX_BOOL GetFontCharset(void* hFont, int& charset) override { | 70 FX_BOOL GetFontCharset(void* hFont, int& charset) override { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 pFontInfoExt->GetFaceName = DefaultGetFaceName; | 180 pFontInfoExt->GetFaceName = DefaultGetFaceName; |
181 pFontInfoExt->GetFont = DefaultGetFont; | 181 pFontInfoExt->GetFont = DefaultGetFont; |
182 pFontInfoExt->GetFontCharset = DefaultGetFontCharset; | 182 pFontInfoExt->GetFontCharset = DefaultGetFontCharset; |
183 pFontInfoExt->GetFontData = DefaultGetFontData; | 183 pFontInfoExt->GetFontData = DefaultGetFontData; |
184 pFontInfoExt->MapFont = DefaultMapFont; | 184 pFontInfoExt->MapFont = DefaultMapFont; |
185 pFontInfoExt->Release = DefaultRelease; | 185 pFontInfoExt->Release = DefaultRelease; |
186 pFontInfoExt->version = 1; | 186 pFontInfoExt->version = 1; |
187 pFontInfoExt->m_pFontInfo = pFontInfo; | 187 pFontInfoExt->m_pFontInfo = pFontInfo; |
188 return pFontInfoExt; | 188 return pFontInfoExt; |
189 } | 189 } |
OLD | NEW |