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/fx_font.h" | 7 #include "core/fxge/fx_font.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <limits> | 10 #include <limits> |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 m_bShallowCopy = true; | 259 m_bShallowCopy = true; |
260 if (pFont->m_pSubstFont) { | 260 if (pFont->m_pSubstFont) { |
261 m_pSubstFont = pdfium::MakeUnique<CFX_SubstFont>(); | 261 m_pSubstFont = pdfium::MakeUnique<CFX_SubstFont>(); |
262 m_pSubstFont->m_Charset = pFont->m_pSubstFont->m_Charset; | 262 m_pSubstFont->m_Charset = pFont->m_pSubstFont->m_Charset; |
263 m_pSubstFont->m_SubstFlags = pFont->m_pSubstFont->m_SubstFlags; | 263 m_pSubstFont->m_SubstFlags = pFont->m_pSubstFont->m_SubstFlags; |
264 m_pSubstFont->m_Weight = pFont->m_pSubstFont->m_Weight; | 264 m_pSubstFont->m_Weight = pFont->m_pSubstFont->m_Weight; |
265 m_pSubstFont->m_Family = pFont->m_pSubstFont->m_Family; | 265 m_pSubstFont->m_Family = pFont->m_pSubstFont->m_Family; |
266 m_pSubstFont->m_ItalicAngle = pFont->m_pSubstFont->m_ItalicAngle; | 266 m_pSubstFont->m_ItalicAngle = pFont->m_pSubstFont->m_ItalicAngle; |
267 } | 267 } |
268 if (pFont->m_OtfFontData.GetSize()) { | |
269 m_OtfFontData.AttachData(pFont->m_OtfFontData.GetBuffer(), | |
270 pFont->m_OtfFontData.GetSize()); | |
271 } | |
272 m_Face = pFont->m_Face; | 268 m_Face = pFont->m_Face; |
273 m_bEmbedded = pFont->m_bEmbedded; | 269 m_bEmbedded = pFont->m_bEmbedded; |
274 m_bVertical = pFont->m_bVertical; | 270 m_bVertical = pFont->m_bVertical; |
275 m_dwSize = pFont->m_dwSize; | 271 m_dwSize = pFont->m_dwSize; |
276 m_pFontData = pFont->m_pFontData; | 272 m_pFontData = pFont->m_pFontData; |
277 m_pGsubData = pFont->m_pGsubData; | 273 m_pGsubData = pFont->m_pGsubData; |
278 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 274 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
279 m_pPlatformFont = pFont->m_pPlatformFont; | 275 m_pPlatformFont = pFont->m_pPlatformFont; |
280 #endif | 276 #endif |
281 m_pOwnedStream = pFont->m_pOwnedStream; | 277 m_pOwnedStream = pFont->m_pOwnedStream; |
282 m_FaceCache = pFont->GetFaceCache(); | 278 m_FaceCache = pFont->GetFaceCache(); |
283 return true; | 279 return true; |
284 } | 280 } |
285 | 281 |
286 void CFX_Font::SetFace(FXFT_Face face) { | 282 void CFX_Font::SetFace(FXFT_Face face) { |
287 ClearFaceCache(); | 283 ClearFaceCache(); |
288 m_Face = face; | 284 m_Face = face; |
289 } | 285 } |
290 | 286 |
291 #endif // PDF_ENABLE_XFA | 287 #endif // PDF_ENABLE_XFA |
292 | 288 |
293 CFX_Font::~CFX_Font() { | 289 CFX_Font::~CFX_Font() { |
294 #ifdef PDF_ENABLE_XFA | 290 #ifdef PDF_ENABLE_XFA |
295 if (m_bShallowCopy) { | 291 if (m_bShallowCopy) |
296 m_OtfFontData.DetachBuffer(); | |
297 return; | 292 return; |
298 } | |
299 #endif // PDF_ENABLE_XFA | 293 #endif // PDF_ENABLE_XFA |
300 if (m_Face) { | 294 if (m_Face) { |
301 #ifndef PDF_ENABLE_XFA | 295 #ifndef PDF_ENABLE_XFA |
302 if (FXFT_Get_Face_External_Stream(m_Face)) { | 296 if (FXFT_Get_Face_External_Stream(m_Face)) { |
303 FXFT_Clear_Face_External_Stream(m_Face); | 297 FXFT_Clear_Face_External_Stream(m_Face); |
304 } | 298 } |
305 #endif // PDF_ENABLE_XFA | 299 #endif // PDF_ENABLE_XFA |
306 DeleteFace(); | 300 DeleteFace(); |
307 } | 301 } |
308 #ifdef PDF_ENABLE_XFA | 302 #ifdef PDF_ENABLE_XFA |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 const CFX_PathData* CFX_Font::LoadGlyphPath(uint32_t glyph_index, | 713 const CFX_PathData* CFX_Font::LoadGlyphPath(uint32_t glyph_index, |
720 int dest_width) const { | 714 int dest_width) const { |
721 return GetFaceCache()->LoadGlyphPath(this, glyph_index, dest_width); | 715 return GetFaceCache()->LoadGlyphPath(this, glyph_index, dest_width); |
722 } | 716 } |
723 | 717 |
724 #if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_ | 718 #if defined _SKIA_SUPPORT_ || _SKIA_SUPPORT_PATHS_ |
725 CFX_TypeFace* CFX_Font::GetDeviceCache() const { | 719 CFX_TypeFace* CFX_Font::GetDeviceCache() const { |
726 return GetFaceCache()->GetDeviceCache(this); | 720 return GetFaceCache()->GetDeviceCache(this); |
727 } | 721 } |
728 #endif | 722 #endif |
OLD | NEW |