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

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

Issue 1832173003: Remove FX_DWORD from core/ and delete definition (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 9 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/fxge/ge/fx_ge_font.cpp ('k') | core/fxge/ge/fx_ge_ps.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 <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <vector> 9 #include <vector>
10 10
11 #include "core/fxge/fontdata/chromefontdata/chromefontdata.h" 11 #include "core/fxge/fontdata/chromefontdata/chromefontdata.h"
12 #include "core/fxge/ge/fx_text_int.h" 12 #include "core/fxge/ge/fx_text_int.h"
13 #include "core/include/fxge/fx_freetype.h" 13 #include "core/include/fxge/fx_freetype.h"
14 #include "core/include/fxge/fx_ge.h" 14 #include "core/include/fxge/fx_ge.h"
15 #include "third_party/base/stl_util.h" 15 #include "third_party/base/stl_util.h"
16 16
17 #define GET_TT_SHORT(w) (uint16_t)(((w)[0] << 8) | (w)[1]) 17 #define GET_TT_SHORT(w) (uint16_t)(((w)[0] << 8) | (w)[1])
18 #define GET_TT_LONG(w) \ 18 #define GET_TT_LONG(w) \
19 (FX_DWORD)(((w)[0] << 24) | ((w)[1] << 16) | ((w)[2] << 8) | (w)[3]) 19 (uint32_t)(((w)[0] << 24) | ((w)[1] << 16) | ((w)[2] << 8) | (w)[3])
20 20
21 #define FX_FONT_STYLE_None 0x00 21 #define FX_FONT_STYLE_None 0x00
22 #define FX_FONT_STYLE_Bold 0x01 22 #define FX_FONT_STYLE_Bold 0x01
23 #define FX_FONT_STYLE_Italic 0x02 23 #define FX_FONT_STYLE_Italic 0x02
24 #define FX_FONT_STYLE_BoldBold 0x04 24 #define FX_FONT_STYLE_BoldBold 0x04
25 25
26 namespace { 26 namespace {
27 27
28 struct BuiltinFont { 28 struct BuiltinFont {
29 const uint8_t* m_pFontData; 29 const uint8_t* m_pFontData;
30 FX_DWORD m_dwSize; 30 uint32_t m_dwSize;
31 }; 31 };
32 32
33 const BuiltinFont g_FoxitFonts[14] = { 33 const BuiltinFont g_FoxitFonts[14] = {
34 {g_FoxitFixedFontData, 17597}, 34 {g_FoxitFixedFontData, 17597},
35 {g_FoxitFixedBoldFontData, 18055}, 35 {g_FoxitFixedBoldFontData, 18055},
36 {g_FoxitFixedBoldItalicFontData, 19151}, 36 {g_FoxitFixedBoldItalicFontData, 19151},
37 {g_FoxitFixedItalicFontData, 18746}, 37 {g_FoxitFixedItalicFontData, 18746},
38 {g_FoxitSansFontData, 15025}, 38 {g_FoxitSansFontData, 15025},
39 {g_FoxitSansBoldFontData, 16344}, 39 {g_FoxitSansBoldFontData, 16344},
40 {g_FoxitSansBoldItalicFontData, 16418}, 40 {g_FoxitSansBoldItalicFontData, 16418},
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } g_Codepage2CharsetTable[] = { 204 } g_Codepage2CharsetTable[] = {
205 {0, 1}, {42, 2}, {437, 254}, {850, 255}, {874, 222}, 205 {0, 1}, {42, 2}, {437, 254}, {850, 255}, {874, 222},
206 {932, 128}, {936, 134}, {949, 129}, {950, 136}, {1250, 238}, 206 {932, 128}, {936, 134}, {949, 129}, {950, 136}, {1250, 238},
207 {1251, 204}, {1252, 0}, {1253, 161}, {1254, 162}, {1255, 177}, 207 {1251, 204}, {1252, 0}, {1253, 161}, {1254, 162}, {1255, 177},
208 {1256, 178}, {1257, 186}, {1258, 163}, {1361, 130}, {10000, 77}, 208 {1256, 178}, {1257, 186}, {1258, 163}, {1361, 130}, {10000, 77},
209 {10001, 78}, {10002, 81}, {10003, 79}, {10004, 84}, {10005, 83}, 209 {10001, 78}, {10002, 81}, {10003, 79}, {10004, 84}, {10005, 83},
210 {10006, 85}, {10007, 89}, {10008, 80}, {10021, 87}, {10029, 88}, 210 {10006, 85}, {10007, 89}, {10008, 80}, {10021, 87}, {10029, 88},
211 {10081, 86}, 211 {10081, 86},
212 }; 212 };
213 213
214 const FX_DWORD kTableNAME = FXDWORD_GET_MSBFIRST("name"); 214 const uint32_t kTableNAME = FXDWORD_GET_MSBFIRST("name");
215 const FX_DWORD kTableTTCF = FXDWORD_GET_MSBFIRST("ttcf"); 215 const uint32_t kTableTTCF = FXDWORD_GET_MSBFIRST("ttcf");
216 216
217 int CompareFontFamilyString(const void* key, const void* element) { 217 int CompareFontFamilyString(const void* key, const void* element) {
218 CFX_ByteString str_key((const FX_CHAR*)key); 218 CFX_ByteString str_key((const FX_CHAR*)key);
219 if (str_key.Find(((AltFontFamily*)element)->m_pFontName) != -1) { 219 if (str_key.Find(((AltFontFamily*)element)->m_pFontName) != -1) {
220 return 0; 220 return 0;
221 } 221 }
222 return FXSYS_stricmp((const FX_CHAR*)key, 222 return FXSYS_stricmp((const FX_CHAR*)key,
223 ((AltFontFamily*)element)->m_pFontName); 223 ((AltFontFamily*)element)->m_pFontName);
224 } 224 }
225 225
226 int CompareString(const void* key, const void* element) { 226 int CompareString(const void* key, const void* element) {
227 return FXSYS_stricmp((const FX_CHAR*)key, ((AltFontName*)element)->m_pName); 227 return FXSYS_stricmp((const FX_CHAR*)key, ((AltFontName*)element)->m_pName);
228 } 228 }
229 229
230 CFX_ByteString KeyNameFromFace(const CFX_ByteString& face_name, 230 CFX_ByteString KeyNameFromFace(const CFX_ByteString& face_name,
231 int weight, 231 int weight,
232 FX_BOOL bItalic) { 232 FX_BOOL bItalic) {
233 CFX_ByteString key(face_name); 233 CFX_ByteString key(face_name);
234 key += ','; 234 key += ',';
235 key += CFX_ByteString::FormatInteger(weight); 235 key += CFX_ByteString::FormatInteger(weight);
236 key += bItalic ? 'I' : 'N'; 236 key += bItalic ? 'I' : 'N';
237 return key; 237 return key;
238 } 238 }
239 239
240 CFX_ByteString KeyNameFromSize(int ttc_size, FX_DWORD checksum) { 240 CFX_ByteString KeyNameFromSize(int ttc_size, uint32_t checksum) {
241 CFX_ByteString key; 241 CFX_ByteString key;
242 key.Format("%d:%d", ttc_size, checksum); 242 key.Format("%d:%d", ttc_size, checksum);
243 return key; 243 return key;
244 } 244 }
245 245
246 CFX_ByteString TT_NormalizeName(const FX_CHAR* family) { 246 CFX_ByteString TT_NormalizeName(const FX_CHAR* family) {
247 CFX_ByteString norm(family); 247 CFX_ByteString norm(family);
248 norm.Remove(' '); 248 norm.Remove(' ');
249 norm.Remove('-'); 249 norm.Remove('-');
250 norm.Remove(','); 250 norm.Remove(',');
251 int pos = norm.Find('+'); 251 int pos = norm.Find('+');
252 if (pos > 0) { 252 if (pos > 0) {
253 norm = norm.Left(pos); 253 norm = norm.Left(pos);
254 } 254 }
255 norm.MakeLower(); 255 norm.MakeLower();
256 return norm; 256 return norm;
257 } 257 }
258 258
259 CFX_ByteString FPDF_ReadStringFromFile(FXSYS_FILE* pFile, FX_DWORD size) { 259 CFX_ByteString FPDF_ReadStringFromFile(FXSYS_FILE* pFile, uint32_t size) {
260 CFX_ByteString buffer; 260 CFX_ByteString buffer;
261 if (!FXSYS_fread(buffer.GetBuffer(size), size, 1, pFile)) { 261 if (!FXSYS_fread(buffer.GetBuffer(size), size, 1, pFile)) {
262 return CFX_ByteString(); 262 return CFX_ByteString();
263 } 263 }
264 buffer.ReleaseBuffer(size); 264 buffer.ReleaseBuffer(size);
265 return buffer; 265 return buffer;
266 } 266 }
267 267
268 CFX_ByteString FPDF_LoadTableFromTT(FXSYS_FILE* pFile, 268 CFX_ByteString FPDF_LoadTableFromTT(FXSYS_FILE* pFile,
269 const uint8_t* pTables, 269 const uint8_t* pTables,
270 FX_DWORD nTables, 270 uint32_t nTables,
271 FX_DWORD tag) { 271 uint32_t tag) {
272 for (FX_DWORD i = 0; i < nTables; i++) { 272 for (uint32_t i = 0; i < nTables; i++) {
273 const uint8_t* p = pTables + i * 16; 273 const uint8_t* p = pTables + i * 16;
274 if (GET_TT_LONG(p) == tag) { 274 if (GET_TT_LONG(p) == tag) {
275 FX_DWORD offset = GET_TT_LONG(p + 8); 275 uint32_t offset = GET_TT_LONG(p + 8);
276 FX_DWORD size = GET_TT_LONG(p + 12); 276 uint32_t size = GET_TT_LONG(p + 12);
277 FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET); 277 FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET);
278 return FPDF_ReadStringFromFile(pFile, size); 278 return FPDF_ReadStringFromFile(pFile, size);
279 } 279 }
280 } 280 }
281 return CFX_ByteString(); 281 return CFX_ByteString();
282 } 282 }
283 283
284 uint8_t GetCharsetFromCodePage(uint16_t codepage) { 284 uint8_t GetCharsetFromCodePage(uint16_t codepage) {
285 const CODEPAGE_MAP* pEnd = 285 const CODEPAGE_MAP* pEnd =
286 g_Codepage2CharsetTable + FX_ArraySize(g_Codepage2CharsetTable); 286 g_Codepage2CharsetTable + FX_ArraySize(g_Codepage2CharsetTable);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 } 355 }
356 356
357 FX_BOOL CheckSupportThirdPartFont(CFX_ByteString name, int& PitchFamily) { 357 FX_BOOL CheckSupportThirdPartFont(CFX_ByteString name, int& PitchFamily) {
358 if (name == "MyriadPro") { 358 if (name == "MyriadPro") {
359 PitchFamily &= ~FXFONT_FF_ROMAN; 359 PitchFamily &= ~FXFONT_FF_ROMAN;
360 return TRUE; 360 return TRUE;
361 } 361 }
362 return FALSE; 362 return FALSE;
363 } 363 }
364 364
365 FX_DWORD GetCharset(int charset) { 365 uint32_t GetCharset(int charset) {
366 switch (charset) { 366 switch (charset) {
367 case FXFONT_SHIFTJIS_CHARSET: 367 case FXFONT_SHIFTJIS_CHARSET:
368 return CHARSET_FLAG_SHIFTJIS; 368 return CHARSET_FLAG_SHIFTJIS;
369 case FXFONT_GB2312_CHARSET: 369 case FXFONT_GB2312_CHARSET:
370 return CHARSET_FLAG_GB; 370 return CHARSET_FLAG_GB;
371 case FXFONT_CHINESEBIG5_CHARSET: 371 case FXFONT_CHINESEBIG5_CHARSET:
372 return CHARSET_FLAG_BIG5; 372 return CHARSET_FLAG_BIG5;
373 case FXFONT_HANGEUL_CHARSET: 373 case FXFONT_HANGEUL_CHARSET:
374 return CHARSET_FLAG_KOREAN; 374 return CHARSET_FLAG_KOREAN;
375 case FXFONT_SYMBOL_CHARSET: 375 case FXFONT_SYMBOL_CHARSET:
376 return CHARSET_FLAG_SYMBOL; 376 return CHARSET_FLAG_SYMBOL;
377 case FXFONT_ANSI_CHARSET: 377 case FXFONT_ANSI_CHARSET:
378 return CHARSET_FLAG_ANSI; 378 return CHARSET_FLAG_ANSI;
379 default: 379 default:
380 break; 380 break;
381 } 381 }
382 return 0; 382 return 0;
383 } 383 }
384 384
385 int32_t GetSimilarValue(int weight, 385 int32_t GetSimilarValue(int weight,
386 FX_BOOL bItalic, 386 FX_BOOL bItalic,
387 int pitch_family, 387 int pitch_family,
388 FX_DWORD style) { 388 uint32_t style) {
389 int32_t iSimilarValue = 0; 389 int32_t iSimilarValue = 0;
390 if (!!(style & FXFONT_BOLD) == (weight > 400)) { 390 if (!!(style & FXFONT_BOLD) == (weight > 400)) {
391 iSimilarValue += 16; 391 iSimilarValue += 16;
392 } 392 }
393 if (!!(style & FXFONT_ITALIC) == bItalic) { 393 if (!!(style & FXFONT_ITALIC) == bItalic) {
394 iSimilarValue += 16; 394 iSimilarValue += 16;
395 } 395 }
396 if (!!(style & FXFONT_SERIF) == !!(pitch_family & FXFONT_FF_ROMAN)) { 396 if (!!(style & FXFONT_SERIF) == !!(pitch_family & FXFONT_FF_ROMAN)) {
397 iSimilarValue += 16; 397 iSimilarValue += 16;
398 } 398 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 return; 473 return;
474 FXFT_Init_FreeType(&m_FTLibrary); 474 FXFT_Init_FreeType(&m_FTLibrary);
475 } 475 }
476 476
477 void CFX_FontMgr::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) { 477 void CFX_FontMgr::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) {
478 m_pBuiltinMapper->SetSystemFontInfo(pFontInfo); 478 m_pBuiltinMapper->SetSystemFontInfo(pFontInfo);
479 } 479 }
480 480
481 FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name, 481 FXFT_Face CFX_FontMgr::FindSubstFont(const CFX_ByteString& face_name,
482 FX_BOOL bTrueType, 482 FX_BOOL bTrueType,
483 FX_DWORD flags, 483 uint32_t flags,
484 int weight, 484 int weight,
485 int italic_angle, 485 int italic_angle,
486 int CharsetCP, 486 int CharsetCP,
487 CFX_SubstFont* pSubstFont) { 487 CFX_SubstFont* pSubstFont) {
488 InitFTLibrary(); 488 InitFTLibrary();
489 return m_pBuiltinMapper->FindSubstFont(face_name, bTrueType, flags, weight, 489 return m_pBuiltinMapper->FindSubstFont(face_name, bTrueType, flags, weight,
490 italic_angle, CharsetCP, pSubstFont); 490 italic_angle, CharsetCP, pSubstFont);
491 } 491 }
492 492
493 FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name, 493 FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name,
494 int weight, 494 int weight,
495 FX_BOOL bItalic, 495 FX_BOOL bItalic,
496 uint8_t*& pFontData) { 496 uint8_t*& pFontData) {
497 auto it = m_FaceMap.find(KeyNameFromFace(face_name, weight, bItalic)); 497 auto it = m_FaceMap.find(KeyNameFromFace(face_name, weight, bItalic));
498 if (it == m_FaceMap.end()) 498 if (it == m_FaceMap.end())
499 return nullptr; 499 return nullptr;
500 500
501 CTTFontDesc* pFontDesc = it->second; 501 CTTFontDesc* pFontDesc = it->second;
502 pFontData = pFontDesc->m_pFontData; 502 pFontData = pFontDesc->m_pFontData;
503 pFontDesc->m_RefCount++; 503 pFontDesc->m_RefCount++;
504 return pFontDesc->m_SingleFace.m_pFace; 504 return pFontDesc->m_SingleFace.m_pFace;
505 } 505 }
506 FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name, 506 FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name,
507 int weight, 507 int weight,
508 FX_BOOL bItalic, 508 FX_BOOL bItalic,
509 uint8_t* pData, 509 uint8_t* pData,
510 FX_DWORD size, 510 uint32_t size,
511 int face_index) { 511 int face_index) {
512 CTTFontDesc* pFontDesc = new CTTFontDesc; 512 CTTFontDesc* pFontDesc = new CTTFontDesc;
513 pFontDesc->m_Type = 1; 513 pFontDesc->m_Type = 1;
514 pFontDesc->m_SingleFace.m_pFace = NULL; 514 pFontDesc->m_SingleFace.m_pFace = NULL;
515 pFontDesc->m_SingleFace.m_bBold = weight; 515 pFontDesc->m_SingleFace.m_bBold = weight;
516 pFontDesc->m_SingleFace.m_bItalic = bItalic; 516 pFontDesc->m_SingleFace.m_bItalic = bItalic;
517 pFontDesc->m_pFontData = pData; 517 pFontDesc->m_pFontData = pData;
518 pFontDesc->m_RefCount = 1; 518 pFontDesc->m_RefCount = 1;
519 519
520 InitFTLibrary(); 520 InitFTLibrary();
521 FXFT_Library library = m_FTLibrary; 521 FXFT_Library library = m_FTLibrary;
522 int ret = FXFT_New_Memory_Face(library, pData, size, face_index, 522 int ret = FXFT_New_Memory_Face(library, pData, size, face_index,
523 &pFontDesc->m_SingleFace.m_pFace); 523 &pFontDesc->m_SingleFace.m_pFace);
524 if (ret) { 524 if (ret) {
525 delete pFontDesc; 525 delete pFontDesc;
526 return NULL; 526 return NULL;
527 } 527 }
528 ret = FXFT_Set_Pixel_Sizes(pFontDesc->m_SingleFace.m_pFace, 64, 64); 528 ret = FXFT_Set_Pixel_Sizes(pFontDesc->m_SingleFace.m_pFace, 64, 64);
529 if (ret) { 529 if (ret) {
530 delete pFontDesc; 530 delete pFontDesc;
531 return NULL; 531 return NULL;
532 } 532 }
533 m_FaceMap[KeyNameFromFace(face_name, weight, bItalic)] = pFontDesc; 533 m_FaceMap[KeyNameFromFace(face_name, weight, bItalic)] = pFontDesc;
534 return pFontDesc->m_SingleFace.m_pFace; 534 return pFontDesc->m_SingleFace.m_pFace;
535 } 535 }
536 536
537 int GetTTCIndex(const uint8_t* pFontData, 537 int GetTTCIndex(const uint8_t* pFontData,
538 FX_DWORD ttc_size, 538 uint32_t ttc_size,
539 FX_DWORD font_offset) { 539 uint32_t font_offset) {
540 int face_index = 0; 540 int face_index = 0;
541 const uint8_t* p = pFontData + 8; 541 const uint8_t* p = pFontData + 8;
542 FX_DWORD nfont = GET_TT_LONG(p); 542 uint32_t nfont = GET_TT_LONG(p);
543 FX_DWORD index; 543 uint32_t index;
544 for (index = 0; index < nfont; index++) { 544 for (index = 0; index < nfont; index++) {
545 p = pFontData + 12 + index * 4; 545 p = pFontData + 12 + index * 4;
546 if (GET_TT_LONG(p) == font_offset) { 546 if (GET_TT_LONG(p) == font_offset) {
547 break; 547 break;
548 } 548 }
549 } 549 }
550 if (index >= nfont) { 550 if (index >= nfont) {
551 face_index = 0; 551 face_index = 0;
552 } else { 552 } else {
553 face_index = index; 553 face_index = index;
554 } 554 }
555 return face_index; 555 return face_index;
556 } 556 }
557 FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size, 557 FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size,
558 FX_DWORD checksum, 558 uint32_t checksum,
559 int font_offset, 559 int font_offset,
560 uint8_t*& pFontData) { 560 uint8_t*& pFontData) {
561 auto it = m_FaceMap.find(KeyNameFromSize(ttc_size, checksum)); 561 auto it = m_FaceMap.find(KeyNameFromSize(ttc_size, checksum));
562 if (it == m_FaceMap.end()) 562 if (it == m_FaceMap.end())
563 return nullptr; 563 return nullptr;
564 564
565 CTTFontDesc* pFontDesc = it->second; 565 CTTFontDesc* pFontDesc = it->second;
566 pFontData = pFontDesc->m_pFontData; 566 pFontData = pFontDesc->m_pFontData;
567 pFontDesc->m_RefCount++; 567 pFontDesc->m_RefCount++;
568 int face_index = GetTTCIndex(pFontDesc->m_pFontData, ttc_size, font_offset); 568 int face_index = GetTTCIndex(pFontDesc->m_pFontData, ttc_size, font_offset);
569 if (!pFontDesc->m_TTCFace.m_pFaces[face_index]) { 569 if (!pFontDesc->m_TTCFace.m_pFaces[face_index]) {
570 pFontDesc->m_TTCFace.m_pFaces[face_index] = 570 pFontDesc->m_TTCFace.m_pFaces[face_index] =
571 GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index); 571 GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index);
572 } 572 }
573 return pFontDesc->m_TTCFace.m_pFaces[face_index]; 573 return pFontDesc->m_TTCFace.m_pFaces[face_index];
574 } 574 }
575 FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size, 575 FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size,
576 FX_DWORD checksum, 576 uint32_t checksum,
577 uint8_t* pData, 577 uint8_t* pData,
578 FX_DWORD size, 578 uint32_t size,
579 int font_offset) { 579 int font_offset) {
580 CTTFontDesc* pFontDesc = new CTTFontDesc; 580 CTTFontDesc* pFontDesc = new CTTFontDesc;
581 pFontDesc->m_Type = 2; 581 pFontDesc->m_Type = 2;
582 pFontDesc->m_pFontData = pData; 582 pFontDesc->m_pFontData = pData;
583 for (int i = 0; i < 16; i++) { 583 for (int i = 0; i < 16; i++) {
584 pFontDesc->m_TTCFace.m_pFaces[i] = NULL; 584 pFontDesc->m_TTCFace.m_pFaces[i] = NULL;
585 } 585 }
586 pFontDesc->m_RefCount++; 586 pFontDesc->m_RefCount++;
587 m_FaceMap[KeyNameFromSize(ttc_size, checksum)] = pFontDesc; 587 m_FaceMap[KeyNameFromSize(ttc_size, checksum)] = pFontDesc;
588 int face_index = GetTTCIndex(pFontDesc->m_pFontData, ttc_size, font_offset); 588 int face_index = GetTTCIndex(pFontDesc->m_pFontData, ttc_size, font_offset);
589 pFontDesc->m_TTCFace.m_pFaces[face_index] = 589 pFontDesc->m_TTCFace.m_pFaces[face_index] =
590 GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index); 590 GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index);
591 return pFontDesc->m_TTCFace.m_pFaces[face_index]; 591 return pFontDesc->m_TTCFace.m_pFaces[face_index];
592 } 592 }
593 593
594 FXFT_Face CFX_FontMgr::GetFixedFace(const uint8_t* pData, 594 FXFT_Face CFX_FontMgr::GetFixedFace(const uint8_t* pData,
595 FX_DWORD size, 595 uint32_t size,
596 int face_index) { 596 int face_index) {
597 InitFTLibrary(); 597 InitFTLibrary();
598 FXFT_Library library = m_FTLibrary; 598 FXFT_Library library = m_FTLibrary;
599 FXFT_Face face = nullptr; 599 FXFT_Face face = nullptr;
600 if (FXFT_New_Memory_Face(library, pData, size, face_index, &face)) 600 if (FXFT_New_Memory_Face(library, pData, size, face_index, &face))
601 return nullptr; 601 return nullptr;
602 return FXFT_Set_Pixel_Sizes(face, 64, 64) ? nullptr : face; 602 return FXFT_Set_Pixel_Sizes(face, 64, 64) ? nullptr : face;
603 } 603 }
604 604
605 FXFT_Face CFX_FontMgr::GetFileFace(const FX_CHAR* filename, int face_index) { 605 FXFT_Face CFX_FontMgr::GetFileFace(const FX_CHAR* filename, int face_index) {
(...skipping 20 matching lines...) Expand all
626 if (nRet == 0) 626 if (nRet == 0)
627 m_FaceMap.erase(temp); 627 m_FaceMap.erase(temp);
628 break; 628 break;
629 } 629 }
630 if (bNeedFaceDone && !m_pBuiltinMapper->IsBuiltinFace(face)) 630 if (bNeedFaceDone && !m_pBuiltinMapper->IsBuiltinFace(face))
631 FXFT_Done_Face(face); 631 FXFT_Done_Face(face);
632 } 632 }
633 633
634 bool CFX_FontMgr::GetBuiltinFont(size_t index, 634 bool CFX_FontMgr::GetBuiltinFont(size_t index,
635 const uint8_t** pFontData, 635 const uint8_t** pFontData,
636 FX_DWORD* size) { 636 uint32_t* size) {
637 if (index < FX_ArraySize(g_FoxitFonts)) { 637 if (index < FX_ArraySize(g_FoxitFonts)) {
638 *pFontData = g_FoxitFonts[index].m_pFontData; 638 *pFontData = g_FoxitFonts[index].m_pFontData;
639 *size = g_FoxitFonts[index].m_dwSize; 639 *size = g_FoxitFonts[index].m_dwSize;
640 return true; 640 return true;
641 } 641 }
642 index -= FX_ArraySize(g_FoxitFonts); 642 index -= FX_ArraySize(g_FoxitFonts);
643 if (index < FX_ArraySize(g_MMFonts)) { 643 if (index < FX_ArraySize(g_MMFonts)) {
644 *pFontData = g_MMFonts[index].m_pFontData; 644 *pFontData = g_MMFonts[index].m_pFontData;
645 *size = g_MMFonts[index].m_dwSize; 645 *size = g_MMFonts[index].m_dwSize;
646 return true; 646 return true;
(...skipping 28 matching lines...) Expand all
675 void CFX_FontMapper::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) { 675 void CFX_FontMapper::SetSystemFontInfo(IFX_SystemFontInfo* pFontInfo) {
676 if (!pFontInfo) { 676 if (!pFontInfo) {
677 return; 677 return;
678 } 678 }
679 if (m_pFontInfo) { 679 if (m_pFontInfo) {
680 m_pFontInfo->Release(); 680 m_pFontInfo->Release();
681 } 681 }
682 m_pFontInfo = pFontInfo; 682 m_pFontInfo = pFontInfo;
683 } 683 }
684 static CFX_ByteString GetStringFromTable(const uint8_t* string_ptr, 684 static CFX_ByteString GetStringFromTable(const uint8_t* string_ptr,
685 FX_DWORD string_ptr_length, 685 uint32_t string_ptr_length,
686 uint16_t offset, 686 uint16_t offset,
687 uint16_t length) { 687 uint16_t length) {
688 if (string_ptr_length < offset + length) { 688 if (string_ptr_length < offset + length) {
689 return CFX_ByteString(); 689 return CFX_ByteString();
690 } 690 }
691 return CFX_ByteStringC(string_ptr + offset, length); 691 return CFX_ByteStringC(string_ptr + offset, length);
692 } 692 }
693 CFX_ByteString GetNameFromTT(const uint8_t* name_table, 693 CFX_ByteString GetNameFromTT(const uint8_t* name_table,
694 FX_DWORD name_table_size, 694 uint32_t name_table_size,
695 FX_DWORD name_id) { 695 uint32_t name_id) {
696 if (!name_table || name_table_size < 6) { 696 if (!name_table || name_table_size < 6) {
697 return CFX_ByteString(); 697 return CFX_ByteString();
698 } 698 }
699 FX_DWORD name_count = GET_TT_SHORT(name_table + 2); 699 uint32_t name_count = GET_TT_SHORT(name_table + 2);
700 FX_DWORD string_offset = GET_TT_SHORT(name_table + 4); 700 uint32_t string_offset = GET_TT_SHORT(name_table + 4);
701 // We will ignore the possibility of overlap of structures and 701 // We will ignore the possibility of overlap of structures and
702 // string table as if it's all corrupt there's not a lot we can do. 702 // string table as if it's all corrupt there's not a lot we can do.
703 if (name_table_size < string_offset) { 703 if (name_table_size < string_offset) {
704 return CFX_ByteString(); 704 return CFX_ByteString();
705 } 705 }
706 706
707 const uint8_t* string_ptr = name_table + string_offset; 707 const uint8_t* string_ptr = name_table + string_offset;
708 FX_DWORD string_ptr_size = name_table_size - string_offset; 708 uint32_t string_ptr_size = name_table_size - string_offset;
709 name_table += 6; 709 name_table += 6;
710 name_table_size -= 6; 710 name_table_size -= 6;
711 if (name_table_size < name_count * 12) { 711 if (name_table_size < name_count * 12) {
712 return CFX_ByteString(); 712 return CFX_ByteString();
713 } 713 }
714 714
715 for (FX_DWORD i = 0; i < name_count; i++, name_table += 12) { 715 for (uint32_t i = 0; i < name_count; i++, name_table += 12) {
716 if (GET_TT_SHORT(name_table + 6) == name_id && 716 if (GET_TT_SHORT(name_table + 6) == name_id &&
717 GET_TT_SHORT(name_table) == 1 && GET_TT_SHORT(name_table + 2) == 0) { 717 GET_TT_SHORT(name_table) == 1 && GET_TT_SHORT(name_table + 2) == 0) {
718 return GetStringFromTable(string_ptr, string_ptr_size, 718 return GetStringFromTable(string_ptr, string_ptr_size,
719 GET_TT_SHORT(name_table + 10), 719 GET_TT_SHORT(name_table + 10),
720 GET_TT_SHORT(name_table + 8)); 720 GET_TT_SHORT(name_table + 8));
721 } 721 }
722 } 722 }
723 return CFX_ByteString(); 723 return CFX_ByteString();
724 } 724 }
725 725
726 CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) { 726 CFX_ByteString CFX_FontMapper::GetPSNameFromTT(void* hFont) {
727 if (!m_pFontInfo) 727 if (!m_pFontInfo)
728 return CFX_ByteString(); 728 return CFX_ByteString();
729 729
730 FX_DWORD size = m_pFontInfo->GetFontData(hFont, kTableNAME, nullptr, 0); 730 uint32_t size = m_pFontInfo->GetFontData(hFont, kTableNAME, nullptr, 0);
731 if (!size) 731 if (!size)
732 return CFX_ByteString(); 732 return CFX_ByteString();
733 733
734 std::vector<uint8_t> buffer(size); 734 std::vector<uint8_t> buffer(size);
735 uint8_t* buffer_ptr = buffer.data(); 735 uint8_t* buffer_ptr = buffer.data();
736 FX_DWORD bytes_read = 736 uint32_t bytes_read =
737 m_pFontInfo->GetFontData(hFont, kTableNAME, buffer_ptr, size); 737 m_pFontInfo->GetFontData(hFont, kTableNAME, buffer_ptr, size);
738 return bytes_read == size ? GetNameFromTT(buffer_ptr, bytes_read, 6) 738 return bytes_read == size ? GetNameFromTT(buffer_ptr, bytes_read, 6)
739 : CFX_ByteString(); 739 : CFX_ByteString();
740 } 740 }
741 741
742 void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) { 742 void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) {
743 if (!m_pFontInfo) { 743 if (!m_pFontInfo) {
744 return; 744 return;
745 } 745 }
746 if (m_CharsetArray.Find((FX_DWORD)charset) == -1) { 746 if (m_CharsetArray.Find((uint32_t)charset) == -1) {
747 m_CharsetArray.Add((FX_DWORD)charset); 747 m_CharsetArray.Add((uint32_t)charset);
748 m_FaceArray.push_back(name); 748 m_FaceArray.push_back(name);
749 } 749 }
750 if (name == m_LastFamily) { 750 if (name == m_LastFamily) {
751 return; 751 return;
752 } 752 }
753 const uint8_t* ptr = name; 753 const uint8_t* ptr = name;
754 FX_BOOL bLocalized = FALSE; 754 FX_BOOL bLocalized = FALSE;
755 for (int i = 0; i < name.GetLength(); i++) 755 for (int i = 0; i < name.GetLength(); i++)
756 if (ptr[i] > 0x80) { 756 if (ptr[i] > 0x80) {
757 bLocalized = TRUE; 757 bLocalized = TRUE;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont, 813 FXFT_Face CFX_FontMapper::UseInternalSubst(CFX_SubstFont* pSubstFont,
814 int iBaseFont, 814 int iBaseFont,
815 int italic_angle, 815 int italic_angle,
816 int weight, 816 int weight,
817 int picthfamily) { 817 int picthfamily) {
818 if (iBaseFont < 12) { 818 if (iBaseFont < 12) {
819 if (m_FoxitFaces[iBaseFont]) { 819 if (m_FoxitFaces[iBaseFont]) {
820 return m_FoxitFaces[iBaseFont]; 820 return m_FoxitFaces[iBaseFont];
821 } 821 }
822 const uint8_t* pFontData = NULL; 822 const uint8_t* pFontData = NULL;
823 FX_DWORD size = 0; 823 uint32_t size = 0;
824 if (m_pFontMgr->GetBuiltinFont(iBaseFont, &pFontData, &size)) { 824 if (m_pFontMgr->GetBuiltinFont(iBaseFont, &pFontData, &size)) {
825 m_FoxitFaces[iBaseFont] = m_pFontMgr->GetFixedFace(pFontData, size, 0); 825 m_FoxitFaces[iBaseFont] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
826 return m_FoxitFaces[iBaseFont]; 826 return m_FoxitFaces[iBaseFont];
827 } 827 }
828 } 828 }
829 pSubstFont->m_SubstFlags |= FXFONT_SUBST_MM; 829 pSubstFont->m_SubstFlags |= FXFONT_SUBST_MM;
830 pSubstFont->m_ItalicAngle = italic_angle; 830 pSubstFont->m_ItalicAngle = italic_angle;
831 if (weight) { 831 if (weight) {
832 pSubstFont->m_Weight = weight; 832 pSubstFont->m_Weight = weight;
833 } 833 }
834 if (picthfamily & FXFONT_FF_ROMAN) { 834 if (picthfamily & FXFONT_FF_ROMAN) {
835 pSubstFont->m_Weight = pSubstFont->m_Weight * 4 / 5; 835 pSubstFont->m_Weight = pSubstFont->m_Weight * 4 / 5;
836 pSubstFont->m_Family = "Chrome Serif"; 836 pSubstFont->m_Family = "Chrome Serif";
837 if (m_MMFaces[1]) { 837 if (m_MMFaces[1]) {
838 return m_MMFaces[1]; 838 return m_MMFaces[1];
839 } 839 }
840 const uint8_t* pFontData = NULL; 840 const uint8_t* pFontData = NULL;
841 FX_DWORD size = 0; 841 uint32_t size = 0;
842 m_pFontMgr->GetBuiltinFont(14, &pFontData, &size); 842 m_pFontMgr->GetBuiltinFont(14, &pFontData, &size);
843 m_MMFaces[1] = m_pFontMgr->GetFixedFace(pFontData, size, 0); 843 m_MMFaces[1] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
844 return m_MMFaces[1]; 844 return m_MMFaces[1];
845 } 845 }
846 pSubstFont->m_Family = "Chrome Sans"; 846 pSubstFont->m_Family = "Chrome Sans";
847 if (m_MMFaces[0]) { 847 if (m_MMFaces[0]) {
848 return m_MMFaces[0]; 848 return m_MMFaces[0];
849 } 849 }
850 const uint8_t* pFontData = NULL; 850 const uint8_t* pFontData = NULL;
851 FX_DWORD size = 0; 851 uint32_t size = 0;
852 m_pFontMgr->GetBuiltinFont(15, &pFontData, &size); 852 m_pFontMgr->GetBuiltinFont(15, &pFontData, &size);
853 m_MMFaces[0] = m_pFontMgr->GetFixedFace(pFontData, size, 0); 853 m_MMFaces[0] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
854 return m_MMFaces[0]; 854 return m_MMFaces[0];
855 } 855 }
856 856
857 FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, 857 FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
858 FX_BOOL bTrueType, 858 FX_BOOL bTrueType,
859 FX_DWORD flags, 859 uint32_t flags,
860 int weight, 860 int weight,
861 int italic_angle, 861 int italic_angle,
862 int WindowCP, 862 int WindowCP,
863 CFX_SubstFont* pSubstFont) { 863 CFX_SubstFont* pSubstFont) {
864 if (!(flags & FXFONT_USEEXTERNATTR)) { 864 if (!(flags & FXFONT_USEEXTERNATTR)) {
865 weight = FXFONT_FW_NORMAL; 865 weight = FXFONT_FW_NORMAL;
866 italic_angle = 0; 866 italic_angle = 0;
867 } 867 }
868 CFX_ByteString SubstName = name; 868 CFX_ByteString SubstName = name;
869 SubstName.Remove(0x20); 869 SubstName.Remove(0x20);
870 if (bTrueType) { 870 if (bTrueType) {
871 if (name[0] == '@') { 871 if (name[0] == '@') {
872 SubstName = name.Mid(1); 872 SubstName = name.Mid(1);
873 } 873 }
874 } 874 }
875 PDF_GetStandardFontName(&SubstName); 875 PDF_GetStandardFontName(&SubstName);
876 if (SubstName == "Symbol" && !bTrueType) { 876 if (SubstName == "Symbol" && !bTrueType) {
877 pSubstFont->m_Family = "Chrome Symbol"; 877 pSubstFont->m_Family = "Chrome Symbol";
878 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET; 878 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
879 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; 879 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
880 if (m_FoxitFaces[12]) { 880 if (m_FoxitFaces[12]) {
881 return m_FoxitFaces[12]; 881 return m_FoxitFaces[12];
882 } 882 }
883 const uint8_t* pFontData = NULL; 883 const uint8_t* pFontData = NULL;
884 FX_DWORD size = 0; 884 uint32_t size = 0;
885 m_pFontMgr->GetBuiltinFont(12, &pFontData, &size); 885 m_pFontMgr->GetBuiltinFont(12, &pFontData, &size);
886 m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0); 886 m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
887 return m_FoxitFaces[12]; 887 return m_FoxitFaces[12];
888 } 888 }
889 if (SubstName == "ZapfDingbats") { 889 if (SubstName == "ZapfDingbats") {
890 pSubstFont->m_Family = "Chrome Dingbats"; 890 pSubstFont->m_Family = "Chrome Dingbats";
891 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET; 891 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
892 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; 892 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
893 if (m_FoxitFaces[13]) { 893 if (m_FoxitFaces[13]) {
894 return m_FoxitFaces[13]; 894 return m_FoxitFaces[13];
895 } 895 }
896 const uint8_t* pFontData = NULL; 896 const uint8_t* pFontData = NULL;
897 FX_DWORD size = 0; 897 uint32_t size = 0;
898 m_pFontMgr->GetBuiltinFont(13, &pFontData, &size); 898 m_pFontMgr->GetBuiltinFont(13, &pFontData, &size);
899 m_FoxitFaces[13] = m_pFontMgr->GetFixedFace(pFontData, size, 0); 899 m_FoxitFaces[13] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
900 return m_FoxitFaces[13]; 900 return m_FoxitFaces[13];
901 } 901 }
902 int iBaseFont = 0; 902 int iBaseFont = 0;
903 CFX_ByteString family, style; 903 CFX_ByteString family, style;
904 FX_BOOL bHasComma = FALSE; 904 FX_BOOL bHasComma = FALSE;
905 FX_BOOL bHasHypen = FALSE; 905 FX_BOOL bHasHypen = FALSE;
906 int find = SubstName.Find(",", 0); 906 int find = SubstName.Find(",", 0);
907 if (find >= 0) { 907 if (find >= 0) {
908 family = SubstName.Left(find); 908 family = SubstName.Left(find);
909 PDF_GetStandardFontName(&family); 909 PDF_GetStandardFontName(&family);
910 style = SubstName.Mid(find + 1); 910 style = SubstName.Mid(find + 1);
911 bHasComma = TRUE; 911 bHasComma = TRUE;
912 } else { 912 } else {
913 family = SubstName; 913 family = SubstName;
914 } 914 }
915 for (; iBaseFont < 12; iBaseFont++) 915 for (; iBaseFont < 12; iBaseFont++)
916 if (family == CFX_ByteStringC(g_Base14FontNames[iBaseFont])) { 916 if (family == CFX_ByteStringC(g_Base14FontNames[iBaseFont])) {
917 break; 917 break;
918 } 918 }
919 int PitchFamily = 0; 919 int PitchFamily = 0;
920 FX_BOOL bItalic = FALSE; 920 FX_BOOL bItalic = FALSE;
921 FX_DWORD nStyle = 0; 921 uint32_t nStyle = 0;
922 FX_BOOL bStyleAvail = FALSE; 922 FX_BOOL bStyleAvail = FALSE;
923 if (iBaseFont < 12) { 923 if (iBaseFont < 12) {
924 family = g_Base14FontNames[iBaseFont]; 924 family = g_Base14FontNames[iBaseFont];
925 if ((iBaseFont % 4) == 1 || (iBaseFont % 4) == 2) { 925 if ((iBaseFont % 4) == 1 || (iBaseFont % 4) == 2) {
926 nStyle |= FX_FONT_STYLE_Bold; 926 nStyle |= FX_FONT_STYLE_Bold;
927 } 927 }
928 if ((iBaseFont % 4) / 2) { 928 if ((iBaseFont % 4) / 2) {
929 nStyle |= FX_FONT_STYLE_Italic; 929 nStyle |= FX_FONT_STYLE_Italic;
930 } 930 }
931 if (iBaseFont < 4) { 931 if (iBaseFont < 4) {
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1132 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \ 1132 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \
1133 _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ 1133 _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_
1134 if (SubstName == "Symbol") { 1134 if (SubstName == "Symbol") {
1135 pSubstFont->m_Family = "Chrome Symbol"; 1135 pSubstFont->m_Family = "Chrome Symbol";
1136 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD; 1136 pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
1137 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET; 1137 pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
1138 if (m_FoxitFaces[12]) { 1138 if (m_FoxitFaces[12]) {
1139 return m_FoxitFaces[12]; 1139 return m_FoxitFaces[12];
1140 } 1140 }
1141 const uint8_t* pFontData = NULL; 1141 const uint8_t* pFontData = NULL;
1142 FX_DWORD size = 0; 1142 uint32_t size = 0;
1143 m_pFontMgr->GetBuiltinFont(12, &pFontData, &size); 1143 m_pFontMgr->GetBuiltinFont(12, &pFontData, &size);
1144 m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0); 1144 m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
1145 return m_FoxitFaces[12]; 1145 return m_FoxitFaces[12];
1146 } 1146 }
1147 #endif 1147 #endif
1148 pSubstFont->m_SubstFlags |= FXFONT_SUBST_NONSYMBOL; 1148 pSubstFont->m_SubstFlags |= FXFONT_SUBST_NONSYMBOL;
1149 return FindSubstFont(family, bTrueType, flags & ~FXFONT_SYMBOLIC, 1149 return FindSubstFont(family, bTrueType, flags & ~FXFONT_SYMBOLIC,
1150 weight, italic_angle, 0, pSubstFont); 1150 weight, italic_angle, 0, pSubstFont);
1151 } 1151 }
1152 if (Charset == FXFONT_ANSI_CHARSET) { 1152 if (Charset == FXFONT_ANSI_CHARSET) {
(...skipping 10 matching lines...) Expand all
1163 } 1163 }
1164 } 1164 }
1165 pSubstFont->m_ExtHandle = m_pFontInfo->RetainFont(hFont); 1165 pSubstFont->m_ExtHandle = m_pFontInfo->RetainFont(hFont);
1166 if (!hFont) 1166 if (!hFont)
1167 return nullptr; 1167 return nullptr;
1168 1168
1169 m_pFontInfo->GetFaceName(hFont, SubstName); 1169 m_pFontInfo->GetFaceName(hFont, SubstName);
1170 if (Charset == FXFONT_DEFAULT_CHARSET) { 1170 if (Charset == FXFONT_DEFAULT_CHARSET) {
1171 m_pFontInfo->GetFontCharset(hFont, Charset); 1171 m_pFontInfo->GetFontCharset(hFont, Charset);
1172 } 1172 }
1173 FX_DWORD ttc_size = m_pFontInfo->GetFontData(hFont, kTableTTCF, nullptr, 0); 1173 uint32_t ttc_size = m_pFontInfo->GetFontData(hFont, kTableTTCF, nullptr, 0);
1174 FX_DWORD font_size = m_pFontInfo->GetFontData(hFont, 0, nullptr, 0); 1174 uint32_t font_size = m_pFontInfo->GetFontData(hFont, 0, nullptr, 0);
1175 if (font_size == 0 && ttc_size == 0) { 1175 if (font_size == 0 && ttc_size == 0) {
1176 m_pFontInfo->DeleteFont(hFont); 1176 m_pFontInfo->DeleteFont(hFont);
1177 return nullptr; 1177 return nullptr;
1178 } 1178 }
1179 FXFT_Face face = nullptr; 1179 FXFT_Face face = nullptr;
1180 if (ttc_size) { 1180 if (ttc_size) {
1181 uint8_t temp[1024]; 1181 uint8_t temp[1024];
1182 m_pFontInfo->GetFontData(hFont, kTableTTCF, temp, 1024); 1182 m_pFontInfo->GetFontData(hFont, kTableTTCF, temp, 1024);
1183 FX_DWORD checksum = 0; 1183 uint32_t checksum = 0;
1184 for (int i = 0; i < 256; i++) { 1184 for (int i = 0; i < 256; i++) {
1185 checksum += ((FX_DWORD*)temp)[i]; 1185 checksum += ((uint32_t*)temp)[i];
1186 } 1186 }
1187 uint8_t* pFontData; 1187 uint8_t* pFontData;
1188 face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum, 1188 face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum,
1189 ttc_size - font_size, pFontData); 1189 ttc_size - font_size, pFontData);
1190 if (!face) { 1190 if (!face) {
1191 pFontData = FX_Alloc(uint8_t, ttc_size); 1191 pFontData = FX_Alloc(uint8_t, ttc_size);
1192 m_pFontInfo->GetFontData(hFont, kTableTTCF, pFontData, ttc_size); 1192 m_pFontInfo->GetFontData(hFont, kTableTTCF, pFontData, ttc_size);
1193 face = m_pFontMgr->AddCachedTTCFace(ttc_size, checksum, pFontData, 1193 face = m_pFontMgr->AddCachedTTCFace(ttc_size, checksum, pFontData,
1194 ttc_size, ttc_size - font_size); 1194 ttc_size, ttc_size - font_size);
1195 } 1195 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 italic_angle = -12; 1232 italic_angle = -12;
1233 } else if (FXSYS_abs(italic_angle) < 5) { 1233 } else if (FXSYS_abs(italic_angle) < 5) {
1234 italic_angle = 0; 1234 italic_angle = 0;
1235 } 1235 }
1236 pSubstFont->m_ItalicAngle = italic_angle; 1236 pSubstFont->m_ItalicAngle = italic_angle;
1237 } 1237 }
1238 m_pFontInfo->DeleteFont(hFont); 1238 m_pFontInfo->DeleteFont(hFont);
1239 return face; 1239 return face;
1240 } 1240 }
1241 #ifdef PDF_ENABLE_XFA 1241 #ifdef PDF_ENABLE_XFA
1242 FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode, 1242 FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(uint32_t dwUnicode,
1243 FX_DWORD flags, 1243 uint32_t flags,
1244 int weight, 1244 int weight,
1245 int italic_angle) { 1245 int italic_angle) {
1246 if (m_pFontInfo == NULL) { 1246 if (m_pFontInfo == NULL) {
1247 return NULL; 1247 return NULL;
1248 } 1248 }
1249 FX_BOOL bItalic = (flags & FXFONT_ITALIC) != 0; 1249 FX_BOOL bItalic = (flags & FXFONT_ITALIC) != 0;
1250 int PitchFamily = 0; 1250 int PitchFamily = 0;
1251 if (flags & FXFONT_SERIF) { 1251 if (flags & FXFONT_SERIF) {
1252 PitchFamily |= FXFONT_FF_ROMAN; 1252 PitchFamily |= FXFONT_FF_ROMAN;
1253 } 1253 }
1254 if (flags & FXFONT_SCRIPT) { 1254 if (flags & FXFONT_SCRIPT) {
1255 PitchFamily |= FXFONT_FF_SCRIPT; 1255 PitchFamily |= FXFONT_FF_SCRIPT;
1256 } 1256 }
1257 if (flags & FXFONT_FIXED_PITCH) { 1257 if (flags & FXFONT_FIXED_PITCH) {
1258 PitchFamily |= FXFONT_FF_FIXEDPITCH; 1258 PitchFamily |= FXFONT_FF_FIXEDPITCH;
1259 } 1259 }
1260 void* hFont = 1260 void* hFont =
1261 m_pFontInfo->MapFontByUnicode(dwUnicode, weight, bItalic, PitchFamily); 1261 m_pFontInfo->MapFontByUnicode(dwUnicode, weight, bItalic, PitchFamily);
1262 if (hFont == NULL) { 1262 if (hFont == NULL) {
1263 return NULL; 1263 return NULL;
1264 } 1264 }
1265 FX_DWORD ttc_size = m_pFontInfo->GetFontData(hFont, 0x74746366, NULL, 0); 1265 uint32_t ttc_size = m_pFontInfo->GetFontData(hFont, 0x74746366, NULL, 0);
1266 FX_DWORD font_size = m_pFontInfo->GetFontData(hFont, 0, NULL, 0); 1266 uint32_t font_size = m_pFontInfo->GetFontData(hFont, 0, NULL, 0);
1267 if (font_size == 0 && ttc_size == 0) { 1267 if (font_size == 0 && ttc_size == 0) {
1268 m_pFontInfo->DeleteFont(hFont); 1268 m_pFontInfo->DeleteFont(hFont);
1269 return NULL; 1269 return NULL;
1270 } 1270 }
1271 FXFT_Face face = NULL; 1271 FXFT_Face face = NULL;
1272 if (ttc_size) { 1272 if (ttc_size) {
1273 uint8_t temp[1024]; 1273 uint8_t temp[1024];
1274 m_pFontInfo->GetFontData(hFont, 0x74746366, temp, 1024); 1274 m_pFontInfo->GetFontData(hFont, 0x74746366, temp, 1024);
1275 FX_DWORD checksum = 0; 1275 uint32_t checksum = 0;
1276 for (int i = 0; i < 256; i++) { 1276 for (int i = 0; i < 256; i++) {
1277 checksum += ((FX_DWORD*)temp)[i]; 1277 checksum += ((uint32_t*)temp)[i];
1278 } 1278 }
1279 uint8_t* pFontData; 1279 uint8_t* pFontData;
1280 face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum, 1280 face = m_pFontMgr->GetCachedTTCFace(ttc_size, checksum,
1281 ttc_size - font_size, pFontData); 1281 ttc_size - font_size, pFontData);
1282 if (face == NULL) { 1282 if (face == NULL) {
1283 pFontData = FX_Alloc(uint8_t, ttc_size); 1283 pFontData = FX_Alloc(uint8_t, ttc_size);
1284 if (pFontData) { 1284 if (pFontData) {
1285 m_pFontInfo->GetFontData(hFont, 0x74746366, pFontData, ttc_size); 1285 m_pFontInfo->GetFontData(hFont, 0x74746366, pFontData, ttc_size);
1286 face = m_pFontMgr->AddCachedTTCFace(ttc_size, checksum, pFontData, 1286 face = m_pFontMgr->AddCachedTTCFace(ttc_size, checksum, pFontData,
1287 ttc_size, ttc_size - font_size); 1287 ttc_size, ttc_size - font_size);
(...skipping 13 matching lines...) Expand all
1301 m_pFontInfo->GetFontData(hFont, 0, pFontData, font_size); 1301 m_pFontInfo->GetFontData(hFont, 0, pFontData, font_size);
1302 face = m_pFontMgr->AddCachedFace(SubstName, weight, bItalic, pFontData, 1302 face = m_pFontMgr->AddCachedFace(SubstName, weight, bItalic, pFontData,
1303 font_size, 1303 font_size,
1304 m_pFontInfo->GetFaceIndex(hFont)); 1304 m_pFontInfo->GetFaceIndex(hFont));
1305 } 1305 }
1306 } 1306 }
1307 m_pFontInfo->DeleteFont(hFont); 1307 m_pFontInfo->DeleteFont(hFont);
1308 return face; 1308 return face;
1309 } 1309 }
1310 1310
1311 void* IFX_SystemFontInfo::MapFontByUnicode(FX_DWORD dwUnicode, 1311 void* IFX_SystemFontInfo::MapFontByUnicode(uint32_t dwUnicode,
1312 int weight, 1312 int weight,
1313 FX_BOOL bItalic, 1313 FX_BOOL bItalic,
1314 int pitch_family) { 1314 int pitch_family) {
1315 return nullptr; 1315 return nullptr;
1316 } 1316 }
1317 #endif // PDF_ENABLE_XFA 1317 #endif // PDF_ENABLE_XFA
1318 1318
1319 int IFX_SystemFontInfo::GetFaceIndex(void* hFont) { 1319 int IFX_SystemFontInfo::GetFaceIndex(void* hFont) {
1320 return 0; 1320 return 0;
1321 } 1321 }
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 } 1408 }
1409 } 1409 }
1410 FX_CloseFolder(handle); 1410 FX_CloseFolder(handle);
1411 } 1411 }
1412 void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) { 1412 void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) {
1413 FXSYS_FILE* pFile = FXSYS_fopen(path, "rb"); 1413 FXSYS_FILE* pFile = FXSYS_fopen(path, "rb");
1414 if (!pFile) { 1414 if (!pFile) {
1415 return; 1415 return;
1416 } 1416 }
1417 FXSYS_fseek(pFile, 0, FXSYS_SEEK_END); 1417 FXSYS_fseek(pFile, 0, FXSYS_SEEK_END);
1418 FX_DWORD filesize = FXSYS_ftell(pFile); 1418 uint32_t filesize = FXSYS_ftell(pFile);
1419 uint8_t buffer[16]; 1419 uint8_t buffer[16];
1420 FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET); 1420 FXSYS_fseek(pFile, 0, FXSYS_SEEK_SET);
1421 size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile); 1421 size_t readCnt = FXSYS_fread(buffer, 12, 1, pFile);
1422 if (readCnt != 1) { 1422 if (readCnt != 1) {
1423 FXSYS_fclose(pFile); 1423 FXSYS_fclose(pFile);
1424 return; 1424 return;
1425 } 1425 }
1426 1426
1427 if (GET_TT_LONG(buffer) == kTableTTCF) { 1427 if (GET_TT_LONG(buffer) == kTableTTCF) {
1428 FX_DWORD nFaces = GET_TT_LONG(buffer + 8); 1428 uint32_t nFaces = GET_TT_LONG(buffer + 8);
1429 if (nFaces > std::numeric_limits<FX_DWORD>::max() / 4) { 1429 if (nFaces > std::numeric_limits<uint32_t>::max() / 4) {
1430 FXSYS_fclose(pFile); 1430 FXSYS_fclose(pFile);
1431 return; 1431 return;
1432 } 1432 }
1433 FX_DWORD face_bytes = nFaces * 4; 1433 uint32_t face_bytes = nFaces * 4;
1434 uint8_t* offsets = FX_Alloc(uint8_t, face_bytes); 1434 uint8_t* offsets = FX_Alloc(uint8_t, face_bytes);
1435 readCnt = FXSYS_fread(offsets, 1, face_bytes, pFile); 1435 readCnt = FXSYS_fread(offsets, 1, face_bytes, pFile);
1436 if (readCnt != face_bytes) { 1436 if (readCnt != face_bytes) {
1437 FX_Free(offsets); 1437 FX_Free(offsets);
1438 FXSYS_fclose(pFile); 1438 FXSYS_fclose(pFile);
1439 return; 1439 return;
1440 } 1440 }
1441 for (FX_DWORD i = 0; i < nFaces; i++) { 1441 for (uint32_t i = 0; i < nFaces; i++) {
1442 uint8_t* p = offsets + i * 4; 1442 uint8_t* p = offsets + i * 4;
1443 ReportFace(path, pFile, filesize, GET_TT_LONG(p)); 1443 ReportFace(path, pFile, filesize, GET_TT_LONG(p));
1444 } 1444 }
1445 FX_Free(offsets); 1445 FX_Free(offsets);
1446 } else { 1446 } else {
1447 ReportFace(path, pFile, filesize, 0); 1447 ReportFace(path, pFile, filesize, 0);
1448 } 1448 }
1449 FXSYS_fclose(pFile); 1449 FXSYS_fclose(pFile);
1450 } 1450 }
1451 void CFX_FolderFontInfo::ReportFace(const CFX_ByteString& path, 1451 void CFX_FolderFontInfo::ReportFace(const CFX_ByteString& path,
1452 FXSYS_FILE* pFile, 1452 FXSYS_FILE* pFile,
1453 FX_DWORD filesize, 1453 uint32_t filesize,
1454 FX_DWORD offset) { 1454 uint32_t offset) {
1455 FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET); 1455 FXSYS_fseek(pFile, offset, FXSYS_SEEK_SET);
1456 char buffer[16]; 1456 char buffer[16];
1457 if (!FXSYS_fread(buffer, 12, 1, pFile)) { 1457 if (!FXSYS_fread(buffer, 12, 1, pFile)) {
1458 return; 1458 return;
1459 } 1459 }
1460 FX_DWORD nTables = GET_TT_SHORT(buffer + 4); 1460 uint32_t nTables = GET_TT_SHORT(buffer + 4);
1461 CFX_ByteString tables = FPDF_ReadStringFromFile(pFile, nTables * 16); 1461 CFX_ByteString tables = FPDF_ReadStringFromFile(pFile, nTables * 16);
1462 if (tables.IsEmpty()) { 1462 if (tables.IsEmpty()) {
1463 return; 1463 return;
1464 } 1464 }
1465 CFX_ByteString names = 1465 CFX_ByteString names =
1466 FPDF_LoadTableFromTT(pFile, tables, nTables, 0x6e616d65); 1466 FPDF_LoadTableFromTT(pFile, tables, nTables, 0x6e616d65);
1467 if (names.IsEmpty()) { 1467 if (names.IsEmpty()) {
1468 return; 1468 return;
1469 } 1469 }
1470 CFX_ByteString facename = GetNameFromTT(names, names.GetLength(), 1); 1470 CFX_ByteString facename = GetNameFromTT(names, names.GetLength(), 1);
1471 if (facename.IsEmpty()) { 1471 if (facename.IsEmpty()) {
1472 return; 1472 return;
1473 } 1473 }
1474 CFX_ByteString style = GetNameFromTT(names, names.GetLength(), 2); 1474 CFX_ByteString style = GetNameFromTT(names, names.GetLength(), 2);
1475 if (style != "Regular") { 1475 if (style != "Regular") {
1476 facename += " " + style; 1476 facename += " " + style;
1477 } 1477 }
1478 if (pdfium::ContainsKey(m_FontList, facename)) 1478 if (pdfium::ContainsKey(m_FontList, facename))
1479 return; 1479 return;
1480 1480
1481 CFX_FontFaceInfo* pInfo = 1481 CFX_FontFaceInfo* pInfo =
1482 new CFX_FontFaceInfo(path, facename, tables, offset, filesize); 1482 new CFX_FontFaceInfo(path, facename, tables, offset, filesize);
1483 CFX_ByteString os2 = FPDF_LoadTableFromTT(pFile, tables, nTables, 0x4f532f32); 1483 CFX_ByteString os2 = FPDF_LoadTableFromTT(pFile, tables, nTables, 0x4f532f32);
1484 if (os2.GetLength() >= 86) { 1484 if (os2.GetLength() >= 86) {
1485 const uint8_t* p = (const uint8_t*)os2 + 78; 1485 const uint8_t* p = (const uint8_t*)os2 + 78;
1486 FX_DWORD codepages = GET_TT_LONG(p); 1486 uint32_t codepages = GET_TT_LONG(p);
1487 if (codepages & (1 << 17)) { 1487 if (codepages & (1 << 17)) {
1488 m_pMapper->AddInstalledFont(facename, FXFONT_SHIFTJIS_CHARSET); 1488 m_pMapper->AddInstalledFont(facename, FXFONT_SHIFTJIS_CHARSET);
1489 pInfo->m_Charsets |= CHARSET_FLAG_SHIFTJIS; 1489 pInfo->m_Charsets |= CHARSET_FLAG_SHIFTJIS;
1490 } 1490 }
1491 if (codepages & (1 << 18)) { 1491 if (codepages & (1 << 18)) {
1492 m_pMapper->AddInstalledFont(facename, FXFONT_GB2312_CHARSET); 1492 m_pMapper->AddInstalledFont(facename, FXFONT_GB2312_CHARSET);
1493 pInfo->m_Charsets |= CHARSET_FLAG_GB; 1493 pInfo->m_Charsets |= CHARSET_FLAG_GB;
1494 } 1494 }
1495 if (codepages & (1 << 20)) { 1495 if (codepages & (1 << 20)) {
1496 m_pMapper->AddInstalledFont(facename, FXFONT_CHINESEBIG5_CHARSET); 1496 m_pMapper->AddInstalledFont(facename, FXFONT_CHINESEBIG5_CHARSET);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1533 void* CFX_FolderFontInfo::FindFont(int weight, 1533 void* CFX_FolderFontInfo::FindFont(int weight,
1534 FX_BOOL bItalic, 1534 FX_BOOL bItalic,
1535 int charset, 1535 int charset,
1536 int pitch_family, 1536 int pitch_family,
1537 const FX_CHAR* family, 1537 const FX_CHAR* family,
1538 FX_BOOL bMatchName) { 1538 FX_BOOL bMatchName) {
1539 CFX_FontFaceInfo* pFind = nullptr; 1539 CFX_FontFaceInfo* pFind = nullptr;
1540 if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH)) { 1540 if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH)) {
1541 return GetFont("Courier New"); 1541 return GetFont("Courier New");
1542 } 1542 }
1543 FX_DWORD charset_flag = GetCharset(charset); 1543 uint32_t charset_flag = GetCharset(charset);
1544 int32_t iBestSimilar = 0; 1544 int32_t iBestSimilar = 0;
1545 for (const auto& it : m_FontList) { 1545 for (const auto& it : m_FontList) {
1546 const CFX_ByteString& bsName = it.first; 1546 const CFX_ByteString& bsName = it.first;
1547 CFX_FontFaceInfo* pFont = it.second; 1547 CFX_FontFaceInfo* pFont = it.second;
1548 if (!(pFont->m_Charsets & charset_flag) && 1548 if (!(pFont->m_Charsets & charset_flag) &&
1549 charset != FXFONT_DEFAULT_CHARSET) { 1549 charset != FXFONT_DEFAULT_CHARSET) {
1550 continue; 1550 continue;
1551 } 1551 }
1552 int32_t index = bsName.Find(family); 1552 int32_t index = bsName.Find(family);
1553 if (bMatchName && index < 0) { 1553 if (bMatchName && index < 0) {
(...skipping 11 matching lines...) Expand all
1565 void* CFX_FolderFontInfo::MapFont(int weight, 1565 void* CFX_FolderFontInfo::MapFont(int weight,
1566 FX_BOOL bItalic, 1566 FX_BOOL bItalic,
1567 int charset, 1567 int charset,
1568 int pitch_family, 1568 int pitch_family,
1569 const FX_CHAR* family, 1569 const FX_CHAR* family,
1570 int& iExact) { 1570 int& iExact) {
1571 return NULL; 1571 return NULL;
1572 } 1572 }
1573 1573
1574 #ifdef PDF_ENABLE_XFA 1574 #ifdef PDF_ENABLE_XFA
1575 void* CFX_FolderFontInfo::MapFontByUnicode(FX_DWORD dwUnicode, 1575 void* CFX_FolderFontInfo::MapFontByUnicode(uint32_t dwUnicode,
1576 int weight, 1576 int weight,
1577 FX_BOOL bItalic, 1577 FX_BOOL bItalic,
1578 int pitch_family) { 1578 int pitch_family) {
1579 return NULL; 1579 return NULL;
1580 } 1580 }
1581 #endif // PDF_ENABLE_XFA 1581 #endif // PDF_ENABLE_XFA
1582 1582
1583 void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) { 1583 void* CFX_FolderFontInfo::GetFont(const FX_CHAR* face) {
1584 auto it = m_FontList.find(face); 1584 auto it = m_FontList.find(face);
1585 return it != m_FontList.end() ? it->second : nullptr; 1585 return it != m_FontList.end() ? it->second : nullptr;
1586 } 1586 }
1587 1587
1588 FX_DWORD CFX_FolderFontInfo::GetFontData(void* hFont, 1588 uint32_t CFX_FolderFontInfo::GetFontData(void* hFont,
1589 FX_DWORD table, 1589 uint32_t table,
1590 uint8_t* buffer, 1590 uint8_t* buffer,
1591 FX_DWORD size) { 1591 uint32_t size) {
1592 if (!hFont) 1592 if (!hFont)
1593 return 0; 1593 return 0;
1594 1594
1595 const CFX_FontFaceInfo* pFont = static_cast<CFX_FontFaceInfo*>(hFont); 1595 const CFX_FontFaceInfo* pFont = static_cast<CFX_FontFaceInfo*>(hFont);
1596 FX_DWORD datasize = 0; 1596 uint32_t datasize = 0;
1597 FX_DWORD offset = 0; 1597 uint32_t offset = 0;
1598 if (table == 0) { 1598 if (table == 0) {
1599 datasize = pFont->m_FontOffset ? 0 : pFont->m_FileSize; 1599 datasize = pFont->m_FontOffset ? 0 : pFont->m_FileSize;
1600 } else if (table == kTableTTCF) { 1600 } else if (table == kTableTTCF) {
1601 datasize = pFont->m_FontOffset ? pFont->m_FileSize : 0; 1601 datasize = pFont->m_FontOffset ? pFont->m_FileSize : 0;
1602 } else { 1602 } else {
1603 FX_DWORD nTables = pFont->m_FontTables.GetLength() / 16; 1603 uint32_t nTables = pFont->m_FontTables.GetLength() / 16;
1604 for (FX_DWORD i = 0; i < nTables; i++) { 1604 for (uint32_t i = 0; i < nTables; i++) {
1605 const uint8_t* p = 1605 const uint8_t* p =
1606 static_cast<const uint8_t*>(pFont->m_FontTables) + i * 16; 1606 static_cast<const uint8_t*>(pFont->m_FontTables) + i * 16;
1607 if (GET_TT_LONG(p) == table) { 1607 if (GET_TT_LONG(p) == table) {
1608 offset = GET_TT_LONG(p + 8); 1608 offset = GET_TT_LONG(p + 8);
1609 datasize = GET_TT_LONG(p + 12); 1609 datasize = GET_TT_LONG(p + 12);
1610 } 1610 }
1611 } 1611 }
1612 } 1612 }
1613 1613
1614 if (!datasize || size < datasize) 1614 if (!datasize || size < datasize)
(...skipping 27 matching lines...) Expand all
1642 int PDF_GetStandardFontName(CFX_ByteString* name) { 1642 int PDF_GetStandardFontName(CFX_ByteString* name) {
1643 AltFontName* found = static_cast<AltFontName*>( 1643 AltFontName* found = static_cast<AltFontName*>(
1644 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames), 1644 FXSYS_bsearch(name->c_str(), g_AltFontNames, FX_ArraySize(g_AltFontNames),
1645 sizeof(AltFontName), CompareString)); 1645 sizeof(AltFontName), CompareString));
1646 if (!found) 1646 if (!found)
1647 return -1; 1647 return -1;
1648 1648
1649 *name = g_Base14FontNames[found->m_Index]; 1649 *name = g_Base14FontNames[found->m_Index];
1650 return found->m_Index; 1650 return found->m_Index;
1651 } 1651 }
OLDNEW
« no previous file with comments | « core/fxge/ge/fx_ge_font.cpp ('k') | core/fxge/ge/fx_ge_ps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698