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 "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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 fontName = "FrenchScriptMT"; | 308 fontName = "FrenchScriptMT"; |
309 } else if (fontName.Find("FreeStyle") >= 0) { | 309 } else if (fontName.Find("FreeStyle") >= 0) { |
310 fontName = "FreeStyleScript"; | 310 fontName = "FreeStyleScript"; |
311 } | 311 } |
312 return fontName; | 312 return fontName; |
313 } | 313 } |
314 AltFontFamily* found = (AltFontFamily*)FXSYS_bsearch( | 314 AltFontFamily* found = (AltFontFamily*)FXSYS_bsearch( |
315 fontName.c_str(), g_AltFontFamilies, | 315 fontName.c_str(), g_AltFontFamilies, |
316 sizeof g_AltFontFamilies / sizeof(AltFontFamily), sizeof(AltFontFamily), | 316 sizeof g_AltFontFamilies / sizeof(AltFontFamily), sizeof(AltFontFamily), |
317 CompareFontFamilyString); | 317 CompareFontFamilyString); |
318 if (found == NULL) { | 318 return found ? CFX_ByteString(found->m_pFontFamily) : fontName; |
319 return fontName; | |
320 } | |
321 return found->m_pFontFamily; | |
322 } | 319 } |
323 | 320 |
324 CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) { | 321 CFX_ByteString ParseStyle(const FX_CHAR* pStyle, int iLen, int iIndex) { |
325 CFX_ByteTextBuf buf; | 322 CFX_ByteTextBuf buf; |
326 if (!iLen || iLen <= iIndex) { | 323 if (!iLen || iLen <= iIndex) { |
327 return buf.GetByteString(); | 324 return buf.GetByteString(); |
328 } | 325 } |
329 while (iIndex < iLen) { | 326 while (iIndex < iLen) { |
330 if (pStyle[iIndex] == ',') { | 327 if (pStyle[iIndex] == ',') { |
331 break; | 328 break; |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 FXFT_Done_Face(m_MMFaces[0]); | 669 FXFT_Done_Face(m_MMFaces[0]); |
673 } | 670 } |
674 if (m_MMFaces[1]) { | 671 if (m_MMFaces[1]) { |
675 FXFT_Done_Face(m_MMFaces[1]); | 672 FXFT_Done_Face(m_MMFaces[1]); |
676 } | 673 } |
677 if (m_pFontInfo) { | 674 if (m_pFontInfo) { |
678 m_pFontInfo->Release(); | 675 m_pFontInfo->Release(); |
679 } | 676 } |
680 } | 677 } |
681 void CFX_FontMapper::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) { | 678 void CFX_FontMapper::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) { |
682 if (pFontInfo == NULL) { | 679 if (!pFontInfo) { |
683 return; | 680 return; |
684 } | 681 } |
685 if (m_pFontInfo) { | 682 if (m_pFontInfo) { |
686 m_pFontInfo->Release(); | 683 m_pFontInfo->Release(); |
687 } | 684 } |
688 m_pFontInfo = pFontInfo; | 685 m_pFontInfo = pFontInfo; |
689 } | 686 } |
690 | 687 |
691 CFX_ByteString GetNameFromTT(const uint8_t* name_table, FX_DWORD name_id) { | 688 CFX_ByteString GetNameFromTT(const uint8_t* name_table, FX_DWORD name_id) { |
692 const uint8_t* ptr = name_table + 2; | 689 const uint8_t* ptr = name_table + 2; |
(...skipping 21 matching lines...) Expand all Loading... |
714 return CFX_ByteString(); | 711 return CFX_ByteString(); |
715 | 712 |
716 std::vector<uint8_t> buffer(size); | 713 std::vector<uint8_t> buffer(size); |
717 uint8_t* buffer_ptr = pdfium::vector_as_array(&buffer); | 714 uint8_t* buffer_ptr = pdfium::vector_as_array(&buffer); |
718 FX_DWORD bytes_read = | 715 FX_DWORD bytes_read = |
719 m_pFontInfo->GetFontData(hFont, kTableNAME, buffer_ptr, size); | 716 m_pFontInfo->GetFontData(hFont, kTableNAME, buffer_ptr, size); |
720 return (bytes_read == size) ? GetNameFromTT(buffer_ptr, 6) : CFX_ByteString(); | 717 return (bytes_read == size) ? GetNameFromTT(buffer_ptr, 6) : CFX_ByteString(); |
721 } | 718 } |
722 | 719 |
723 void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) { | 720 void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) { |
724 if (m_pFontInfo == NULL) { | 721 if (!m_pFontInfo) { |
725 return; | 722 return; |
726 } | 723 } |
727 if (m_CharsetArray.Find((FX_DWORD)charset) == -1) { | 724 if (m_CharsetArray.Find((FX_DWORD)charset) == -1) { |
728 m_CharsetArray.Add((FX_DWORD)charset); | 725 m_CharsetArray.Add((FX_DWORD)charset); |
729 m_FaceArray.Add(name); | 726 m_FaceArray.Add(name); |
730 } | 727 } |
731 if (name == m_LastFamily) { | 728 if (name == m_LastFamily) { |
732 return; | 729 return; |
733 } | 730 } |
734 const uint8_t* ptr = name; | 731 const uint8_t* ptr = name; |
735 FX_BOOL bLocalized = FALSE; | 732 FX_BOOL bLocalized = FALSE; |
736 for (int i = 0; i < name.GetLength(); i++) | 733 for (int i = 0; i < name.GetLength(); i++) |
737 if (ptr[i] > 0x80) { | 734 if (ptr[i] > 0x80) { |
738 bLocalized = TRUE; | 735 bLocalized = TRUE; |
739 break; | 736 break; |
740 } | 737 } |
741 if (bLocalized) { | 738 if (bLocalized) { |
742 void* hFont = m_pFontInfo->GetFont(name); | 739 void* hFont = m_pFontInfo->GetFont(name); |
743 if (hFont == NULL) { | 740 if (!hFont) { |
744 int iExact; | 741 int iExact; |
745 hFont = | 742 hFont = |
746 m_pFontInfo->MapFont(0, 0, FXFONT_DEFAULT_CHARSET, 0, name, iExact); | 743 m_pFontInfo->MapFont(0, 0, FXFONT_DEFAULT_CHARSET, 0, name, iExact); |
747 if (hFont == NULL) { | 744 if (!hFont) { |
748 return; | 745 return; |
749 } | 746 } |
750 } | 747 } |
751 CFX_ByteString new_name = GetPSNameFromTT(hFont); | 748 CFX_ByteString new_name = GetPSNameFromTT(hFont); |
752 if (!new_name.IsEmpty()) { | 749 if (!new_name.IsEmpty()) { |
753 new_name.Insert(0, ' '); | 750 new_name.Insert(0, ' '); |
754 m_InstalledTTFonts.Add(new_name); | 751 m_InstalledTTFonts.Add(new_name); |
755 } | 752 } |
756 m_pFontInfo->DeleteFont(hFont); | 753 m_pFontInfo->DeleteFont(hFont); |
757 } | 754 } |
758 m_InstalledTTFonts.Add(name); | 755 m_InstalledTTFonts.Add(name); |
759 m_LastFamily = name; | 756 m_LastFamily = name; |
760 } | 757 } |
761 void CFX_FontMapper::LoadInstalledFonts() { | 758 void CFX_FontMapper::LoadInstalledFonts() { |
762 if (m_pFontInfo == NULL) { | 759 if (!m_pFontInfo) { |
763 return; | 760 return; |
764 } | 761 } |
765 if (m_bListLoaded) { | 762 if (m_bListLoaded) { |
766 return; | 763 return; |
767 } | 764 } |
768 if (m_bListLoaded) { | 765 if (m_bListLoaded) { |
769 return; | 766 return; |
770 } | 767 } |
771 m_pFontInfo->EnumFontList(this); | 768 m_pFontInfo->EnumFontList(this); |
772 m_bListLoaded = TRUE; | 769 m_bListLoaded = TRUE; |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1012 if (WindowCP) { | 1009 if (WindowCP) { |
1013 Charset = GetCharsetFromCodePage(WindowCP); | 1010 Charset = GetCharsetFromCodePage(WindowCP); |
1014 } else if (iBaseFont == 12 && (flags & FXFONT_SYMBOLIC)) { | 1011 } else if (iBaseFont == 12 && (flags & FXFONT_SYMBOLIC)) { |
1015 Charset = FXFONT_SYMBOL_CHARSET; | 1012 Charset = FXFONT_SYMBOL_CHARSET; |
1016 } | 1013 } |
1017 if (Charset == FXFONT_SHIFTJIS_CHARSET || Charset == FXFONT_GB2312_CHARSET || | 1014 if (Charset == FXFONT_SHIFTJIS_CHARSET || Charset == FXFONT_GB2312_CHARSET || |
1018 Charset == FXFONT_HANGEUL_CHARSET || | 1015 Charset == FXFONT_HANGEUL_CHARSET || |
1019 Charset == FXFONT_CHINESEBIG5_CHARSET) { | 1016 Charset == FXFONT_CHINESEBIG5_CHARSET) { |
1020 bCJK = TRUE; | 1017 bCJK = TRUE; |
1021 } | 1018 } |
1022 if (m_pFontInfo == NULL) { | 1019 if (!m_pFontInfo) { |
1023 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; | 1020 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; |
1024 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, | 1021 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, |
1025 PitchFamily); | 1022 PitchFamily); |
1026 } | 1023 } |
1027 family = GetFontFamily(family, nStyle); | 1024 family = GetFontFamily(family, nStyle); |
1028 CFX_ByteString match = MatchInstalledFonts(TT_NormalizeName(family)); | 1025 CFX_ByteString match = MatchInstalledFonts(TT_NormalizeName(family)); |
1029 if (match.IsEmpty() && family != SubstName && | 1026 if (match.IsEmpty() && family != SubstName && |
1030 (!bHasComma && (!bHasHypen || (bHasHypen && !bStyleAvail)))) { | 1027 (!bHasComma && (!bHasHypen || (bHasHypen && !bStyleAvail)))) { |
1031 match = MatchInstalledFonts(TT_NormalizeName(SubstName)); | 1028 match = MatchInstalledFonts(TT_NormalizeName(SubstName)); |
1032 } | 1029 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1081 if (flags & FXFONT_ITALIC) { | 1078 if (flags & FXFONT_ITALIC) { |
1082 bItalic = TRUE; | 1079 bItalic = TRUE; |
1083 } | 1080 } |
1084 } | 1081 } |
1085 iExact = !match.IsEmpty(); | 1082 iExact = !match.IsEmpty(); |
1086 void* hFont = m_pFontInfo->MapFont(weight, bItalic, Charset, PitchFamily, | 1083 void* hFont = m_pFontInfo->MapFont(weight, bItalic, Charset, PitchFamily, |
1087 family, iExact); | 1084 family, iExact); |
1088 if (iExact) { | 1085 if (iExact) { |
1089 pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT; | 1086 pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT; |
1090 } | 1087 } |
1091 if (hFont == NULL) { | 1088 if (!hFont) { |
1092 if (bCJK) { | 1089 if (bCJK) { |
1093 if (italic_angle != 0) { | 1090 if (italic_angle != 0) { |
1094 bItalic = TRUE; | 1091 bItalic = TRUE; |
1095 } else { | 1092 } else { |
1096 bItalic = FALSE; | 1093 bItalic = FALSE; |
1097 } | 1094 } |
1098 weight = old_weight; | 1095 weight = old_weight; |
1099 } | 1096 } |
1100 if (!match.IsEmpty()) { | 1097 if (!match.IsEmpty()) { |
1101 hFont = m_pFontInfo->GetFont(match); | 1098 hFont = m_pFontInfo->GetFont(match); |
1102 if (hFont == NULL) { | 1099 if (!hFont) { |
1103 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, | 1100 return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, |
1104 PitchFamily); | 1101 PitchFamily); |
1105 } | 1102 } |
1106 } else { | 1103 } else { |
1107 if (Charset == FXFONT_SYMBOL_CHARSET) { | 1104 if (Charset == FXFONT_SYMBOL_CHARSET) { |
1108 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \ | 1105 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \ |
1109 _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ | 1106 _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ |
1110 if (SubstName == "Symbol") { | 1107 if (SubstName == "Symbol") { |
1111 pSubstFont->m_Family = "Chrome Symbol"; | 1108 pSubstFont->m_Family = "Chrome Symbol"; |
1112 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; | 1109 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1156 if (ttc_size) { | 1153 if (ttc_size) { |
1157 uint8_t temp[1024]; | 1154 uint8_t temp[1024]; |
1158 m_pFontInfo->GetFontData(hFont, kTableTTCF, temp, 1024); | 1155 m_pFontInfo->GetFontData(hFont, kTableTTCF, temp, 1024); |
1159 FX_DWORD checksum = 0; | 1156 FX_DWORD checksum = 0; |
1160 for (int i = 0; i < 256; i++) { | 1157 for (int i = 0; i < 256; i++) { |
1161 checksum += ((FX_DWORD*)temp)[i]; | 1158 checksum += ((FX_DWORD*)temp)[i]; |
1162 } | 1159 } |
1163 uint8_t* pFontData; | 1160 uint8_t* pFontData; |
1164 face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum, | 1161 face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum, |
1165 ttc_size - font_size, pFontData); | 1162 ttc_size - font_size, pFontData); |
1166 if (face == NULL) { | 1163 if (!face) { |
1167 pFontData = FX_Alloc(uint8_t, ttc_size); | 1164 pFontData = FX_Alloc(uint8_t, ttc_size); |
1168 m_pFontInfo->GetFontData(hFont, kTableTTCF, pFontData, ttc_size); | 1165 m_pFontInfo->GetFontData(hFont, kTableTTCF, pFontData, ttc_size); |
1169 face = m_pFontMgr->AddCachedTTCFace(ttc_size, checksum, pFontData, | 1166 face = m_pFontMgr->AddCachedTTCFace(ttc_size, checksum, pFontData, |
1170 ttc_size, ttc_size - font_size); | 1167 ttc_size, ttc_size - font_size); |
1171 } | 1168 } |
1172 } else { | 1169 } else { |
1173 uint8_t* pFontData; | 1170 uint8_t* pFontData; |
1174 face = m_pFontMgr->GetCachedFace(SubstName, weight, bItalic, pFontData); | 1171 face = m_pFontMgr->GetCachedFace(SubstName, weight, bItalic, pFontData); |
1175 if (face == NULL) { | 1172 if (!face) { |
1176 pFontData = FX_Alloc(uint8_t, font_size); | 1173 pFontData = FX_Alloc(uint8_t, font_size); |
1177 m_pFontInfo->GetFontData(hFont, 0, pFontData, font_size); | 1174 m_pFontInfo->GetFontData(hFont, 0, pFontData, font_size); |
1178 face = m_pFontMgr->AddCachedFace(SubstName, weight, bItalic, pFontData, | 1175 face = m_pFontMgr->AddCachedFace(SubstName, weight, bItalic, pFontData, |
1179 font_size, | 1176 font_size, |
1180 m_pFontInfo->GetFaceIndex(hFont)); | 1177 m_pFontInfo->GetFaceIndex(hFont)); |
1181 } | 1178 } |
1182 } | 1179 } |
1183 if (face == NULL) { | 1180 if (!face) { |
1184 m_pFontInfo->DeleteFont(hFont); | 1181 m_pFontInfo->DeleteFont(hFont); |
1185 return NULL; | 1182 return NULL; |
1186 } | 1183 } |
1187 pSubstFont->m_Family = SubstName; | 1184 pSubstFont->m_Family = SubstName; |
1188 pSubstFont->m_Charset = Charset; | 1185 pSubstFont->m_Charset = Charset; |
1189 FX_BOOL bNeedUpdateWeight = FALSE; | 1186 FX_BOOL bNeedUpdateWeight = FALSE; |
1190 if (FXFT_Is_Face_Bold(face)) { | 1187 if (FXFT_Is_Face_Bold(face)) { |
1191 if (weight == FXFONT_FW_BOLD) { | 1188 if (weight == FXFONT_FW_BOLD) { |
1192 bNeedUpdateWeight = FALSE; | 1189 bNeedUpdateWeight = FALSE; |
1193 } else { | 1190 } else { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 } | 1248 } |
1252 FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) { | 1249 FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) { |
1253 m_pMapper = pMapper; | 1250 m_pMapper = pMapper; |
1254 for (int i = 0; i < m_PathList.GetSize(); i++) { | 1251 for (int i = 0; i < m_PathList.GetSize(); i++) { |
1255 ScanPath(m_PathList[i]); | 1252 ScanPath(m_PathList[i]); |
1256 } | 1253 } |
1257 return TRUE; | 1254 return TRUE; |
1258 } | 1255 } |
1259 void CFX_FolderFontInfo::ScanPath(CFX_ByteString& path) { | 1256 void CFX_FolderFontInfo::ScanPath(CFX_ByteString& path) { |
1260 void* handle = FX_OpenFolder(path); | 1257 void* handle = FX_OpenFolder(path); |
1261 if (handle == NULL) { | 1258 if (!handle) { |
1262 return; | 1259 return; |
1263 } | 1260 } |
1264 CFX_ByteString filename; | 1261 CFX_ByteString filename; |
1265 FX_BOOL bFolder; | 1262 FX_BOOL bFolder; |
1266 while (FX_GetNextFile(handle, filename, bFolder)) { | 1263 while (FX_GetNextFile(handle, filename, bFolder)) { |
1267 if (bFolder) { | 1264 if (bFolder) { |
1268 if (filename == "." || filename == "..") { | 1265 if (filename == "." || filename == "..") { |
1269 continue; | 1266 continue; |
1270 } | 1267 } |
1271 } else { | 1268 } else { |
(...skipping 13 matching lines...) Expand all Loading... |
1285 if (bFolder) { | 1282 if (bFolder) { |
1286 ScanPath(fullpath); | 1283 ScanPath(fullpath); |
1287 } else { | 1284 } else { |
1288 ScanFile(fullpath); | 1285 ScanFile(fullpath); |
1289 } | 1286 } |
1290 } | 1287 } |
1291 FX_CloseFolder(handle); | 1288 FX_CloseFolder(handle); |
1292 } | 1289 } |
1293 void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) { | 1290 void CFX_FolderFontInfo::ScanFile(CFX_ByteString& path) { |
1294 FXSYS_FILE* pFile = FXSYS_fopen(path, "rb"); | 1291 FXSYS_FILE* pFile = FXSYS_fopen(path, "rb"); |
1295 if (pFile == NULL) { | 1292 if (!pFile) { |
1296 return; | 1293 return; |
1297 } | 1294 } |
1298 FXSYS_fseek(pFile, 0, FXSYS_SEEK_END); | 1295 FXSYS_fseek(pFile, 0, FXSYS_SEEK_END); |
1299 FX_DWORD filesize = FXSYS_ftell(pFile); | 1296 FX_DWORD filesize = FXSYS_ftell(pFile); |
1300 uint8_t buffer[16]; | 1297 uint8_t buffer[16]; |
1301 FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET); | 1298 FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET); |
1302 size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile); | 1299 size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile); |
1303 if (readCnt != 1) { | 1300 if (readCnt != 1) { |
1304 FXSYS_fclose(pFile); | 1301 FXSYS_fclose(pFile); |
1305 return; | 1302 return; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1486 if (FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET) < 0 || | 1483 if (FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET) < 0 || |
1487 FXSYS_fread(buffer, datasize, 1, pFile) != 1) { | 1484 FXSYS_fread(buffer, datasize, 1, pFile) != 1) { |
1488 datasize = 0; | 1485 datasize = 0; |
1489 } | 1486 } |
1490 FXSYS_fclose(pFile); | 1487 FXSYS_fclose(pFile); |
1491 return datasize; | 1488 return datasize; |
1492 } | 1489 } |
1493 | 1490 |
1494 void CFX_FolderFontInfo::DeleteFont(void* hFont) {} | 1491 void CFX_FolderFontInfo::DeleteFont(void* hFont) {} |
1495 FX_BOOL CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) { | 1492 FX_BOOL CFX_FolderFontInfo::GetFaceName(void* hFont, CFX_ByteString& name) { |
1496 if (hFont == NULL) { | 1493 if (!hFont) { |
1497 return FALSE; | 1494 return FALSE; |
1498 } | 1495 } |
1499 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont; | 1496 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont; |
1500 name = pFont->m_FaceName; | 1497 name = pFont->m_FaceName; |
1501 return TRUE; | 1498 return TRUE; |
1502 } | 1499 } |
1503 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) { | 1500 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) { |
1504 return FALSE; | 1501 return FALSE; |
1505 } | 1502 } |
1506 | 1503 |
1507 int PDF_GetStandardFontName(CFX_ByteString* name) { | 1504 int PDF_GetStandardFontName(CFX_ByteString* name) { |
1508 AltFontName* found = static_cast<AltFontName*>( | 1505 AltFontName* found = static_cast<AltFontName*>( |
1509 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), | 1506 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), |
1510 sizeof(AltFontName), CompareString)); | 1507 sizeof(AltFontName), CompareString)); |
1511 if (!found) | 1508 if (!found) |
1512 return -1; | 1509 return -1; |
1513 | 1510 |
1514 *name = g_Base14FontNames[found->m_Index]; | 1511 *name = g_Base14FontNames[found->m_Index]; |
1515 return found->m_Index; | 1512 return found->m_Index; |
1516 } | 1513 } |
OLD | NEW |