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 <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
| 12 #include "core/fxge/include/fx_font.h" |
| 13 |
12 #include "core/fxge/fontdata/chromefontdata/chromefontdata.h" | 14 #include "core/fxge/fontdata/chromefontdata/chromefontdata.h" |
13 #include "core/fxge/ge/fx_text_int.h" | |
14 #include "core/fxge/include/fx_freetype.h" | 15 #include "core/fxge/include/fx_freetype.h" |
15 #include "core/fxge/include/fx_ge.h" | 16 #include "core/fxge/include/fx_ge.h" |
16 #include "third_party/base/stl_util.h" | 17 #include "third_party/base/stl_util.h" |
17 | 18 |
18 #define GET_TT_SHORT(w) (uint16_t)(((w)[0] << 8) | (w)[1]) | 19 #define GET_TT_SHORT(w) (uint16_t)(((w)[0] << 8) | (w)[1]) |
19 #define GET_TT_LONG(w) \ | 20 #define GET_TT_LONG(w) \ |
20 (uint32_t)(((w)[0] << 24) | ((w)[1] << 16) | ((w)[2] << 8) | (w)[3]) | 21 (uint32_t)(((w)[0] << 24) | ((w)[1] << 16) | ((w)[2] << 8) | (w)[3]) |
21 | 22 |
22 #define FX_FONT_STYLE_None 0x00 | 23 #define FX_FONT_STYLE_None 0x00 |
23 #define FX_FONT_STYLE_Bold 0x01 | 24 #define FX_FONT_STYLE_Bold 0x01 |
(...skipping 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 void _FTStreamClose(FXFT_Stream stream); | 1352 void _FTStreamClose(FXFT_Stream stream); |
1352 }; | 1353 }; |
1353 | 1354 |
1354 #if _FX_OS_ == _FX_ANDROID_ | 1355 #if _FX_OS_ == _FX_ANDROID_ |
1355 std::unique_ptr<IFX_SystemFontInfo> IFX_SystemFontInfo::CreateDefault( | 1356 std::unique_ptr<IFX_SystemFontInfo> IFX_SystemFontInfo::CreateDefault( |
1356 const char** pUnused) { | 1357 const char** pUnused) { |
1357 return nullptr; | 1358 return nullptr; |
1358 } | 1359 } |
1359 #endif | 1360 #endif |
1360 | 1361 |
| 1362 CFX_FontFaceInfo::CFX_FontFaceInfo(CFX_ByteString filePath, |
| 1363 CFX_ByteString faceName, |
| 1364 CFX_ByteString fontTables, |
| 1365 uint32_t fontOffset, |
| 1366 uint32_t fileSize) |
| 1367 : m_FilePath(filePath), |
| 1368 m_FaceName(faceName), |
| 1369 m_FontTables(fontTables), |
| 1370 m_FontOffset(fontOffset), |
| 1371 m_FileSize(fileSize), |
| 1372 m_Styles(0), |
| 1373 m_Charsets(0) {} |
| 1374 |
1361 CFX_FolderFontInfo::CFX_FolderFontInfo() {} | 1375 CFX_FolderFontInfo::CFX_FolderFontInfo() {} |
| 1376 |
1362 CFX_FolderFontInfo::~CFX_FolderFontInfo() { | 1377 CFX_FolderFontInfo::~CFX_FolderFontInfo() { |
1363 for (const auto& pair : m_FontList) { | 1378 for (const auto& pair : m_FontList) { |
1364 delete pair.second; | 1379 delete pair.second; |
1365 } | 1380 } |
1366 } | 1381 } |
1367 | 1382 |
1368 void CFX_FolderFontInfo::AddPath(const CFX_ByteStringC& path) { | 1383 void CFX_FolderFontInfo::AddPath(const CFX_ByteStringC& path) { |
1369 m_PathList.push_back(CFX_ByteString(path)); | 1384 m_PathList.push_back(CFX_ByteString(path)); |
1370 } | 1385 } |
1371 | 1386 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 int PDF_GetStandardFontName(CFX_ByteString* name) { | 1654 int PDF_GetStandardFontName(CFX_ByteString* name) { |
1640 AltFontName* found = static_cast<AltFontName*>( | 1655 AltFontName* found = static_cast<AltFontName*>( |
1641 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), | 1656 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), |
1642 sizeof(AltFontName), CompareString)); | 1657 sizeof(AltFontName), CompareString)); |
1643 if (!found) | 1658 if (!found) |
1644 return -1; | 1659 return -1; |
1645 | 1660 |
1646 *name = g_Base14FontNames[found->m_Index]; | 1661 *name = g_Base14FontNames[found->m_Index]; |
1647 return found->m_Index; | 1662 return found->m_Index; |
1648 } | 1663 } |
OLD | NEW |