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 <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 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 const uint8_t* ptr = name; | 585 const uint8_t* ptr = name; |
586 FX_BOOL bLocalized = FALSE; | 586 FX_BOOL bLocalized = FALSE; |
587 for (int i = 0; i < name.GetLength(); i ++) | 587 for (int i = 0; i < name.GetLength(); i ++) |
588 if (ptr[i] > 0x80) { | 588 if (ptr[i] > 0x80) { |
589 bLocalized = TRUE; | 589 bLocalized = TRUE; |
590 break; | 590 break; |
591 } | 591 } |
592 if (bLocalized) { | 592 if (bLocalized) { |
593 void* hFont = m_pFontInfo->GetFont(name); | 593 void* hFont = m_pFontInfo->GetFont(name); |
594 if (hFont == NULL) { | 594 if (hFont == NULL) { |
595 FX_BOOL bExact; | 595 int iExact; |
596 hFont = m_pFontInfo->MapFont(0, 0, FXFONT_DEFAULT_CHARSET, 0, name,
bExact); | 596 hFont = m_pFontInfo->MapFont(0, 0, FXFONT_DEFAULT_CHARSET, 0, name,
iExact); |
597 if (hFont == NULL) { | 597 if (hFont == NULL) { |
598 return; | 598 return; |
599 } | 599 } |
600 } | 600 } |
601 CFX_ByteString new_name = GetPSNameFromTT(hFont); | 601 CFX_ByteString new_name = GetPSNameFromTT(hFont); |
602 if (!new_name.IsEmpty()) { | 602 if (!new_name.IsEmpty()) { |
603 new_name.Insert(0, ' '); | 603 new_name.Insert(0, ' '); |
604 m_InstalledTTFonts.Add(new_name); | 604 m_InstalledTTFonts.Add(new_name); |
605 } | 605 } |
606 m_pFontInfo->DeleteFont(hFont); | 606 m_pFontInfo->DeleteFont(hFont); |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 } | 1038 } |
1039 weight = weight ? weight : FXFONT_FW_NORMAL; | 1039 weight = weight ? weight : FXFONT_FW_NORMAL; |
1040 int old_weight = weight; | 1040 int old_weight = weight; |
1041 if (nStyle) { | 1041 if (nStyle) { |
1042 weight = nStyle & FX_FONT_STYLE_BoldBold ? 900 : (nStyle & FX_FONT_STYLE
_Bold ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL); | 1042 weight = nStyle & FX_FONT_STYLE_BoldBold ? 900 : (nStyle & FX_FONT_STYLE
_Bold ? FXFONT_FW_BOLD : FXFONT_FW_NORMAL); |
1043 } | 1043 } |
1044 if (nStyle & FX_FONT_STYLE_Italic) { | 1044 if (nStyle & FX_FONT_STYLE_Italic) { |
1045 bItalic = TRUE; | 1045 bItalic = TRUE; |
1046 } | 1046 } |
1047 FX_BOOL bCJK = FALSE; | 1047 FX_BOOL bCJK = FALSE; |
1048 FX_BOOL bExact = FALSE; | 1048 int iExact = 0; |
1049 int Charset = FXFONT_ANSI_CHARSET; | 1049 int Charset = FXFONT_ANSI_CHARSET; |
1050 if (WindowCP) { | 1050 if (WindowCP) { |
1051 Charset = _GetCharsetFromCodePage(WindowCP); | 1051 Charset = _GetCharsetFromCodePage(WindowCP); |
1052 } else if (iBaseFont == 12 && (flags & FXFONT_SYMBOLIC)) { | 1052 } else if (iBaseFont == 12 && (flags & FXFONT_SYMBOLIC)) { |
1053 Charset = FXFONT_SYMBOL_CHARSET; | 1053 Charset = FXFONT_SYMBOL_CHARSET; |
1054 } | 1054 } |
1055 if (Charset == FXFONT_SHIFTJIS_CHARSET || Charset == FXFONT_GB2312_CHARSET |
| | 1055 if (Charset == FXFONT_SHIFTJIS_CHARSET || Charset == FXFONT_GB2312_CHARSET |
| |
1056 Charset == FXFONT_HANGEUL_CHARSET || Charset == FXFONT_CHINESEBIG5_C
HARSET) { | 1056 Charset == FXFONT_HANGEUL_CHARSET || Charset == FXFONT_CHINESEBIG5_C
HARSET) { |
1057 bCJK = TRUE; | 1057 bCJK = TRUE; |
1058 } | 1058 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 } else { | 1119 } else { |
1120 family = g_Base14FontNames[iBaseFont]; | 1120 family = g_Base14FontNames[iBaseFont]; |
1121 } | 1121 } |
1122 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; | 1122 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; |
1123 } | 1123 } |
1124 } else { | 1124 } else { |
1125 if (flags & FXFONT_ITALIC) { | 1125 if (flags & FXFONT_ITALIC) { |
1126 bItalic = TRUE; | 1126 bItalic = TRUE; |
1127 } | 1127 } |
1128 } | 1128 } |
1129 bExact = !match.IsEmpty(); | 1129 iExact = !match.IsEmpty(); |
1130 void* hFont = m_pFontInfo->MapFont(weight, bItalic, Charset, PitchFamily, fa
mily, bExact); | 1130 void* hFont = m_pFontInfo->MapFont(weight, bItalic, Charset, PitchFamily, fa
mily, iExact); |
1131 if (bExact) { | 1131 if (iExact) { |
1132 pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT; | 1132 pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT; |
1133 } | 1133 } |
1134 if (hFont == NULL) { | 1134 if (hFont == NULL) { |
1135 if (bCJK) { | 1135 if (bCJK) { |
1136 if (italic_angle != 0) { | 1136 if (italic_angle != 0) { |
1137 bItalic = TRUE; | 1137 bItalic = TRUE; |
1138 } else { | 1138 } else { |
1139 bItalic = FALSE; | 1139 bItalic = FALSE; |
1140 } | 1140 } |
1141 weight = old_weight; | 1141 weight = old_weight; |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 pInfo->m_Styles |= FXFONT_BOLD; | 1444 pInfo->m_Styles |= FXFONT_BOLD; |
1445 } | 1445 } |
1446 if (style.Find(FX_BSTRC("Italic")) > -1 || style.Find(FX_BSTRC("Oblique")) >
-1) { | 1446 if (style.Find(FX_BSTRC("Italic")) > -1 || style.Find(FX_BSTRC("Oblique")) >
-1) { |
1447 pInfo->m_Styles |= FXFONT_ITALIC; | 1447 pInfo->m_Styles |= FXFONT_ITALIC; |
1448 } | 1448 } |
1449 if (facename.Find(FX_BSTRC("Serif")) > -1) { | 1449 if (facename.Find(FX_BSTRC("Serif")) > -1) { |
1450 pInfo->m_Styles |= FXFONT_SERIF; | 1450 pInfo->m_Styles |= FXFONT_SERIF; |
1451 } | 1451 } |
1452 m_FontList.SetAt(facename, pInfo); | 1452 m_FontList.SetAt(facename, pInfo); |
1453 } | 1453 } |
1454 void* CFX_FolderFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int
pitch_family, const FX_CHAR* family, FX_BOOL& bExact) | 1454 void* CFX_FolderFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int
pitch_family, const FX_CHAR* family, int& iExact) |
1455 { | 1455 { |
1456 return NULL; | 1456 return NULL; |
1457 } | 1457 } |
1458 void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) | 1458 void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) |
1459 { | 1459 { |
1460 void* p; | 1460 void* p; |
1461 if (!m_FontList.Lookup(face, p)) { | 1461 if (!m_FontList.Lookup(face, p)) { |
1462 return NULL; | 1462 return NULL; |
1463 } | 1463 } |
1464 return p; | 1464 return p; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1512 return FALSE; | 1512 return FALSE; |
1513 } | 1513 } |
1514 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont; | 1514 CFontFaceInfo* pFont = (CFontFaceInfo*)hFont; |
1515 name = pFont->m_FaceName; | 1515 name = pFont->m_FaceName; |
1516 return TRUE; | 1516 return TRUE; |
1517 } | 1517 } |
1518 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) | 1518 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) |
1519 { | 1519 { |
1520 return FALSE; | 1520 return FALSE; |
1521 } | 1521 } |
OLD | NEW |