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

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

Issue 1248153004: Merge to XFA: FX_BOOL combo patch. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: CTTFontDesc::ReleaseFace() mismatch Created 5 years, 5 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 | « core/src/fxcrt/fx_basic_gcc.cpp ('k') | 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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 const uint8_t* ptr = name; 602 const uint8_t* ptr = name;
603 FX_BOOL bLocalized = FALSE; 603 FX_BOOL bLocalized = FALSE;
604 for (int i = 0; i < name.GetLength(); i ++) 604 for (int i = 0; i < name.GetLength(); i ++)
605 if (ptr[i] > 0x80) { 605 if (ptr[i] > 0x80) {
606 bLocalized = TRUE; 606 bLocalized = TRUE;
607 break; 607 break;
608 } 608 }
609 if (bLocalized) { 609 if (bLocalized) {
610 void* hFont = m_pFontInfo->GetFont(name); 610 void* hFont = m_pFontInfo->GetFont(name);
611 if (hFont == NULL) { 611 if (hFont == NULL) {
612 FX_BOOL bExact; 612 int iExact;
613 hFont = m_pFontInfo->MapFont(0, 0, FXFONT_DEFAULT_CHARSET, 0, name, bExact); 613 hFont = m_pFontInfo->MapFont(0, 0, FXFONT_DEFAULT_CHARSET, 0, name, iExact);
614 if (hFont == NULL) { 614 if (hFont == NULL) {
615 return; 615 return;
616 } 616 }
617 } 617 }
618 CFX_ByteString new_name = GetPSNameFromTT(hFont); 618 CFX_ByteString new_name = GetPSNameFromTT(hFont);
619 if (!new_name.IsEmpty()) { 619 if (!new_name.IsEmpty()) {
620 new_name.Insert(0, ' '); 620 new_name.Insert(0, ' ');
621 m_InstalledTTFonts.Add(new_name); 621 m_InstalledTTFonts.Add(new_name);
622 } 622 }
623 m_pFontInfo->DeleteFont(hFont); 623 m_pFontInfo->DeleteFont(hFont);
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 } 1055 }
1056 weight = weight ? weight : FXFONT_FW_NORMAL; 1056 weight = weight ? weight : FXFONT_FW_NORMAL;
1057 int old_weight = weight; 1057 int old_weight = weight;
1058 if (nStyle) { 1058 if (nStyle) {
1059 weight = nStyle & FX_FONT_STYLE_BoldBold ? 900 : (nStyle & FX_FONT_STYLE _Bold ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL); 1059 weight = nStyle & FX_FONT_STYLE_BoldBold ? 900 : (nStyle & FX_FONT_STYLE _Bold ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL);
1060 } 1060 }
1061 if (nStyle & FX_FONT_STYLE_Italic) { 1061 if (nStyle & FX_FONT_STYLE_Italic) {
1062 bItalic = TRUE; 1062 bItalic = TRUE;
1063 } 1063 }
1064 FX_BOOL bCJK = FALSE; 1064 FX_BOOL bCJK = FALSE;
1065 FX_BOOL bExact = FALSE; 1065 int iExact = 0;
1066 int Charset = FXFONT_ANSI_CHARSET; 1066 int Charset = FXFONT_ANSI_CHARSET;
1067 if (WindowCP) { 1067 if (WindowCP) {
1068 Charset = _GetCharsetFromCodePage(WindowCP); 1068 Charset = _GetCharsetFromCodePage(WindowCP);
1069 } else if (iBaseFont == 12 && (flags & FXFONT_SYMBOLIC)) { 1069 } else if (iBaseFont == 12 && (flags & FXFONT_SYMBOLIC)) {
1070 Charset = FXFONT_SYMBOL_CHARSET; 1070 Charset = FXFONT_SYMBOL_CHARSET;
1071 } 1071 }
1072 if (Charset == FXFONT_SHIFTJIS_CHARSET || Charset == FXFONT_GB2312_CHARSET | | 1072 if (Charset == FXFONT_SHIFTJIS_CHARSET || Charset == FXFONT_GB2312_CHARSET | |
1073 Charset == FXFONT_HANGEUL_CHARSET || Charset == FXFONT_CHINESEBIG5_C HARSET) { 1073 Charset == FXFONT_HANGEUL_CHARSET || Charset == FXFONT_CHINESEBIG5_C HARSET) {
1074 bCJK = TRUE; 1074 bCJK = TRUE;
1075 } 1075 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 } else { 1136 } else {
1137 family = g_Base14FontNames[iBaseFont]; 1137 family = g_Base14FontNames[iBaseFont];
1138 } 1138 }
1139 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; 1139 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
1140 } 1140 }
1141 } else { 1141 } else {
1142 if (flags & FXFONT_ITALIC) { 1142 if (flags & FXFONT_ITALIC) {
1143 bItalic = TRUE; 1143 bItalic = TRUE;
1144 } 1144 }
1145 } 1145 }
1146 bExact = !match.IsEmpty(); 1146 iExact = !match.IsEmpty();
1147 void* hFont = m_pFontInfo->MapFont(weight, bItalic, Charset, PitchFamily, fa mily, bExact); 1147 void* hFont = m_pFontInfo->MapFont(weight, bItalic, Charset, PitchFamily, fa mily, iExact);
1148 if (bExact) { 1148 if (iExact) {
1149 pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT; 1149 pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT;
1150 } 1150 }
1151 if (hFont == NULL) { 1151 if (hFont == NULL) {
1152 if (flags & FXFONT_EXACTMATCH) { 1152 if (flags & FXFONT_EXACTMATCH) {
1153 return NULL; 1153 return NULL;
1154 } 1154 }
1155 if (bCJK) { 1155 if (bCJK) {
1156 if (italic_angle != 0) { 1156 if (italic_angle != 0) {
1157 bItalic = TRUE; 1157 bItalic = TRUE;
1158 } else { 1158 } else {
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 pInfo->m_Styles |= FXFONT_BOLD; 1544 pInfo->m_Styles |= FXFONT_BOLD;
1545 } 1545 }
1546 if (style.Find(FX_BSTRC("Italic")) > -1 || style.Find(FX_BSTRC("Oblique")) > -1) { 1546 if (style.Find(FX_BSTRC("Italic")) > -1 || style.Find(FX_BSTRC("Oblique")) > -1) {
1547 pInfo->m_Styles |= FXFONT_ITALIC; 1547 pInfo->m_Styles |= FXFONT_ITALIC;
1548 } 1548 }
1549 if (facename.Find(FX_BSTRC("Serif")) > -1) { 1549 if (facename.Find(FX_BSTRC("Serif")) > -1) {
1550 pInfo->m_Styles |= FXFONT_SERIF; 1550 pInfo->m_Styles |= FXFONT_SERIF;
1551 } 1551 }
1552 m_FontList.SetAt(facename, pInfo); 1552 m_FontList.SetAt(facename, pInfo);
1553 } 1553 }
1554 void* CFX_FolderFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, FX_BOOL& bExact) 1554 void* CFX_FolderFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pitch_family, const FX_CHAR* family, int& iExact)
1555 { 1555 {
1556 return NULL; 1556 return NULL;
1557 } 1557 }
1558 void* CFX_FolderFontInfo::MapFontByUnicode(FX_DWORD dwUnicode, int weight, FX_BO OL bItalic, int pitch_family) 1558 void* CFX_FolderFontInfo::MapFontByUnicode(FX_DWORD dwUnicode, int weight, FX_BO OL bItalic, int pitch_family)
1559 { 1559 {
1560 return NULL; 1560 return NULL;
1561 } 1561 }
1562 void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) 1562 void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face)
1563 { 1563 {
1564 void* p; 1564 void* p;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 return FALSE; 1616 return FALSE;
1617 } 1617 }
1618 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont; 1618 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont;
1619 name = pFont->m_FaceName; 1619 name = pFont->m_FaceName;
1620 return TRUE; 1620 return TRUE;
1621 } 1621 }
1622 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) 1622 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset)
1623 { 1623 {
1624 return FALSE; 1624 return FALSE;
1625 } 1625 }
OLDNEW
« no previous file with comments | « core/src/fxcrt/fx_basic_gcc.cpp ('k') | core/src/fxge/ge/fx_ge_linux.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698