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/fxge/include/fx_font.h" | 7 #include "core/fxge/include/fx_font.h" |
8 | 8 |
9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" | 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" |
10 #include "core/fxge/include/cfx_fontmgr.h" | 10 #include "core/fxge/include/cfx_fontmgr.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 | 96 |
97 #ifdef PDF_ENABLE_XFA | 97 #ifdef PDF_ENABLE_XFA |
98 FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) { | 98 FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) { |
99 if (!pFont) | 99 if (!pFont) |
100 return FALSE; | 100 return FALSE; |
101 | 101 |
102 m_bLogic = TRUE; | 102 m_bLogic = TRUE; |
103 if (pFont->m_pSubstFont) { | 103 if (pFont->m_pSubstFont) { |
104 m_pSubstFont.reset(new CFX_SubstFont); | 104 m_pSubstFont.reset(new CFX_SubstFont); |
105 m_pSubstFont->m_Charset = pFont->m_pSubstFont->m_Charset; | 105 m_pSubstFont->m_Charset = pFont->m_pSubstFont->m_Charset; |
106 m_pSubstFont->m_ExtHandle = pFont->m_pSubstFont->m_ExtHandle; | |
107 m_pSubstFont->m_SubstFlags = pFont->m_pSubstFont->m_SubstFlags; | 106 m_pSubstFont->m_SubstFlags = pFont->m_pSubstFont->m_SubstFlags; |
108 m_pSubstFont->m_Weight = pFont->m_pSubstFont->m_Weight; | 107 m_pSubstFont->m_Weight = pFont->m_pSubstFont->m_Weight; |
109 m_pSubstFont->m_Family = pFont->m_pSubstFont->m_Family; | 108 m_pSubstFont->m_Family = pFont->m_pSubstFont->m_Family; |
110 m_pSubstFont->m_ItalicAngle = pFont->m_pSubstFont->m_ItalicAngle; | 109 m_pSubstFont->m_ItalicAngle = pFont->m_pSubstFont->m_ItalicAngle; |
111 } | 110 } |
112 if (pFont->m_OtfFontData.GetSize()) { | 111 if (pFont->m_OtfFontData.GetSize()) { |
113 m_OtfFontData.AttachData(pFont->m_OtfFontData.GetBuffer(), | 112 m_OtfFontData.AttachData(pFont->m_OtfFontData.GetBuffer(), |
114 pFont->m_OtfFontData.GetSize()); | 113 pFont->m_OtfFontData.GetSize()); |
115 } | 114 } |
116 m_Face = pFont->m_Face; | 115 m_Face = pFont->m_Face; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 int weight, | 165 int weight, |
167 int italic_angle, | 166 int italic_angle, |
168 int CharsetCP, | 167 int CharsetCP, |
169 FX_BOOL bVertical) { | 168 FX_BOOL bVertical) { |
170 m_bEmbedded = FALSE; | 169 m_bEmbedded = FALSE; |
171 m_bVertical = bVertical; | 170 m_bVertical = bVertical; |
172 m_pSubstFont.reset(new CFX_SubstFont); | 171 m_pSubstFont.reset(new CFX_SubstFont); |
173 m_Face = CFX_GEModule::Get()->GetFontMgr()->FindSubstFont( | 172 m_Face = CFX_GEModule::Get()->GetFontMgr()->FindSubstFont( |
174 face_name, bTrueType, flags, weight, italic_angle, CharsetCP, | 173 face_name, bTrueType, flags, weight, italic_angle, CharsetCP, |
175 m_pSubstFont.get()); | 174 m_pSubstFont.get()); |
176 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | |
177 if (m_pSubstFont->m_ExtHandle) { | |
178 m_pPlatformFont = m_pSubstFont->m_ExtHandle; | |
179 m_pSubstFont->m_ExtHandle = nullptr; | |
180 } | |
181 #endif | |
182 if (m_Face) { | 175 if (m_Face) { |
183 m_pFontData = FXFT_Get_Face_Stream_Base(m_Face); | 176 m_pFontData = FXFT_Get_Face_Stream_Base(m_Face); |
184 m_dwSize = FXFT_Get_Face_Stream_Size(m_Face); | 177 m_dwSize = FXFT_Get_Face_Stream_Size(m_Face); |
185 } | 178 } |
186 } | 179 } |
187 | 180 |
188 #ifdef PDF_ENABLE_XFA | 181 #ifdef PDF_ENABLE_XFA |
189 FX_BOOL CFX_Font::LoadFile(IFX_FileRead* pFile, | 182 FX_BOOL CFX_Font::LoadFile(IFX_FileRead* pFile, |
190 int nFaceIndex, | 183 int nFaceIndex, |
191 int* pFaceCount) { | 184 int* pFaceCount) { |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
524 for (size_t i = 0; i < FX_ArraySize(g_EncodingID); ++i) { | 517 for (size_t i = 0; i < FX_ArraySize(g_EncodingID); ++i) { |
525 CFX_UnicodeEncodingEx* pFontEncoding = | 518 CFX_UnicodeEncodingEx* pFontEncoding = |
526 _FXFM_CreateFontEncoding(pFont, g_EncodingID[i]); | 519 _FXFM_CreateFontEncoding(pFont, g_EncodingID[i]); |
527 if (pFontEncoding) { | 520 if (pFontEncoding) { |
528 return pFontEncoding; | 521 return pFontEncoding; |
529 } | 522 } |
530 } | 523 } |
531 return nullptr; | 524 return nullptr; |
532 } | 525 } |
533 #endif // PDF_ENABLE_XFA | 526 #endif // PDF_ENABLE_XFA |
OLD | NEW |