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 "core/fxge/include/fx_font.h" | 9 #include "core/fxge/include/fx_font.h" |
10 #include "core/fxge/include/fx_ge.h" | 10 #include "core/fxge/include/fx_ge.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 void* MapFont(int weight, | 30 void* MapFont(int weight, |
31 FX_BOOL bItalic, | 31 FX_BOOL bItalic, |
32 int charset, | 32 int charset, |
33 int pitch_family, | 33 int pitch_family, |
34 const FX_CHAR* family, | 34 const FX_CHAR* family, |
35 int& iExact) override { | 35 int& iExact) override { |
36 if (m_pInfo->MapFont) | 36 if (m_pInfo->MapFont) |
37 return m_pInfo->MapFont(m_pInfo, weight, bItalic, charset, pitch_family, | 37 return m_pInfo->MapFont(m_pInfo, weight, bItalic, charset, pitch_family, |
38 family, &iExact); | 38 family, &iExact); |
39 return NULL; | 39 return nullptr; |
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 nullptr; |
46 } | 46 } |
47 | 47 |
48 uint32_t GetFontData(void* hFont, | 48 uint32_t GetFontData(void* hFont, |
49 uint32_t table, | 49 uint32_t table, |
50 uint8_t* buffer, | 50 uint8_t* buffer, |
51 uint32_t 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 uint32_t size = m_pInfo->GetFaceName(m_pInfo, hFont, NULL, 0); | 60 uint32_t size = m_pInfo->GetFaceName(m_pInfo, hFont, nullptr, 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 pFontInfoExt->GetFaceName = DefaultGetFaceName; | 182 pFontInfoExt->GetFaceName = DefaultGetFaceName; |
183 pFontInfoExt->GetFont = DefaultGetFont; | 183 pFontInfoExt->GetFont = DefaultGetFont; |
184 pFontInfoExt->GetFontCharset = DefaultGetFontCharset; | 184 pFontInfoExt->GetFontCharset = DefaultGetFontCharset; |
185 pFontInfoExt->GetFontData = DefaultGetFontData; | 185 pFontInfoExt->GetFontData = DefaultGetFontData; |
186 pFontInfoExt->MapFont = DefaultMapFont; | 186 pFontInfoExt->MapFont = DefaultMapFont; |
187 pFontInfoExt->Release = DefaultRelease; | 187 pFontInfoExt->Release = DefaultRelease; |
188 pFontInfoExt->version = 1; | 188 pFontInfoExt->version = 1; |
189 pFontInfoExt->m_pFontInfo = pFontInfo.release(); | 189 pFontInfoExt->m_pFontInfo = pFontInfo.release(); |
190 return pFontInfoExt; | 190 return pFontInfoExt; |
191 } | 191 } |
OLD | NEW |