| 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" |
| 11 #include "text_int.h" | 11 #include "text_int.h" |
| 12 |
| 12 #define GET_TT_SHORT(w) (FX_WORD)(((w)[0] << 8) | (w)[1]) | 13 #define GET_TT_SHORT(w) (FX_WORD)(((w)[0] << 8) | (w)[1]) |
| 13 #define GET_TT_LONG(w) \ | 14 #define GET_TT_LONG(w) \ |
| 14 (FX_DWORD)(((w)[0] << 24) | ((w)[1] << 16) | ((w)[2] << 8) | (w)[3]) | 15 (FX_DWORD)(((w)[0] << 24) | ((w)[1] << 16) | ((w)[2] << 8) | (w)[3]) |
| 16 |
| 17 namespace { |
| 18 |
| 19 CFX_ByteString KeyNameFromFace(const CFX_ByteString& face_name, |
| 20 int weight, |
| 21 FX_BOOL bItalic) { |
| 22 CFX_ByteString key(face_name); |
| 23 key += ','; |
| 24 key += CFX_ByteString::FormatInteger(weight); |
| 25 key += bItalic ? 'I' : 'N'; |
| 26 return key; |
| 27 } |
| 28 |
| 29 CFX_ByteString KeyNameFromSize(int ttc_size, FX_DWORD checksum) { |
| 30 CFX_ByteString key; |
| 31 key.Format("%d:%d", ttc_size, checksum); |
| 32 return key; |
| 33 } |
| 34 |
| 35 } // namespace |
| 36 |
| 15 CFX_SubstFont::CFX_SubstFont() { | 37 CFX_SubstFont::CFX_SubstFont() { |
| 16 m_ExtHandle = NULL; | 38 m_ExtHandle = NULL; |
| 17 m_Charset = 0; | 39 m_Charset = 0; |
| 18 m_SubstFlags = 0; | 40 m_SubstFlags = 0; |
| 19 m_Weight = 0; | 41 m_Weight = 0; |
| 20 m_ItalicAngle = 0; | 42 m_ItalicAngle = 0; |
| 21 m_bSubstOfCJK = FALSE; | 43 m_bSubstOfCJK = FALSE; |
| 22 m_WeightCJK = 0; | 44 m_WeightCJK = 0; |
| 23 m_bItlicCJK = FALSE; | 45 m_bItlicCJK = FALSE; |
| 24 } | 46 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 if (m_FTLibrary) { | 89 if (m_FTLibrary) { |
| 68 FXFT_Done_FreeType(m_FTLibrary); | 90 FXFT_Done_FreeType(m_FTLibrary); |
| 69 } | 91 } |
| 70 } | 92 } |
| 71 void CFX_FontMgr::InitFTLibrary() { | 93 void CFX_FontMgr::InitFTLibrary() { |
| 72 if (m_FTLibrary == NULL) { | 94 if (m_FTLibrary == NULL) { |
| 73 FXFT_Init_FreeType(&m_FTLibrary); | 95 FXFT_Init_FreeType(&m_FTLibrary); |
| 74 } | 96 } |
| 75 } | 97 } |
| 76 void CFX_FontMgr::FreeCache() { | 98 void CFX_FontMgr::FreeCache() { |
| 77 FX_POSITION pos = m_FaceMap.GetStartPosition(); | 99 for (const auto& pair : m_FaceMap) { |
| 78 while (pos) { | 100 delete pair.second; |
| 79 CFX_ByteString Key; | |
| 80 CTTFontDesc* face; | |
| 81 m_FaceMap.GetNextAssoc(pos, Key, (void*&)face); | |
| 82 delete face; | |
| 83 } | 101 } |
| 84 m_FaceMap.RemoveAll(); | 102 m_FaceMap.clear(); |
| 85 } | 103 } |
| 86 void CFX_FontMgr::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) { | 104 void CFX_FontMgr::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) { |
| 87 m_pBuiltinMapper->SetSystemFontInfo(pFontInfo); | 105 m_pBuiltinMapper->SetSystemFontInfo(pFontInfo); |
| 88 } | 106 } |
| 89 FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name, | 107 FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name, |
| 90 FX_BOOL bTrueType, | 108 FX_BOOL bTrueType, |
| 91 FX_DWORD flags, | 109 FX_DWORD flags, |
| 92 int weight, | 110 int weight, |
| 93 int italic_angle, | 111 int italic_angle, |
| 94 int CharsetCP, | 112 int CharsetCP, |
| 95 CFX_SubstFont* pSubstFont) { | 113 CFX_SubstFont* pSubstFont) { |
| 96 if (!m_FTLibrary) { | 114 if (!m_FTLibrary) { |
| 97 FXFT_Init_FreeType(&m_FTLibrary); | 115 FXFT_Init_FreeType(&m_FTLibrary); |
| 98 } | 116 } |
| 99 return m_pBuiltinMapper->FindSubstFont(face_name, bTrueType, flags, weight, | 117 return m_pBuiltinMapper->FindSubstFont(face_name, bTrueType, flags, weight, |
| 100 italic_angle, CharsetCP, pSubstFont); | 118 italic_angle, CharsetCP, pSubstFont); |
| 101 } | 119 } |
| 102 FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name, | 120 FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name, |
| 103 int weight, | 121 int weight, |
| 104 FX_BOOL bItalic, | 122 FX_BOOL bItalic, |
| 105 uint8_t*& pFontData) { | 123 uint8_t*& pFontData) { |
| 106 CFX_ByteString key(face_name); | 124 auto it = m_FaceMap.find(KeyNameFromFace(face_name, weight, bItalic)); |
| 107 key += ','; | 125 if (it == m_FaceMap.end()) |
| 108 key += CFX_ByteString::FormatInteger(weight); | 126 return nullptr; |
| 109 key += bItalic ? 'I' : 'N'; | 127 |
| 110 CTTFontDesc* pFontDesc = NULL; | 128 CTTFontDesc* pFontDesc = it->second; |
| 111 m_FaceMap.Lookup(key, (void*&)pFontDesc); | 129 pFontData = pFontDesc->m_pFontData; |
| 112 if (pFontDesc) { | 130 pFontDesc->m_RefCount++; |
| 113 pFontData = pFontDesc->m_pFontData; | 131 return pFontDesc->m_SingleFace.m_pFace; |
| 114 pFontDesc->m_RefCount++; | |
| 115 return pFontDesc->m_SingleFace.m_pFace; | |
| 116 } | |
| 117 return NULL; | |
| 118 } | 132 } |
| 119 FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name, | 133 FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name, |
| 120 int weight, | 134 int weight, |
| 121 FX_BOOL bItalic, | 135 FX_BOOL bItalic, |
| 122 uint8_t* pData, | 136 uint8_t* pData, |
| 123 FX_DWORD size, | 137 FX_DWORD size, |
| 124 int face_index) { | 138 int face_index) { |
| 125 CTTFontDesc* pFontDesc = new CTTFontDesc; | 139 CTTFontDesc* pFontDesc = new CTTFontDesc; |
| 126 pFontDesc->m_Type = 1; | 140 pFontDesc->m_Type = 1; |
| 127 pFontDesc->m_SingleFace.m_pFace = NULL; | 141 pFontDesc->m_SingleFace.m_pFace = NULL; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 138 &pFontDesc->m_SingleFace.m_pFace); | 152 &pFontDesc->m_SingleFace.m_pFace); |
| 139 if (ret) { | 153 if (ret) { |
| 140 delete pFontDesc; | 154 delete pFontDesc; |
| 141 return NULL; | 155 return NULL; |
| 142 } | 156 } |
| 143 ret = FXFT_Set_Pixel_Sizes(pFontDesc->m_SingleFace.m_pFace, 64, 64); | 157 ret = FXFT_Set_Pixel_Sizes(pFontDesc->m_SingleFace.m_pFace, 64, 64); |
| 144 if (ret) { | 158 if (ret) { |
| 145 delete pFontDesc; | 159 delete pFontDesc; |
| 146 return NULL; | 160 return NULL; |
| 147 } | 161 } |
| 148 CFX_ByteString key(face_name); | 162 m_FaceMap[KeyNameFromFace(face_name, weight, bItalic)] = pFontDesc; |
| 149 key += ','; | |
| 150 key += CFX_ByteString::FormatInteger(weight); | |
| 151 key += bItalic ? 'I' : 'N'; | |
| 152 m_FaceMap.SetAt(key, pFontDesc); | |
| 153 return pFontDesc->m_SingleFace.m_pFace; | 163 return pFontDesc->m_SingleFace.m_pFace; |
| 154 } | 164 } |
| 155 const FX_CHAR* const g_Base14FontNames[14] = { | 165 const FX_CHAR* const g_Base14FontNames[14] = { |
| 156 "Courier", | 166 "Courier", |
| 157 "Courier-Bold", | 167 "Courier-Bold", |
| 158 "Courier-BoldOblique", | 168 "Courier-BoldOblique", |
| 159 "Courier-Oblique", | 169 "Courier-Oblique", |
| 160 "Helvetica", | 170 "Helvetica", |
| 161 "Helvetica-Bold", | 171 "Helvetica-Bold", |
| 162 "Helvetica-BoldOblique", | 172 "Helvetica-BoldOblique", |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 face_index = 0; | 305 face_index = 0; |
| 296 } else { | 306 } else { |
| 297 face_index = index; | 307 face_index = index; |
| 298 } | 308 } |
| 299 return face_index; | 309 return face_index; |
| 300 } | 310 } |
| 301 FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size, | 311 FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size, |
| 302 FX_DWORD checksum, | 312 FX_DWORD checksum, |
| 303 int font_offset, | 313 int font_offset, |
| 304 uint8_t*& pFontData) { | 314 uint8_t*& pFontData) { |
| 305 CFX_ByteString key; | 315 auto it = m_FaceMap.find(KeyNameFromSize(ttc_size, checksum)); |
| 306 key.Format("%d:%d", ttc_size, checksum); | 316 if (it == m_FaceMap.end()) |
| 307 CTTFontDesc* pFontDesc = NULL; | 317 return nullptr; |
| 308 m_FaceMap.Lookup(key, (void*&)pFontDesc); | 318 |
| 309 if (pFontDesc == NULL) { | 319 CTTFontDesc* pFontDesc = it->second; |
| 310 return NULL; | |
| 311 } | |
| 312 pFontData = pFontDesc->m_pFontData; | 320 pFontData = pFontDesc->m_pFontData; |
| 313 pFontDesc->m_RefCount++; | 321 pFontDesc->m_RefCount++; |
| 314 int face_index = GetTTCIndex(pFontDesc->m_pFontData, ttc_size, font_offset); | 322 int face_index = GetTTCIndex(pFontDesc->m_pFontData, ttc_size, font_offset); |
| 315 if (pFontDesc->m_TTCFace.m_pFaces[face_index] == NULL) { | 323 if (!pFontDesc->m_TTCFace.m_pFaces[face_index]) { |
| 316 pFontDesc->m_TTCFace.m_pFaces[face_index] = | 324 pFontDesc->m_TTCFace.m_pFaces[face_index] = |
| 317 GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index); | 325 GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index); |
| 318 } | 326 } |
| 319 return pFontDesc->m_TTCFace.m_pFaces[face_index]; | 327 return pFontDesc->m_TTCFace.m_pFaces[face_index]; |
| 320 } | 328 } |
| 321 FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size, | 329 FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size, |
| 322 FX_DWORD checksum, | 330 FX_DWORD checksum, |
| 323 uint8_t* pData, | 331 uint8_t* pData, |
| 324 FX_DWORD size, | 332 FX_DWORD size, |
| 325 int font_offset) { | 333 int font_offset) { |
| 326 CFX_ByteString key; | |
| 327 key.Format("%d:%d", ttc_size, checksum); | |
| 328 CTTFontDesc* pFontDesc = new CTTFontDesc; | 334 CTTFontDesc* pFontDesc = new CTTFontDesc; |
| 329 pFontDesc->m_Type = 2; | 335 pFontDesc->m_Type = 2; |
| 330 pFontDesc->m_pFontData = pData; | 336 pFontDesc->m_pFontData = pData; |
| 331 for (int i = 0; i < 16; i++) { | 337 for (int i = 0; i < 16; i++) { |
| 332 pFontDesc->m_TTCFace.m_pFaces[i] = NULL; | 338 pFontDesc->m_TTCFace.m_pFaces[i] = NULL; |
| 333 } | 339 } |
| 334 pFontDesc->m_RefCount++; | 340 pFontDesc->m_RefCount++; |
| 335 key.Format("%d:%d", ttc_size, checksum); | 341 m_FaceMap[KeyNameFromSize(ttc_size, checksum)] = pFontDesc; |
| 336 m_FaceMap.SetAt(key, pFontDesc); | |
| 337 int face_index = GetTTCIndex(pFontDesc->m_pFontData, ttc_size, font_offset); | 342 int face_index = GetTTCIndex(pFontDesc->m_pFontData, ttc_size, font_offset); |
| 338 pFontDesc->m_TTCFace.m_pFaces[face_index] = | 343 pFontDesc->m_TTCFace.m_pFaces[face_index] = |
| 339 GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index); | 344 GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index); |
| 340 return pFontDesc->m_TTCFace.m_pFaces[face_index]; | 345 return pFontDesc->m_TTCFace.m_pFaces[face_index]; |
| 341 } | 346 } |
| 342 FXFT_Face CFX_FontMgr::GetFixedFace(const uint8_t* pData, | 347 FXFT_Face CFX_FontMgr::GetFixedFace(const uint8_t* pData, |
| 343 FX_DWORD size, | 348 FX_DWORD size, |
| 344 int face_index) { | 349 int face_index) { |
| 345 FXFT_Library library; | 350 FXFT_Library library; |
| 346 if (m_FTLibrary == NULL) { | 351 if (m_FTLibrary == NULL) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 369 if (ret) { | 374 if (ret) { |
| 370 return NULL; | 375 return NULL; |
| 371 } | 376 } |
| 372 ret = FXFT_Set_Pixel_Sizes(face, 64, 64); | 377 ret = FXFT_Set_Pixel_Sizes(face, 64, 64); |
| 373 if (ret) { | 378 if (ret) { |
| 374 return NULL; | 379 return NULL; |
| 375 } | 380 } |
| 376 return face; | 381 return face; |
| 377 } | 382 } |
| 378 void CFX_FontMgr::ReleaseFace(FXFT_Face face) { | 383 void CFX_FontMgr::ReleaseFace(FXFT_Face face) { |
| 379 if (face == NULL) { | 384 if (!face) { |
| 380 return; | 385 return; |
| 381 } | 386 } |
| 382 FX_POSITION pos = m_FaceMap.GetStartPosition(); | 387 auto it = m_FaceMap.begin(); |
| 383 while (pos) { | 388 while (it != m_FaceMap.end()) { |
| 384 CFX_ByteString Key; | 389 auto temp = it++; |
| 385 CTTFontDesc* ttface; | 390 if (temp->second->ReleaseFace(face)) { |
| 386 m_FaceMap.GetNextAssoc(pos, Key, (void*&)ttface); | 391 m_FaceMap.erase(temp); |
| 387 if (ttface->ReleaseFace(face)) { | |
| 388 m_FaceMap.RemoveKey(Key); | |
| 389 } | 392 } |
| 390 } | 393 } |
| 391 } | 394 } |
| 392 extern "C" { | 395 extern "C" { |
| 393 extern const unsigned char g_FoxitFixedItalicFontData[18746]; | 396 extern const unsigned char g_FoxitFixedItalicFontData[18746]; |
| 394 extern const unsigned char g_FoxitFixedFontData[17597]; | 397 extern const unsigned char g_FoxitFixedFontData[17597]; |
| 395 extern const unsigned char g_FoxitSansItalicFontData[16339]; | 398 extern const unsigned char g_FoxitSansItalicFontData[16339]; |
| 396 extern const unsigned char g_FoxitSansFontData[15025]; | 399 extern const unsigned char g_FoxitSansFontData[15025]; |
| 397 extern const unsigned char g_FoxitSerifItalicFontData[21227]; | 400 extern const unsigned char g_FoxitSerifItalicFontData[21227]; |
| 398 extern const unsigned char g_FoxitSerifFontData[19469]; | 401 extern const unsigned char g_FoxitSerifFontData[19469]; |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1267 FXFT_Face* Face, | 1270 FXFT_Face* Face, |
| 1268 IFX_FileRead* pFile, | 1271 IFX_FileRead* pFile, |
| 1269 FXFT_Stream* stream); | 1272 FXFT_Stream* stream); |
| 1270 #if _FX_OS_ == _FX_ANDROID_ | 1273 #if _FX_OS_ == _FX_ANDROID_ |
| 1271 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) { | 1274 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) { |
| 1272 return NULL; | 1275 return NULL; |
| 1273 } | 1276 } |
| 1274 #endif | 1277 #endif |
| 1275 CFX_FolderFontInfo::CFX_FolderFontInfo() {} | 1278 CFX_FolderFontInfo::CFX_FolderFontInfo() {} |
| 1276 CFX_FolderFontInfo::~CFX_FolderFontInfo() { | 1279 CFX_FolderFontInfo::~CFX_FolderFontInfo() { |
| 1277 FX_POSITION pos = m_FontList.GetStartPosition(); | 1280 for (const auto& pair : m_FontList) { |
| 1278 while (pos) { | 1281 delete pair.second; |
| 1279 CFX_ByteString key; | |
| 1280 void* value; | |
| 1281 m_FontList.GetNextAssoc(pos, key, value); | |
| 1282 delete (CFX_FontFaceInfo*)value; | |
| 1283 } | 1282 } |
| 1284 } | 1283 } |
| 1285 void CFX_FolderFontInfo::AddPath(const CFX_ByteStringC& path) { | 1284 void CFX_FolderFontInfo::AddPath(const CFX_ByteStringC& path) { |
| 1286 m_PathList.Add(path); | 1285 m_PathList.Add(path); |
| 1287 } | 1286 } |
| 1288 void CFX_FolderFontInfo::Release() { | 1287 void CFX_FolderFontInfo::Release() { |
| 1289 delete this; | 1288 delete this; |
| 1290 } | 1289 } |
| 1291 FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) { | 1290 FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) { |
| 1292 m_pMapper = pMapper; | 1291 m_pMapper = pMapper; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1382 if (tables.IsEmpty()) { | 1381 if (tables.IsEmpty()) { |
| 1383 return; | 1382 return; |
| 1384 } | 1383 } |
| 1385 CFX_ByteString names = | 1384 CFX_ByteString names = |
| 1386 _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x6e616d65); | 1385 _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x6e616d65); |
| 1387 CFX_ByteString facename = _FPDF_GetNameFromTT(names, 1); | 1386 CFX_ByteString facename = _FPDF_GetNameFromTT(names, 1); |
| 1388 CFX_ByteString style = _FPDF_GetNameFromTT(names, 2); | 1387 CFX_ByteString style = _FPDF_GetNameFromTT(names, 2); |
| 1389 if (style != "Regular") { | 1388 if (style != "Regular") { |
| 1390 facename += " " + style; | 1389 facename += " " + style; |
| 1391 } | 1390 } |
| 1392 void* p; | 1391 if (m_FontList.find(facename) != m_FontList.end()) { |
| 1393 if (m_FontList.Lookup(facename, p)) { | |
| 1394 return; | 1392 return; |
| 1395 } | 1393 } |
| 1396 CFX_FontFaceInfo* pInfo = | 1394 CFX_FontFaceInfo* pInfo = |
| 1397 new CFX_FontFaceInfo(path, facename, tables, offset, filesize); | 1395 new CFX_FontFaceInfo(path, facename, tables, offset, filesize); |
| 1398 CFX_ByteString os2 = | 1396 CFX_ByteString os2 = |
| 1399 _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x4f532f32); | 1397 _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x4f532f32); |
| 1400 if (os2.GetLength() >= 86) { | 1398 if (os2.GetLength() >= 86) { |
| 1401 const uint8_t* p = (const uint8_t*)os2 + 78; | 1399 const uint8_t* p = (const uint8_t*)os2 + 78; |
| 1402 FX_DWORD codepages = GET_TT_LONG(p); | 1400 FX_DWORD codepages = GET_TT_LONG(p); |
| 1403 if (codepages & (1 << 17)) { | 1401 if (codepages & (1 << 17)) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1427 if (style.Find(FX_BSTRC("Bold")) > -1) { | 1425 if (style.Find(FX_BSTRC("Bold")) > -1) { |
| 1428 pInfo->m_Styles |= FXFONT_BOLD; | 1426 pInfo->m_Styles |= FXFONT_BOLD; |
| 1429 } | 1427 } |
| 1430 if (style.Find(FX_BSTRC("Italic")) > -1 || | 1428 if (style.Find(FX_BSTRC("Italic")) > -1 || |
| 1431 style.Find(FX_BSTRC("Oblique")) > -1) { | 1429 style.Find(FX_BSTRC("Oblique")) > -1) { |
| 1432 pInfo->m_Styles |= FXFONT_ITALIC; | 1430 pInfo->m_Styles |= FXFONT_ITALIC; |
| 1433 } | 1431 } |
| 1434 if (facename.Find(FX_BSTRC("Serif")) > -1) { | 1432 if (facename.Find(FX_BSTRC("Serif")) > -1) { |
| 1435 pInfo->m_Styles |= FXFONT_SERIF; | 1433 pInfo->m_Styles |= FXFONT_SERIF; |
| 1436 } | 1434 } |
| 1437 m_FontList.SetAt(facename, pInfo); | 1435 m_FontList[facename] = pInfo; |
| 1438 } | 1436 } |
| 1439 void* CFX_FolderFontInfo::MapFont(int weight, | 1437 void* CFX_FolderFontInfo::MapFont(int weight, |
| 1440 FX_BOOL bItalic, | 1438 FX_BOOL bItalic, |
| 1441 int charset, | 1439 int charset, |
| 1442 int pitch_family, | 1440 int pitch_family, |
| 1443 const FX_CHAR* family, | 1441 const FX_CHAR* family, |
| 1444 int& iExact) { | 1442 int& iExact) { |
| 1445 return NULL; | 1443 return NULL; |
| 1446 } | 1444 } |
| 1447 void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) { | 1445 void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) { |
| 1448 void* p; | 1446 auto it = m_FontList.find(face); |
| 1449 if (!m_FontList.Lookup(face, p)) { | 1447 return it != m_FontList.end() ? it->second : nullptr; |
| 1450 return NULL; | |
| 1451 } | |
| 1452 return p; | |
| 1453 } | 1448 } |
| 1454 FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, | 1449 FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, |
| 1455 FX_DWORD table, | 1450 FX_DWORD table, |
| 1456 uint8_t* buffer, | 1451 uint8_t* buffer, |
| 1457 FX_DWORD size) { | 1452 FX_DWORD size) { |
| 1458 if (hFont == NULL) { | 1453 if (hFont == NULL) { |
| 1459 return 0; | 1454 return 0; |
| 1460 } | 1455 } |
| 1461 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont; | 1456 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont; |
| 1462 FXSYS_FILE* pFile = NULL; | 1457 FXSYS_FILE* pFile = NULL; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1498 if (hFont == NULL) { | 1493 if (hFont == NULL) { |
| 1499 return FALSE; | 1494 return FALSE; |
| 1500 } | 1495 } |
| 1501 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont; | 1496 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont; |
| 1502 name = pFont->m_FaceName; | 1497 name = pFont->m_FaceName; |
| 1503 return TRUE; | 1498 return TRUE; |
| 1504 } | 1499 } |
| 1505 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) { | 1500 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) { |
| 1506 return FALSE; | 1501 return FALSE; |
| 1507 } | 1502 } |
| OLD | NEW |