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 "../../../include/fxge/fx_ge.h" | 7 #include "../../../include/fxge/fx_ge.h" |
8 #include "../../../include/fxge/fx_freetype.h" | 8 #include "../../../include/fxge/fx_freetype.h" |
9 #include "text_int.h" | 9 #include "text_int.h" |
10 #define EM_ADJUST(em, a) (em == 0?(a): (a)*1000/em) | 10 #define EM_ADJUST(em, a) (em == 0?(a): (a)*1000/em) |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 void CFX_Font::DeleteFace() | 61 void CFX_Font::DeleteFace() |
62 { | 62 { |
63 FXFT_Done_Face(m_Face); | 63 FXFT_Done_Face(m_Face); |
64 m_Face = NULL; | 64 m_Face = NULL; |
65 } | 65 } |
66 FX_BOOL CFX_Font::LoadSubst(const CFX_ByteString& face_name, FX_BOOL bTrueType,
FX_DWORD flags, | 66 FX_BOOL CFX_Font::LoadSubst(const CFX_ByteString& face_name, FX_BOOL bTrueType,
FX_DWORD flags, |
67 int weight, int italic_angle, int CharsetCP, FX_BOOL
bVertical) | 67 int weight, int italic_angle, int CharsetCP, FX_BOOL
bVertical) |
68 { | 68 { |
69 m_bEmbedded = FALSE; | 69 m_bEmbedded = FALSE; |
70 m_bVertical = bVertical; | 70 m_bVertical = bVertical; |
71 m_pSubstFont = FX_NEW CFX_SubstFont; | 71 m_pSubstFont = new CFX_SubstFont; |
72 if (!m_pSubstFont) { | |
73 return FALSE; | |
74 } | |
75 m_Face = CFX_GEModule::Get()->GetFontMgr()->FindSubstFont(face_name, bTrueTy
pe, flags, weight, italic_angle, | 72 m_Face = CFX_GEModule::Get()->GetFontMgr()->FindSubstFont(face_name, bTrueTy
pe, flags, weight, italic_angle, |
76 CharsetCP, m_pSubstFont); | 73 CharsetCP, m_pSubstFont); |
77 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 74 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
78 if(m_pSubstFont->m_ExtHandle) { | 75 if(m_pSubstFont->m_ExtHandle) { |
79 m_pPlatformFont = m_pSubstFont->m_ExtHandle; | 76 m_pPlatformFont = m_pSubstFont->m_ExtHandle; |
80 m_pSubstFont->m_ExtHandle = NULL; | 77 m_pSubstFont->m_ExtHandle = NULL; |
81 } | 78 } |
82 #endif | 79 #endif |
83 if (m_Face) { | 80 if (m_Face) { |
84 m_pFontData = FXFT_Get_Face_Stream_Base(m_Face); | 81 m_pFontData = FXFT_Get_Face_Stream_Base(m_Face); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 if (encoding != FXFT_ENCODING_UNICODE) { | 432 if (encoding != FXFT_ENCODING_UNICODE) { |
436 FXFT_Select_Charmap(face, encoding); | 433 FXFT_Select_Charmap(face, encoding); |
437 break; | 434 break; |
438 } | 435 } |
439 } | 436 } |
440 } | 437 } |
441 return FXFT_Get_Char_Index(face, charcode); | 438 return FXFT_Get_Char_Index(face, charcode); |
442 } | 439 } |
443 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont) | 440 IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont) |
444 { | 441 { |
445 CFX_UnicodeEncoding* pEncoding = NULL; | 442 return new CFX_UnicodeEncoding(pFont); |
446 pEncoding = FX_NEW CFX_UnicodeEncoding(pFont); | |
447 return pEncoding; | |
448 } | 443 } |
OLD | NEW |