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

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

Issue 1471323004: Inflict PPDF_ENABLE_XFA ifdefs on XFA core/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years 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 <limits> 7 #include <limits>
8 8
9 #include "core/include/fxge/fx_freetype.h" 9 #include "core/include/fxge/fx_freetype.h"
10 #include "core/include/fxge/fx_ge.h" 10 #include "core/include/fxge/fx_ge.h"
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 bItalic = TRUE; 1076 bItalic = TRUE;
1077 } 1077 }
1078 } 1078 }
1079 iExact = !match.IsEmpty(); 1079 iExact = !match.IsEmpty();
1080 void* hFont = m_pFontInfo->MapFont(weight, bItalic, Charset, PitchFamily, 1080 void* hFont = m_pFontInfo->MapFont(weight, bItalic, Charset, PitchFamily,
1081 family, iExact); 1081 family, iExact);
1082 if (iExact) { 1082 if (iExact) {
1083 pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT; 1083 pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT;
1084 } 1084 }
1085 if (hFont == NULL) { 1085 if (hFont == NULL) {
1086 #ifdef PDF_ENABLE_XFA
1086 if (flags & FXFONT_EXACTMATCH) { 1087 if (flags & FXFONT_EXACTMATCH) {
1087 return NULL; 1088 return NULL;
1088 } 1089 }
1090 #endif
1089 if (bCJK) { 1091 if (bCJK) {
1090 if (italic_angle != 0) { 1092 if (italic_angle != 0) {
1091 bItalic = TRUE; 1093 bItalic = TRUE;
1092 } else { 1094 } else {
1093 bItalic = FALSE; 1095 bItalic = FALSE;
1094 } 1096 }
1095 weight = old_weight; 1097 weight = old_weight;
1096 } 1098 }
1097 if (!match.IsEmpty()) { 1099 if (!match.IsEmpty()) {
1098 hFont = m_pFontInfo->GetFont(match); 1100 hFont = m_pFontInfo->GetFont(match);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 if (italic_angle == 0) { 1206 if (italic_angle == 0) {
1205 italic_angle = -12; 1207 italic_angle = -12;
1206 } else if (FXSYS_abs(italic_angle) < 5) { 1208 } else if (FXSYS_abs(italic_angle) < 5) {
1207 italic_angle = 0; 1209 italic_angle = 0;
1208 } 1210 }
1209 pSubstFont->m_ItalicAngle = italic_angle; 1211 pSubstFont->m_ItalicAngle = italic_angle;
1210 } 1212 }
1211 m_pFontInfo->DeleteFont(hFont); 1213 m_pFontInfo->DeleteFont(hFont);
1212 return face; 1214 return face;
1213 } 1215 }
1216 #ifdef PDF_ENABLE_XFA
1214 FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode, 1217 FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode,
1215 FX_DWORD flags, 1218 FX_DWORD flags,
1216 int weight, 1219 int weight,
1217 int italic_angle) { 1220 int italic_angle) {
1218 if (m_pFontInfo == NULL) { 1221 if (m_pFontInfo == NULL) {
1219 return NULL; 1222 return NULL;
1220 } 1223 }
1221 FX_BOOL bItalic = (flags & FXFONT_ITALIC) != 0; 1224 FX_BOOL bItalic = (flags & FXFONT_ITALIC) != 0;
1222 int PitchFamily = 0; 1225 int PitchFamily = 0;
1223 if (flags & FXFONT_SERIF) { 1226 if (flags & FXFONT_SERIF) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 return TRUE; 1289 return TRUE;
1287 } 1290 }
1288 } 1291 }
1289 for (int i = 0; i < FOXIT_FACE_COUNT; ++i) { 1292 for (int i = 0; i < FOXIT_FACE_COUNT; ++i) {
1290 if (m_FoxitFaces[i] == face) { 1293 if (m_FoxitFaces[i] == face) {
1291 return TRUE; 1294 return TRUE;
1292 } 1295 }
1293 } 1296 }
1294 return FALSE; 1297 return FALSE;
1295 } 1298 }
1299 #endif
1296 extern "C" { 1300 extern "C" {
1297 unsigned long _FTStreamRead(FXFT_Stream stream, 1301 unsigned long _FTStreamRead(FXFT_Stream stream,
1298 unsigned long offset, 1302 unsigned long offset,
1299 unsigned char* buffer, 1303 unsigned char* buffer,
1300 unsigned long count); 1304 unsigned long count);
1301 void _FTStreamClose(FXFT_Stream stream); 1305 void _FTStreamClose(FXFT_Stream stream);
1302 }; 1306 };
1303 #if _FX_OS_ == _FX_ANDROID_ 1307 #if _FX_OS_ == _FX_ANDROID_
1304 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) { 1308 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) {
1305 return NULL; 1309 return NULL;
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 return pFind; 1511 return pFind;
1508 } 1512 }
1509 void* CFX_FolderFontInfo::MapFont(int weight, 1513 void* CFX_FolderFontInfo::MapFont(int weight,
1510 FX_BOOL bItalic, 1514 FX_BOOL bItalic,
1511 int charset, 1515 int charset,
1512 int pitch_family, 1516 int pitch_family,
1513 const FX_CHAR* family, 1517 const FX_CHAR* family,
1514 int& iExact) { 1518 int& iExact) {
1515 return NULL; 1519 return NULL;
1516 } 1520 }
1521 #ifdef PDF_ENABLE_XFA
1517 void* CFX_FolderFontInfo::MapFontByUnicode(FX_DWORD dwUnicode, 1522 void* CFX_FolderFontInfo::MapFontByUnicode(FX_DWORD dwUnicode,
1518 int weight, 1523 int weight,
1519 FX_BOOL bItalic, 1524 FX_BOOL bItalic,
1520 int pitch_family) { 1525 int pitch_family) {
1521 return NULL; 1526 return NULL;
1522 } 1527 }
1528 #endif
1523 void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) { 1529 void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) {
1524 auto it = m_FontList.find(face); 1530 auto it = m_FontList.find(face);
1525 return it != m_FontList.end() ? it->second : nullptr; 1531 return it != m_FontList.end() ? it->second : nullptr;
1526 } 1532 }
1527 1533
1528 FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, 1534 FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont,
1529 FX_DWORD table, 1535 FX_DWORD table,
1530 uint8_t* buffer, 1536 uint8_t* buffer,
1531 FX_DWORD size) { 1537 FX_DWORD size) {
1532 if (!hFont) 1538 if (!hFont)
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 int PDF_GetStandardFontName(CFX_ByteString* name) { 1588 int PDF_GetStandardFontName(CFX_ByteString* name) {
1583 AltFontName* found = static_cast<AltFontName*>( 1589 AltFontName* found = static_cast<AltFontName*>(
1584 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), 1590 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames),
1585 sizeof(AltFontName), CompareString)); 1591 sizeof(AltFontName), CompareString));
1586 if (!found) 1592 if (!found)
1587 return -1; 1593 return -1;
1588 1594
1589 *name = g_Base14FontNames[found->m_Index]; 1595 *name = g_Base14FontNames[found->m_Index];
1590 return found->m_Index; 1596 return found->m_Index;
1591 } 1597 }
OLDNEW
« core/src/fxcodec/codec/fx_codec.cpp ('K') | « core/src/fxge/ge/fx_ge_font.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698