| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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/ge/cfx_folderfontinfo.h" | 7 #include "core/fxge/ge/cfx_folderfontinfo.h" |
| 8 | 8 |
| 9 #include "core/fxge/cfx_fontmapper.h" | 9 #include "core/fxge/cfx_fontmapper.h" |
| 10 #include "core/fxge/fx_font.h" | 10 #include "core/fxge/fx_font.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) { | 111 FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) { |
| 112 m_pMapper = pMapper; | 112 m_pMapper = pMapper; |
| 113 for (const auto& path : m_PathList) | 113 for (const auto& path : m_PathList) |
| 114 ScanPath(path); | 114 ScanPath(path); |
| 115 return TRUE; | 115 return TRUE; |
| 116 } | 116 } |
| 117 | 117 |
| 118 void CFX_FolderFontInfo::ScanPath(const CFX_ByteString& path) { | 118 void CFX_FolderFontInfo::ScanPath(const CFX_ByteString& path) { |
| 119 void* handle = FX_OpenFolder(path.c_str()); | 119 FX_FileHandle* handle = FX_OpenFolder(path.c_str()); |
| 120 if (!handle) | 120 if (!handle) |
| 121 return; | 121 return; |
| 122 | 122 |
| 123 CFX_ByteString filename; | 123 CFX_ByteString filename; |
| 124 FX_BOOL bFolder; | 124 bool bFolder; |
| 125 while (FX_GetNextFile(handle, filename, bFolder)) { | 125 while (FX_GetNextFile(handle, &filename, &bFolder)) { |
| 126 if (bFolder) { | 126 if (bFolder) { |
| 127 if (filename == "." || filename == "..") | 127 if (filename == "." || filename == "..") |
| 128 continue; | 128 continue; |
| 129 } else { | 129 } else { |
| 130 CFX_ByteString ext = filename.Right(4); | 130 CFX_ByteString ext = filename.Right(4); |
| 131 ext.MakeUpper(); | 131 ext.MakeUpper(); |
| 132 if (ext != ".TTF" && ext != ".OTF" && ext != ".TTC") | 132 if (ext != ".TTF" && ext != ".OTF" && ext != ".TTC") |
| 133 continue; | 133 continue; |
| 134 } | 134 } |
| 135 | 135 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 if (!hFont) | 368 if (!hFont) |
| 369 return FALSE; | 369 return FALSE; |
| 370 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont; | 370 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont; |
| 371 name = pFont->m_FaceName; | 371 name = pFont->m_FaceName; |
| 372 return TRUE; | 372 return TRUE; |
| 373 } | 373 } |
| 374 | 374 |
| 375 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) { | 375 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) { |
| 376 return FALSE; | 376 return FALSE; |
| 377 } | 377 } |
| OLD | NEW |