Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: core/src/fxge/ge/fx_ge_fontmap.cpp

Issue 1277883004: Add CFX_FontFaceInfo constructor. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Put consts together Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | core/src/fxge/ge/fx_ge_linux.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <limits> 7 #include <limits>
8 8
9 #include "../../../include/fxge/fx_ge.h" 9 #include "../../../include/fxge/fx_ge.h"
10 #include "../../../include/fxge/fx_freetype.h" 10 #include "../../../include/fxge/fx_freetype.h"
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 size = 66919; 446 size = 66919;
447 } 447 }
448 } else { 448 } else {
449 pFontData = g_FoxitFonts[index].m_pFontData; 449 pFontData = g_FoxitFonts[index].m_pFontData;
450 size = g_FoxitFonts[index].m_dwSize; 450 size = g_FoxitFonts[index].m_dwSize;
451 } 451 }
452 } 452 }
453 return TRUE; 453 return TRUE;
454 } 454 }
455 CFX_FontMapper::CFX_FontMapper(CFX_FontMgr* mgr) 455 CFX_FontMapper::CFX_FontMapper(CFX_FontMgr* mgr)
456 : m_pFontInfo(nullptr), 456 : m_bListLoaded(FALSE),
457 m_bListLoaded(FALSE), 457 m_pFontInfo(nullptr),
Nico 2015/08/06 20:23:27 This breaks the clang/win build: ..\..\third_part
458 m_pFontEnumerator(nullptr), 458 m_pFontEnumerator(nullptr),
459 m_pFontMgr(mgr) { 459 m_pFontMgr(mgr) {
460 FXSYS_memset(m_FoxitFaces, 0, sizeof m_FoxitFaces); 460 m_MMFaces[0] = nullptr;
461 m_MMFaces[0] = m_MMFaces[1] = NULL; 461 m_MMFaces[1] = nullptr;
462 FXSYS_memset(m_FoxitFaces, 0, sizeof(m_FoxitFaces));
462 } 463 }
463 CFX_FontMapper::~CFX_FontMapper() { 464 CFX_FontMapper::~CFX_FontMapper() {
464 for (int i = 0; i < 14; i++) 465 for (int i = 0; i < 14; i++)
465 if (m_FoxitFaces[i]) { 466 if (m_FoxitFaces[i]) {
466 FXFT_Done_Face(m_FoxitFaces[i]); 467 FXFT_Done_Face(m_FoxitFaces[i]);
467 } 468 }
468 if (m_MMFaces[0]) { 469 if (m_MMFaces[0]) {
469 FXFT_Done_Face(m_MMFaces[0]); 470 FXFT_Done_Face(m_MMFaces[0]);
470 } 471 }
471 if (m_MMFaces[1]) { 472 if (m_MMFaces[1]) {
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 return NULL; 1274 return NULL;
1274 } 1275 }
1275 #endif 1276 #endif
1276 CFX_FolderFontInfo::CFX_FolderFontInfo() {} 1277 CFX_FolderFontInfo::CFX_FolderFontInfo() {}
1277 CFX_FolderFontInfo::~CFX_FolderFontInfo() { 1278 CFX_FolderFontInfo::~CFX_FolderFontInfo() {
1278 FX_POSITION pos = m_FontList.GetStartPosition(); 1279 FX_POSITION pos = m_FontList.GetStartPosition();
1279 while (pos) { 1280 while (pos) {
1280 CFX_ByteString key; 1281 CFX_ByteString key;
1281 void* value; 1282 void* value;
1282 m_FontList.GetNextAssoc(pos, key, value); 1283 m_FontList.GetNextAssoc(pos, key, value);
1283 delete (CFontFaceInfo*)value; 1284 delete (CFX_FontFaceInfo*)value;
1284 } 1285 }
1285 } 1286 }
1286 void CFX_FolderFontInfo::AddPath(const CFX_ByteStringC& path) { 1287 void CFX_FolderFontInfo::AddPath(const CFX_ByteStringC& path) {
1287 m_PathList.Add(path); 1288 m_PathList.Add(path);
1288 } 1289 }
1289 void CFX_FolderFontInfo::Release() { 1290 void CFX_FolderFontInfo::Release() {
1290 delete this; 1291 delete this;
1291 } 1292 }
1292 FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) { 1293 FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) {
1293 m_pMapper = pMapper; 1294 m_pMapper = pMapper;
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x6e616d65); 1388 _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x6e616d65);
1388 CFX_ByteString facename = _FPDF_GetNameFromTT(names, 1); 1389 CFX_ByteString facename = _FPDF_GetNameFromTT(names, 1);
1389 CFX_ByteString style = _FPDF_GetNameFromTT(names, 2); 1390 CFX_ByteString style = _FPDF_GetNameFromTT(names, 2);
1390 if (style != "Regular") { 1391 if (style != "Regular") {
1391 facename += " " + style; 1392 facename += " " + style;
1392 } 1393 }
1393 void* p; 1394 void* p;
1394 if (m_FontList.Lookup(facename, p)) { 1395 if (m_FontList.Lookup(facename, p)) {
1395 return; 1396 return;
1396 } 1397 }
1397 CFontFaceInfo* pInfo = new CFontFaceInfo; 1398 CFX_FontFaceInfo* pInfo =
1398 pInfo->m_FilePath = path; 1399 new CFX_FontFaceInfo(path, facename, tables, offset, filesize);
1399 pInfo->m_FaceName = facename;
1400 pInfo->m_FontTables = tables;
1401 pInfo->m_FontOffset = offset;
1402 pInfo->m_FileSize = filesize;
1403 pInfo->m_Charsets = 0;
1404 CFX_ByteString os2 = 1400 CFX_ByteString os2 =
1405 _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x4f532f32); 1401 _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x4f532f32);
1406 if (os2.GetLength() >= 86) { 1402 if (os2.GetLength() >= 86) {
1407 const uint8_t* p = (const uint8_t*)os2 + 78; 1403 const uint8_t* p = (const uint8_t*)os2 + 78;
1408 FX_DWORD codepages = GET_TT_LONG(p); 1404 FX_DWORD codepages = GET_TT_LONG(p);
1409 if (codepages & (1 << 17)) { 1405 if (codepages & (1 << 17)) {
1410 m_pMapper->AddInstalledFont(facename, FXFONT_SHIFTJIS_CHARSET); 1406 m_pMapper->AddInstalledFont(facename, FXFONT_SHIFTJIS_CHARSET);
1411 pInfo->m_Charsets |= CHARSET_FLAG_SHIFTJIS; 1407 pInfo->m_Charsets |= CHARSET_FLAG_SHIFTJIS;
1412 } 1408 }
1413 if (codepages & (1 << 18)) { 1409 if (codepages & (1 << 18)) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 } 1453 }
1458 return p; 1454 return p;
1459 } 1455 }
1460 FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, 1456 FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont,
1461 FX_DWORD table, 1457 FX_DWORD table,
1462 uint8_t* buffer, 1458 uint8_t* buffer,
1463 FX_DWORD size) { 1459 FX_DWORD size) {
1464 if (hFont == NULL) { 1460 if (hFont == NULL) {
1465 return 0; 1461 return 0;
1466 } 1462 }
1467 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont; 1463 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont;
1468 FXSYS_FILE* pFile = NULL; 1464 FXSYS_FILE* pFile = NULL;
1469 if (size > 0) { 1465 if (size > 0) {
1470 pFile = FXSYS_fopen(pFont->m_FilePath, "rb"); 1466 pFile = FXSYS_fopen(pFont->m_FilePath, "rb");
1471 if (pFile == NULL) { 1467 if (pFile == NULL) {
1472 return 0; 1468 return 0;
1473 } 1469 }
1474 } 1470 }
1475 FX_DWORD datasize = 0; 1471 FX_DWORD datasize = 0;
1476 FX_DWORD offset; 1472 FX_DWORD offset;
1477 if (table == 0) { 1473 if (table == 0) {
(...skipping 19 matching lines...) Expand all
1497 if (pFile) { 1493 if (pFile) {
1498 FXSYS_fclose(pFile); 1494 FXSYS_fclose(pFile);
1499 } 1495 }
1500 return datasize; 1496 return datasize;
1501 } 1497 }
1502 void CFX_FolderFontInfo::DeleteFont(void* hFont) {} 1498 void CFX_FolderFontInfo::DeleteFont(void* hFont) {}
1503 FX_BOOL CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) { 1499 FX_BOOL CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) {
1504 if (hFont == NULL) { 1500 if (hFont == NULL) {
1505 return FALSE; 1501 return FALSE;
1506 } 1502 }
1507 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont; 1503 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont;
1508 name = pFont->m_FaceName; 1504 name = pFont->m_FaceName;
1509 return TRUE; 1505 return TRUE;
1510 } 1506 }
1511 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) { 1507 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) {
1512 return FALSE; 1508 return FALSE;
1513 } 1509 }
OLDNEW
« no previous file with comments | « no previous file | core/src/fxge/ge/fx_ge_linux.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698