| 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 if (!pFontDesc) { | 140 if (!pFontDesc) { |
| 127 return NULL; | 141 return NULL; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 141 &pFontDesc->m_SingleFace.m_pFace); | 155 &pFontDesc->m_SingleFace.m_pFace); |
| 142 if (ret) { | 156 if (ret) { |
| 143 delete pFontDesc; | 157 delete pFontDesc; |
| 144 return NULL; | 158 return NULL; |
| 145 } | 159 } |
| 146 ret = FXFT_Set_Pixel_Sizes(pFontDesc->m_SingleFace.m_pFace, 64, 64); | 160 ret = FXFT_Set_Pixel_Sizes(pFontDesc->m_SingleFace.m_pFace, 64, 64); |
| 147 if (ret) { | 161 if (ret) { |
| 148 delete pFontDesc; | 162 delete pFontDesc; |
| 149 return NULL; | 163 return NULL; |
| 150 } | 164 } |
| 151 CFX_ByteString key(face_name); | 165 m_FaceMap[KeyNameFromFace(face_name, weight, bItalic)] = pFontDesc; |
| 152 key += ','; | |
| 153 key += CFX_ByteString::FormatInteger(weight); | |
| 154 key += bItalic ? 'I' : 'N'; | |
| 155 m_FaceMap.SetAt(key, pFontDesc); | |
| 156 return pFontDesc->m_SingleFace.m_pFace; | 166 return pFontDesc->m_SingleFace.m_pFace; |
| 157 } | 167 } |
| 158 const FX_CHAR* const g_Base14FontNames[14] = { | 168 const FX_CHAR* const g_Base14FontNames[14] = { |
| 159 "Courier", | 169 "Courier", |
| 160 "Courier-Bold", | 170 "Courier-Bold", |
| 161 "Courier-BoldOblique", | 171 "Courier-BoldOblique", |
| 162 "Courier-Oblique", | 172 "Courier-Oblique", |
| 163 "Helvetica", | 173 "Helvetica", |
| 164 "Helvetica-Bold", | 174 "Helvetica-Bold", |
| 165 "Helvetica-BoldOblique", | 175 "Helvetica-BoldOblique", |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 face_index = 0; | 308 face_index = 0; |
| 299 } else { | 309 } else { |
| 300 face_index = index; | 310 face_index = index; |
| 301 } | 311 } |
| 302 return face_index; | 312 return face_index; |
| 303 } | 313 } |
| 304 FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size, | 314 FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size, |
| 305 FX_DWORD checksum, | 315 FX_DWORD checksum, |
| 306 int font_offset, | 316 int font_offset, |
| 307 uint8_t*& pFontData) { | 317 uint8_t*& pFontData) { |
| 308 CFX_ByteString key; | 318 auto it = m_FaceMap.find(KeyNameFromSize(ttc_size, checksum)); |
| 309 key.Format("%d:%d", ttc_size, checksum); | 319 if (it == m_FaceMap.end()) |
| 310 CTTFontDesc* pFontDesc = NULL; | 320 return nullptr; |
| 311 m_FaceMap.Lookup(key, (void*&)pFontDesc); | 321 |
| 312 if (pFontDesc == NULL) { | 322 CTTFontDesc* pFontDesc = it->second; |
| 313 return NULL; | |
| 314 } | |
| 315 pFontData = pFontDesc->m_pFontData; | 323 pFontData = pFontDesc->m_pFontData; |
| 316 pFontDesc->m_RefCount++; | 324 pFontDesc->m_RefCount++; |
| 317 int face_index = GetTTCIndex(pFontDesc->m_pFontData, ttc_size, font_offset); | 325 int face_index = GetTTCIndex(pFontDesc->m_pFontData, ttc_size, font_offset); |
| 318 if (pFontDesc->m_TTCFace.m_pFaces[face_index] == NULL) { | 326 if (!pFontDesc->m_TTCFace.m_pFaces[face_index]) { |
| 319 pFontDesc->m_TTCFace.m_pFaces[face_index] = | 327 pFontDesc->m_TTCFace.m_pFaces[face_index] = |
| 320 GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index); | 328 GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index); |
| 321 } | 329 } |
| 322 return pFontDesc->m_TTCFace.m_pFaces[face_index]; | 330 return pFontDesc->m_TTCFace.m_pFaces[face_index]; |
| 323 } | 331 } |
| 324 FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size, | 332 FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size, |
| 325 FX_DWORD checksum, | 333 FX_DWORD checksum, |
| 326 uint8_t* pData, | 334 uint8_t* pData, |
| 327 FX_DWORD size, | 335 FX_DWORD size, |
| 328 int font_offset) { | 336 int font_offset) { |
| 329 CFX_ByteString key; | |
| 330 key.Format("%d:%d", ttc_size, checksum); | |
| 331 CTTFontDesc* pFontDesc = new CTTFontDesc; | 337 CTTFontDesc* pFontDesc = new CTTFontDesc; |
| 332 if (!pFontDesc) { | 338 if (!pFontDesc) { |
| 333 return NULL; | 339 return NULL; |
| 334 } | 340 } |
| 335 pFontDesc->m_Type = 2; | 341 pFontDesc->m_Type = 2; |
| 336 pFontDesc->m_pFontData = pData; | 342 pFontDesc->m_pFontData = pData; |
| 337 for (int i = 0; i < 16; i++) { | 343 for (int i = 0; i < 16; i++) { |
| 338 pFontDesc->m_TTCFace.m_pFaces[i] = NULL; | 344 pFontDesc->m_TTCFace.m_pFaces[i] = NULL; |
| 339 } | 345 } |
| 340 pFontDesc->m_RefCount++; | 346 pFontDesc->m_RefCount++; |
| 341 key.Format("%d:%d", ttc_size, checksum); | 347 m_FaceMap[KeyNameFromSize(ttc_size, checksum)] = pFontDesc; |
| 342 m_FaceMap.SetAt(key, pFontDesc); | |
| 343 int face_index = GetTTCIndex(pFontDesc->m_pFontData, ttc_size, font_offset); | 348 int face_index = GetTTCIndex(pFontDesc->m_pFontData, ttc_size, font_offset); |
| 344 pFontDesc->m_TTCFace.m_pFaces[face_index] = | 349 pFontDesc->m_TTCFace.m_pFaces[face_index] = |
| 345 GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index); | 350 GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index); |
| 346 return pFontDesc->m_TTCFace.m_pFaces[face_index]; | 351 return pFontDesc->m_TTCFace.m_pFaces[face_index]; |
| 347 } | 352 } |
| 348 FXFT_Face CFX_FontMgr::GetFixedFace(const uint8_t* pData, | 353 FXFT_Face CFX_FontMgr::GetFixedFace(const uint8_t* pData, |
| 349 FX_DWORD size, | 354 FX_DWORD size, |
| 350 int face_index) { | 355 int face_index) { |
| 351 FXFT_Library library; | 356 FXFT_Library library; |
| 352 if (m_FTLibrary == NULL) { | 357 if (m_FTLibrary == NULL) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 375 if (ret) { | 380 if (ret) { |
| 376 return NULL; | 381 return NULL; |
| 377 } | 382 } |
| 378 ret = FXFT_Set_Pixel_Sizes(face, 64, 64); | 383 ret = FXFT_Set_Pixel_Sizes(face, 64, 64); |
| 379 if (ret) { | 384 if (ret) { |
| 380 return NULL; | 385 return NULL; |
| 381 } | 386 } |
| 382 return face; | 387 return face; |
| 383 } | 388 } |
| 384 void CFX_FontMgr::ReleaseFace(FXFT_Face face) { | 389 void CFX_FontMgr::ReleaseFace(FXFT_Face face) { |
| 385 if (face == NULL) { | 390 if (!face) { |
| 386 return; | 391 return; |
| 387 } | 392 } |
| 388 FX_POSITION pos = m_FaceMap.GetStartPosition(); | |
| 389 FX_BOOL bNeedFaceDone = TRUE; | 393 FX_BOOL bNeedFaceDone = TRUE; |
| 390 while (pos) { | 394 auto it = m_FaceMap.begin(); |
| 391 CFX_ByteString Key; | 395 while (it != m_FaceMap.end()) { |
| 392 CTTFontDesc* ttface; | 396 auto temp = it++; |
| 393 m_FaceMap.GetNextAssoc(pos, Key, (void*&)ttface); | 397 int nRet = temp->second->ReleaseFace(face); |
| 394 int nRet = ttface->ReleaseFace(face); | |
| 395 if (nRet == 0) { | 398 if (nRet == 0) { |
| 396 m_FaceMap.RemoveKey(Key); | 399 m_FaceMap.erase(temp); |
| 397 bNeedFaceDone = FALSE; | 400 bNeedFaceDone = FALSE; |
| 398 } else if (nRet > 0) { | 401 } else if (nRet > 0) { |
| 399 bNeedFaceDone = FALSE; | 402 bNeedFaceDone = FALSE; |
| 400 } | 403 } |
| 401 } | 404 } |
| 402 if (bNeedFaceDone && !m_pBuiltinMapper->IsBuiltinFace(face)) { | 405 if (bNeedFaceDone && !m_pBuiltinMapper->IsBuiltinFace(face)) { |
| 403 FXFT_Done_Face(face); | 406 FXFT_Done_Face(face); |
| 404 } | 407 } |
| 405 } | 408 } |
| 406 extern "C" { | 409 extern "C" { |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 FXFT_Face* Face, | 1369 FXFT_Face* Face, |
| 1367 IFX_FileRead* pFile, | 1370 IFX_FileRead* pFile, |
| 1368 FXFT_Stream* stream); | 1371 FXFT_Stream* stream); |
| 1369 #if _FX_OS_ == _FX_ANDROID_ | 1372 #if _FX_OS_ == _FX_ANDROID_ |
| 1370 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() { | 1373 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() { |
| 1371 return NULL; | 1374 return NULL; |
| 1372 } | 1375 } |
| 1373 #endif | 1376 #endif |
| 1374 CFX_FolderFontInfo::CFX_FolderFontInfo() {} | 1377 CFX_FolderFontInfo::CFX_FolderFontInfo() {} |
| 1375 CFX_FolderFontInfo::~CFX_FolderFontInfo() { | 1378 CFX_FolderFontInfo::~CFX_FolderFontInfo() { |
| 1376 FX_POSITION pos = m_FontList.GetStartPosition(); | 1379 for (const auto& pair : m_FontList) { |
| 1377 while (pos) { | 1380 delete pair.second; |
| 1378 CFX_ByteString key; | |
| 1379 void* value; | |
| 1380 m_FontList.GetNextAssoc(pos, key, value); | |
| 1381 delete (CFX_FontFaceInfo*)value; | |
| 1382 } | 1381 } |
| 1383 } | 1382 } |
| 1384 void CFX_FolderFontInfo::AddPath(const CFX_ByteStringC& path) { | 1383 void CFX_FolderFontInfo::AddPath(const CFX_ByteStringC& path) { |
| 1385 m_PathList.Add(path); | 1384 m_PathList.Add(path); |
| 1386 } | 1385 } |
| 1387 void CFX_FolderFontInfo::Release() { | 1386 void CFX_FolderFontInfo::Release() { |
| 1388 delete this; | 1387 delete this; |
| 1389 } | 1388 } |
| 1390 FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) { | 1389 FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) { |
| 1391 m_pMapper = pMapper; | 1390 m_pMapper = pMapper; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1481 if (tables.IsEmpty()) { | 1480 if (tables.IsEmpty()) { |
| 1482 return; | 1481 return; |
| 1483 } | 1482 } |
| 1484 CFX_ByteString names = | 1483 CFX_ByteString names = |
| 1485 _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x6e616d65); | 1484 _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x6e616d65); |
| 1486 CFX_ByteString facename = _FPDF_GetNameFromTT(names, 1); | 1485 CFX_ByteString facename = _FPDF_GetNameFromTT(names, 1); |
| 1487 CFX_ByteString style = _FPDF_GetNameFromTT(names, 2); | 1486 CFX_ByteString style = _FPDF_GetNameFromTT(names, 2); |
| 1488 if (style != "Regular") { | 1487 if (style != "Regular") { |
| 1489 facename += " " + style; | 1488 facename += " " + style; |
| 1490 } | 1489 } |
| 1491 void* p; | 1490 if (m_FontList.find(facename) != m_FontList.end()) { |
| 1492 if (m_FontList.Lookup(facename, p)) { | |
| 1493 return; | 1491 return; |
| 1494 } | 1492 } |
| 1495 CFX_FontFaceInfo* pInfo = | 1493 CFX_FontFaceInfo* pInfo = |
| 1496 new CFX_FontFaceInfo(path, facename, tables, offset, filesize); | 1494 new CFX_FontFaceInfo(path, facename, tables, offset, filesize); |
| 1497 CFX_ByteString os2 = | 1495 CFX_ByteString os2 = |
| 1498 _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x4f532f32); | 1496 _FPDF_LoadTableFromTT(pFile, tables, nTables, 0x4f532f32); |
| 1499 if (os2.GetLength() >= 86) { | 1497 if (os2.GetLength() >= 86) { |
| 1500 const uint8_t* p = (const uint8_t*)os2 + 78; | 1498 const uint8_t* p = (const uint8_t*)os2 + 78; |
| 1501 FX_DWORD codepages = GET_TT_LONG(p); | 1499 FX_DWORD codepages = GET_TT_LONG(p); |
| 1502 if (codepages & (1 << 17)) { | 1500 if (codepages & (1 << 17)) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1526 if (style.Find(FX_BSTRC("Bold")) > -1) { | 1524 if (style.Find(FX_BSTRC("Bold")) > -1) { |
| 1527 pInfo->m_Styles |= FXFONT_BOLD; | 1525 pInfo->m_Styles |= FXFONT_BOLD; |
| 1528 } | 1526 } |
| 1529 if (style.Find(FX_BSTRC("Italic")) > -1 || | 1527 if (style.Find(FX_BSTRC("Italic")) > -1 || |
| 1530 style.Find(FX_BSTRC("Oblique")) > -1) { | 1528 style.Find(FX_BSTRC("Oblique")) > -1) { |
| 1531 pInfo->m_Styles |= FXFONT_ITALIC; | 1529 pInfo->m_Styles |= FXFONT_ITALIC; |
| 1532 } | 1530 } |
| 1533 if (facename.Find(FX_BSTRC("Serif")) > -1) { | 1531 if (facename.Find(FX_BSTRC("Serif")) > -1) { |
| 1534 pInfo->m_Styles |= FXFONT_SERIF; | 1532 pInfo->m_Styles |= FXFONT_SERIF; |
| 1535 } | 1533 } |
| 1536 m_FontList.SetAt(facename, pInfo); | 1534 m_FontList[facename] = pInfo; |
| 1537 } | 1535 } |
| 1538 void* CFX_FolderFontInfo::MapFont(int weight, | 1536 void* CFX_FolderFontInfo::MapFont(int weight, |
| 1539 FX_BOOL bItalic, | 1537 FX_BOOL bItalic, |
| 1540 int charset, | 1538 int charset, |
| 1541 int pitch_family, | 1539 int pitch_family, |
| 1542 const FX_CHAR* family, | 1540 const FX_CHAR* family, |
| 1543 int& iExact) { | 1541 int& iExact) { |
| 1544 return NULL; | 1542 return NULL; |
| 1545 } | 1543 } |
| 1546 void* CFX_FolderFontInfo::MapFontByUnicode(FX_DWORD dwUnicode, | 1544 void* CFX_FolderFontInfo::MapFontByUnicode(FX_DWORD dwUnicode, |
| 1547 int weight, | 1545 int weight, |
| 1548 FX_BOOL bItalic, | 1546 FX_BOOL bItalic, |
| 1549 int pitch_family) { | 1547 int pitch_family) { |
| 1550 return NULL; | 1548 return NULL; |
| 1551 } | 1549 } |
| 1552 void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) { | 1550 void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) { |
| 1553 void* p; | 1551 auto it = m_FontList.find(face); |
| 1554 if (!m_FontList.Lookup(face, p)) { | 1552 return it != m_FontList.end() ? it->second : nullptr; |
| 1555 return NULL; | |
| 1556 } | |
| 1557 return p; | |
| 1558 } | 1553 } |
| 1559 FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, | 1554 FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, |
| 1560 FX_DWORD table, | 1555 FX_DWORD table, |
| 1561 uint8_t* buffer, | 1556 uint8_t* buffer, |
| 1562 FX_DWORD size) { | 1557 FX_DWORD size) { |
| 1563 if (hFont == NULL) { | 1558 if (hFont == NULL) { |
| 1564 return 0; | 1559 return 0; |
| 1565 } | 1560 } |
| 1566 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont; | 1561 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont; |
| 1567 FXSYS_FILE* pFile = NULL; | 1562 FXSYS_FILE* pFile = NULL; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1603 if (hFont == NULL) { | 1598 if (hFont == NULL) { |
| 1604 return FALSE; | 1599 return FALSE; |
| 1605 } | 1600 } |
| 1606 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont; | 1601 CFX_FontFaceInfo* pFont = (CFX_FontFaceInfo*)hFont; |
| 1607 name = pFont->m_FaceName; | 1602 name = pFont->m_FaceName; |
| 1608 return TRUE; | 1603 return TRUE; |
| 1609 } | 1604 } |
| 1610 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) { | 1605 FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) { |
| 1611 return FALSE; | 1606 return FALSE; |
| 1612 } | 1607 } |
| OLD | NEW |