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

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

Issue 818363006: fix a few linux compilation warnings (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Restore origina cmslut.c Created 5 years, 11 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
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 "../../../include/fxge/fx_ge.h" 7 #include "../../../include/fxge/fx_ge.h"
8 #include "../../../include/fxge/fx_freetype.h" 8 #include "../../../include/fxge/fx_freetype.h"
9 #include "text_int.h" 9 #include "text_int.h"
10 #define GET_TT_SHORT(w) (FX_WORD)(((w)[0] << 8) | (w)[1]) 10 #define GET_TT_SHORT(w) (FX_WORD)(((w)[0] << 8) | (w)[1])
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 return 1 << 20; 741 return 1 << 20;
742 } 742 }
743 if (charset == FXFONT_HANGEUL_CHARSET) { 743 if (charset == FXFONT_HANGEUL_CHARSET) {
744 return 1 << 19; 744 return 1 << 19;
745 } 745 }
746 if (charset == FXFONT_SYMBOL_CHARSET) { 746 if (charset == FXFONT_SYMBOL_CHARSET) {
747 return 1 << 31; 747 return 1 << 31;
748 } 748 }
749 return 1 << 21; 749 return 1 << 21;
750 } 750 }
751 static int CP2CharSet(int cp)
752 {
753 if(cp == 932) {
754 return FXFONT_SHIFTJIS_CHARSET;
755 } else if(cp == 936) {
756 return FXFONT_GB2312_CHARSET;
757 } else if(cp == 949) {
758 return FXFONT_HANGEUL_CHARSET;
759 } else if(cp == 950) {
760 return FXFONT_CHINESEBIG5_CHARSET;
761 }
762 return FXFONT_DEFAULT_CHARSET;
763 }
764 FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseF ont, int italic_angle, int weight, int picthfamily) 751 FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, int iBaseF ont, int italic_angle, int weight, int picthfamily)
765 { 752 {
766 if (iBaseFont < 12) { 753 if (iBaseFont < 12) {
767 if (m_FoxitFaces[iBaseFont]) { 754 if (m_FoxitFaces[iBaseFont]) {
768 return m_FoxitFaces[iBaseFont]; 755 return m_FoxitFaces[iBaseFont];
769 } 756 }
770 FX_LPCBYTE pFontData = NULL; 757 FX_LPCBYTE pFontData = NULL;
771 FX_DWORD size = 0; 758 FX_DWORD size = 0;
772 if (m_pFontMgr->GetStandardFont(pFontData, size, iBaseFont)) { 759 if (m_pFontMgr->GetStandardFont(pFontData, size, iBaseFont)) {
773 m_FoxitFaces[iBaseFont] = m_pFontMgr->GetFixedFace(pFontData, size, 0); 760 m_FoxitFaces[iBaseFont] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) 1368 void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path)
1382 { 1369 {
1383 FXSYS_FILE* pFile = FXSYS_fopen(path, "rb"); 1370 FXSYS_FILE* pFile = FXSYS_fopen(path, "rb");
1384 if (pFile == NULL) { 1371 if (pFile == NULL) {
1385 return; 1372 return;
1386 } 1373 }
1387 FXSYS_fseek(pFile, 0, FXSYS_SEEK_END); 1374 FXSYS_fseek(pFile, 0, FXSYS_SEEK_END);
1388 FX_DWORD filesize = FXSYS_ftell(pFile); 1375 FX_DWORD filesize = FXSYS_ftell(pFile);
1389 FX_BYTE buffer[16]; 1376 FX_BYTE buffer[16];
1390 FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET); 1377 FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET);
1391 size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile); 1378 size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile);
jun_fang 2015/01/17 00:39:17 suggest to check whether readCnt equals to 12.
1379 // TODO(tsepez): File bug, reading from a file less than 12 bytes gives UMR.
1392 if (GET_TT_LONG(buffer) == 0x74746366) { 1380 if (GET_TT_LONG(buffer) == 0x74746366) {
1393 FX_DWORD nFaces = GET_TT_LONG(buffer + 8); 1381 FX_DWORD nFaces = GET_TT_LONG(buffer + 8);
1394 FX_LPBYTE offsets = FX_Alloc(FX_BYTE, nFaces * 4); 1382 FX_LPBYTE offsets = FX_Alloc(FX_BYTE, nFaces * 4);
1395 if (!offsets) { 1383 if (!offsets) {
1396 FXSYS_fclose(pFile); 1384 FXSYS_fclose(pFile);
1397 return; 1385 return;
1398 } 1386 }
1399 readCnt = FXSYS_fread(offsets, nFaces * 4, 1, pFile); 1387 readCnt = FXSYS_fread(offsets, nFaces * 4, 1, pFile);
1400 for (FX_DWORD i = 0; i < nFaces; i ++) { 1388 for (FX_DWORD i = 0; i < nFaces; i ++) {
1401 FX_LPBYTE p = offsets + i * 4; 1389 FX_LPBYTE p = offsets + i * 4;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 return FALSE; 1527 return FALSE;
1540 } 1528 }
1541 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont; 1529 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont;
1542 name = pFont->m_FaceName; 1530 name = pFont->m_FaceName;
1543 return TRUE; 1531 return TRUE;
1544 } 1532 }
1545 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) 1533 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset)
1546 { 1534 {
1547 return FALSE; 1535 return FALSE;
1548 } 1536 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698