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 "fx_fpf.h" | 7 #include "fx_fpf.h" |
8 #if _FX_OS_ == _FX_ANDROID_ | 8 #if _FX_OS_ == _FX_ANDROID_ |
9 #define FPF_SKIAMATCHWEIGHT_NAME1 62 | 9 #define FPF_SKIAMATCHWEIGHT_NAME1 62 |
10 #define FPF_SKIAMATCHWEIGHT_NAME2 60 | 10 #define FPF_SKIAMATCHWEIGHT_NAME2 60 |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 nMax = nFind; | 345 nMax = nFind; |
346 nItem = i; | 346 nItem = i; |
347 } | 347 } |
348 if (nExpectVal <= nFind) { | 348 if (nExpectVal <= nFind) { |
349 nItem = i; | 349 nItem = i; |
350 break; | 350 break; |
351 } | 351 } |
352 } | 352 } |
353 if (nItem > -1) { | 353 if (nItem > -1) { |
354 CFPF_SkiaFontDescriptor *pFontDes = (CFPF_SkiaFontDescriptor*)m_FontFace
s.ElementAt(nItem); | 354 CFPF_SkiaFontDescriptor *pFontDes = (CFPF_SkiaFontDescriptor*)m_FontFace
s.ElementAt(nItem); |
355 CFPF_SkiaFont *pFont = FX_NEW CFPF_SkiaFont; | 355 CFPF_SkiaFont *pFont = new CFPF_SkiaFont; |
356 if (pFont) { | 356 if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)) { |
357 if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)
) { | 357 m_FamilyFonts.SetAt((void*)(FX_UINTPTR)dwHash, (void*)pFont); |
358 m_FamilyFonts.SetAt((void*)(FX_UINTPTR)dwHash, (void*)pFont); | 358 return pFont->Retain(); |
359 return pFont->Retain(); | |
360 } | |
361 pFont->Release(); | |
362 pFont = NULL; | |
363 } | 359 } |
364 return pFont; | 360 pFont->Release(); |
365 } | 361 } |
366 return NULL; | 362 return NULL; |
367 } | 363 } |
368 FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead *pFileRead, FX_INT32 iFaceI
ndex) | 364 FXFT_Face CFPF_SkiaFontMgr::GetFontFace(IFX_FileRead *pFileRead, FX_INT32 iFaceI
ndex) |
369 { | 365 { |
370 if (!pFileRead) { | 366 if (!pFileRead) { |
371 return NULL; | 367 return NULL; |
372 } | 368 } |
373 if (pFileRead->GetSize() == 0) { | 369 if (pFileRead->GetSize() == 0) { |
374 return NULL; | 370 return NULL; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 } else { | 453 } else { |
458 ScanFile(fullpath); | 454 ScanFile(fullpath); |
459 } | 455 } |
460 } | 456 } |
461 FX_CloseFolder(handle); | 457 FX_CloseFolder(handle); |
462 } | 458 } |
463 void CFPF_SkiaFontMgr::ScanFile(FX_BSTR file) | 459 void CFPF_SkiaFontMgr::ScanFile(FX_BSTR file) |
464 { | 460 { |
465 FXFT_Face face = GetFontFace(file); | 461 FXFT_Face face = GetFontFace(file); |
466 if (face) { | 462 if (face) { |
467 CFPF_SkiaPathFont *pFontDesc = FX_NEW CFPF_SkiaPathFont; | 463 CFPF_SkiaPathFont *pFontDesc = new CFPF_SkiaPathFont; |
468 if (!pFontDesc) { | |
469 return; | |
470 } | |
471 pFontDesc->SetPath(file.GetCStr()); | 464 pFontDesc->SetPath(file.GetCStr()); |
472 ReportFace(face, pFontDesc); | 465 ReportFace(face, pFontDesc); |
473 m_FontFaces.Add(pFontDesc); | 466 m_FontFaces.Add(pFontDesc); |
474 FXFT_Done_Face(face); | 467 FXFT_Done_Face(face); |
475 } | 468 } |
476 } | 469 } |
477 static const FX_DWORD g_FPFSkiaFontCharsets [] = { | 470 static const FX_DWORD g_FPFSkiaFontCharsets [] = { |
478 FPF_SKIACHARSET_Ansi, | 471 FPF_SKIACHARSET_Ansi, |
479 FPF_SKIACHARSET_EeasternEuropean, | 472 FPF_SKIACHARSET_EeasternEuropean, |
480 FPF_SKIACHARSET_Cyrillic, | 473 FPF_SKIACHARSET_Cyrillic, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 pFontDesc->m_dwStyle |= FXFONT_SYMBOLIC; | 545 pFontDesc->m_dwStyle |= FXFONT_SYMBOLIC; |
553 } | 546 } |
554 pFontDesc->m_dwCharsets = FPF_SkiaGetFaceCharset(pOS2); | 547 pFontDesc->m_dwCharsets = FPF_SkiaGetFaceCharset(pOS2); |
555 pFontDesc->m_iFaceIndex = face->face_index; | 548 pFontDesc->m_iFaceIndex = face->face_index; |
556 pFontDesc->m_iGlyphNum = face->num_glyphs; | 549 pFontDesc->m_iGlyphNum = face->num_glyphs; |
557 } | 550 } |
558 void CFPF_SkiaFontMgr::OutputSystemFonts() | 551 void CFPF_SkiaFontMgr::OutputSystemFonts() |
559 { | 552 { |
560 } | 553 } |
561 #endif | 554 #endif |
OLD | NEW |