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 "core/include/fxge/fx_freetype.h" | 7 #include "core/include/fxge/fx_freetype.h" |
8 #include "core/include/fxge/fx_ge.h" | 8 #include "core/include/fxge/fx_ge.h" |
9 #include "text_int.h" | 9 #include "text_int.h" |
10 | 10 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 m_pDwFont = pFont->m_pDwFont; | 99 m_pDwFont = pFont->m_pDwFont; |
100 m_hHandle = pFont->m_hHandle; | 100 m_hHandle = pFont->m_hHandle; |
101 m_bDwLoaded = pFont->m_bDwLoaded; | 101 m_bDwLoaded = pFont->m_bDwLoaded; |
102 m_pOwnedStream = pFont->m_pOwnedStream; | 102 m_pOwnedStream = pFont->m_pOwnedStream; |
103 return TRUE; | 103 return TRUE; |
104 } | 104 } |
105 #endif // PDF_ENABLE_XFA | 105 #endif // PDF_ENABLE_XFA |
106 | 106 |
107 CFX_Font::~CFX_Font() { | 107 CFX_Font::~CFX_Font() { |
108 delete m_pSubstFont; | 108 delete m_pSubstFont; |
109 m_pSubstFont = NULL; | |
110 #ifndef PDF_ENABLE_XFA | |
111 FX_Free(m_pFontDataAllocation); | 109 FX_Free(m_pFontDataAllocation); |
112 m_pFontDataAllocation = NULL; | 110 #ifdef PDF_ENABLE_XFA |
113 #else | |
114 if (m_bLogic) { | 111 if (m_bLogic) { |
115 m_OtfFontData.DetachBuffer(); | 112 m_OtfFontData.DetachBuffer(); |
116 return; | 113 return; |
117 } | 114 } |
118 #endif // PDF_ENABLE_XFA | 115 #endif // PDF_ENABLE_XFA |
119 if (m_Face) { | 116 if (m_Face) { |
120 #ifndef PDF_ENABLE_XFA | 117 #ifndef PDF_ENABLE_XFA |
121 if (FXFT_Get_Face_External_Stream(m_Face)) { | 118 if (FXFT_Get_Face_External_Stream(m_Face)) { |
122 FXFT_Clear_Face_External_Stream(m_Face); | 119 FXFT_Clear_Face_External_Stream(m_Face); |
123 } | 120 } |
124 #endif // PDF_ENABLE_XFA | 121 #endif // PDF_ENABLE_XFA |
125 if (m_bEmbedded) { | 122 if (m_bEmbedded) { |
126 DeleteFace(); | 123 DeleteFace(); |
127 } else { | 124 } else { |
128 CFX_GEModule::Get()->GetFontMgr()->ReleaseFace(m_Face); | 125 CFX_GEModule::Get()->GetFontMgr()->ReleaseFace(m_Face); |
129 } | 126 } |
130 } | 127 } |
131 #ifdef PDF_ENABLE_XFA | 128 #ifdef PDF_ENABLE_XFA |
132 FX_Free(m_pOwnedStream); | 129 FX_Free(m_pOwnedStream); |
133 m_pOwnedStream = NULL; | |
134 #endif // PDF_ENABLE_XFA | 130 #endif // PDF_ENABLE_XFA |
135 FX_Free(m_pGsubData); | 131 FX_Free(m_pGsubData); |
136 m_pGsubData = NULL; | |
137 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 132 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
138 ReleasePlatformResource(); | 133 ReleasePlatformResource(); |
139 #endif | 134 #endif |
140 } | 135 } |
141 void CFX_Font::DeleteFace() { | 136 void CFX_Font::DeleteFace() { |
142 FXFT_Done_Face(m_Face); | 137 FXFT_Done_Face(m_Face); |
143 m_Face = NULL; | 138 m_Face = NULL; |
144 } | 139 } |
145 void CFX_Font::LoadSubst(const CFX_ByteString& face_name, | 140 void CFX_Font::LoadSubst(const CFX_ByteString& face_name, |
146 FX_BOOL bTrueType, | 141 FX_BOOL bTrueType, |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 for (size_t i = 0; i < FX_ArraySize(g_EncodingID); ++i) { | 546 for (size_t i = 0; i < FX_ArraySize(g_EncodingID); ++i) { |
552 CFX_UnicodeEncodingEx* pFontEncoding = | 547 CFX_UnicodeEncodingEx* pFontEncoding = |
553 _FXFM_CreateFontEncoding(pFont, g_EncodingID[i]); | 548 _FXFM_CreateFontEncoding(pFont, g_EncodingID[i]); |
554 if (pFontEncoding) { | 549 if (pFontEncoding) { |
555 return pFontEncoding; | 550 return pFontEncoding; |
556 } | 551 } |
557 } | 552 } |
558 return NULL; | 553 return NULL; |
559 } | 554 } |
560 #endif // PDF_ENABLE_XFA | 555 #endif // PDF_ENABLE_XFA |
OLD | NEW |