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 "core/fxge/include/fx_ge.h" | 7 #include "core/fxge/include/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> |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } | 140 } |
141 } | 141 } |
142 m_pMapper->AddInstalledFont(name, plf->lfCharSet); | 142 m_pMapper->AddInstalledFont(name, plf->lfCharSet); |
143 m_LastFamily = name; | 143 m_LastFamily = name; |
144 } | 144 } |
145 static int CALLBACK FontEnumProc(const LOGFONTA* plf, | 145 static int CALLBACK FontEnumProc(const LOGFONTA* plf, |
146 const TEXTMETRICA* lpntme, | 146 const TEXTMETRICA* lpntme, |
147 uint32_t FontType, | 147 uint32_t FontType, |
148 LPARAM lParam) { | 148 LPARAM lParam) { |
149 CFX_Win32FontInfo* pFontInfo = (CFX_Win32FontInfo*)lParam; | 149 CFX_Win32FontInfo* pFontInfo = (CFX_Win32FontInfo*)lParam; |
150 if (pFontInfo->m_pMapper->GetFontEnumerator()) { | |
151 pFontInfo->m_pMapper->GetFontEnumerator()->HitFont(); | |
152 } | |
153 pFontInfo->AddInstalledFont(plf, FontType); | 150 pFontInfo->AddInstalledFont(plf, FontType); |
154 return 1; | 151 return 1; |
155 } | 152 } |
156 FX_BOOL CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) { | 153 FX_BOOL CFX_Win32FontInfo::EnumFontList(CFX_FontMapper* pMapper) { |
157 m_pMapper = pMapper; | 154 m_pMapper = pMapper; |
158 LOGFONTA lf; | 155 LOGFONTA lf; |
159 FXSYS_memset(&lf, 0, sizeof(LOGFONTA)); | 156 FXSYS_memset(&lf, 0, sizeof(LOGFONTA)); |
160 lf.lfCharSet = DEFAULT_CHARSET; | 157 lf.lfCharSet = DEFAULT_CHARSET; |
161 lf.lfFaceName[0] = 0; | 158 lf.lfFaceName[0] = 0; |
162 lf.lfPitchAndFamily = 0; | 159 lf.lfPitchAndFamily = 0; |
163 EnumFontFamiliesExA(m_hDC, &lf, (FONTENUMPROCA)FontEnumProc, (uintptr_t) this, | 160 EnumFontFamiliesExA(m_hDC, &lf, (FONTENUMPROCA)FontEnumProc, (uintptr_t) this, |
164 0); | 161 0); |
165 if (pMapper->GetFontEnumerator()) { | |
166 pMapper->GetFontEnumerator()->Finish(); | |
167 } | |
168 return TRUE; | 162 return TRUE; |
169 } | 163 } |
170 static const struct { | 164 static const struct { |
171 const FX_CHAR* m_pFaceName; | 165 const FX_CHAR* m_pFaceName; |
172 const FX_CHAR* m_pVariantName; | 166 const FX_CHAR* m_pVariantName; |
173 } VariantNames[] = { | 167 } VariantNames[] = { |
174 {"DFKai-SB", "\x19\x6A\x77\x69\xD4\x9A"}, | 168 {"DFKai-SB", "\x19\x6A\x77\x69\xD4\x9A"}, |
175 }; | 169 }; |
176 static const struct { | 170 static const struct { |
177 const FX_CHAR* m_pName; | 171 const FX_CHAR* m_pName; |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1363 SelectObject(m_hDC, m_hOldBitmap); | 1357 SelectObject(m_hDC, m_hOldBitmap); |
1364 DeleteDC(m_hDC); | 1358 DeleteDC(m_hDC); |
1365 } | 1359 } |
1366 if (m_hBitmap) { | 1360 if (m_hBitmap) { |
1367 DeleteObject(m_hBitmap); | 1361 DeleteObject(m_hBitmap); |
1368 } | 1362 } |
1369 delete GetBitmap(); | 1363 delete GetBitmap(); |
1370 } | 1364 } |
1371 | 1365 |
1372 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ | 1366 #endif // _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_ |
OLD | NEW |