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/ge/fx_text_int.h" | 10 #include "core/fxge/ge/fx_text_int.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 m_bVertical(false) { | 237 m_bVertical(false) { |
238 } | 238 } |
239 | 239 |
240 #ifdef PDF_ENABLE_XFA | 240 #ifdef PDF_ENABLE_XFA |
241 FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) { | 241 FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) { |
242 if (!pFont) | 242 if (!pFont) |
243 return FALSE; | 243 return FALSE; |
244 | 244 |
245 m_bShallowCopy = true; | 245 m_bShallowCopy = true; |
246 if (pFont->m_pSubstFont) { | 246 if (pFont->m_pSubstFont) { |
247 m_pSubstFont.reset(new CFX_SubstFont); | 247 m_pSubstFont = WrapUnique(new CFX_SubstFont); |
248 m_pSubstFont->m_Charset = pFont->m_pSubstFont->m_Charset; | 248 m_pSubstFont->m_Charset = pFont->m_pSubstFont->m_Charset; |
249 m_pSubstFont->m_SubstFlags = pFont->m_pSubstFont->m_SubstFlags; | 249 m_pSubstFont->m_SubstFlags = pFont->m_pSubstFont->m_SubstFlags; |
250 m_pSubstFont->m_Weight = pFont->m_pSubstFont->m_Weight; | 250 m_pSubstFont->m_Weight = pFont->m_pSubstFont->m_Weight; |
251 m_pSubstFont->m_Family = pFont->m_pSubstFont->m_Family; | 251 m_pSubstFont->m_Family = pFont->m_pSubstFont->m_Family; |
252 m_pSubstFont->m_ItalicAngle = pFont->m_pSubstFont->m_ItalicAngle; | 252 m_pSubstFont->m_ItalicAngle = pFont->m_pSubstFont->m_ItalicAngle; |
253 } | 253 } |
254 if (pFont->m_OtfFontData.GetSize()) { | 254 if (pFont->m_OtfFontData.GetSize()) { |
255 m_OtfFontData.AttachData(pFont->m_OtfFontData.GetBuffer(), | 255 m_OtfFontData.AttachData(pFont->m_OtfFontData.GetBuffer(), |
256 pFont->m_OtfFontData.GetSize()); | 256 pFont->m_OtfFontData.GetSize()); |
257 } | 257 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 312 |
313 void CFX_Font::LoadSubst(const CFX_ByteString& face_name, | 313 void CFX_Font::LoadSubst(const CFX_ByteString& face_name, |
314 FX_BOOL bTrueType, | 314 FX_BOOL bTrueType, |
315 uint32_t flags, | 315 uint32_t flags, |
316 int weight, | 316 int weight, |
317 int italic_angle, | 317 int italic_angle, |
318 int CharsetCP, | 318 int CharsetCP, |
319 bool bVertical) { | 319 bool bVertical) { |
320 m_bEmbedded = false; | 320 m_bEmbedded = false; |
321 m_bVertical = bVertical; | 321 m_bVertical = bVertical; |
322 m_pSubstFont.reset(new CFX_SubstFont); | 322 m_pSubstFont = WrapUnique(new CFX_SubstFont); |
323 m_Face = CFX_GEModule::Get()->GetFontMgr()->FindSubstFont( | 323 m_Face = CFX_GEModule::Get()->GetFontMgr()->FindSubstFont( |
324 face_name, bTrueType, flags, weight, italic_angle, CharsetCP, | 324 face_name, bTrueType, flags, weight, italic_angle, CharsetCP, |
325 m_pSubstFont.get()); | 325 m_pSubstFont.get()); |
326 if (m_Face) { | 326 if (m_Face) { |
327 m_pFontData = FXFT_Get_Face_Stream_Base(m_Face); | 327 m_pFontData = FXFT_Get_Face_Stream_Base(m_Face); |
328 m_dwSize = FXFT_Get_Face_Stream_Size(m_Face); | 328 m_dwSize = FXFT_Get_Face_Stream_Size(m_Face); |
329 } | 329 } |
330 } | 330 } |
331 | 331 |
332 #ifdef PDF_ENABLE_XFA | 332 #ifdef PDF_ENABLE_XFA |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 const CFX_PathData* CFX_Font::LoadGlyphPath(uint32_t glyph_index, | 705 const CFX_PathData* CFX_Font::LoadGlyphPath(uint32_t glyph_index, |
706 int dest_width) const { | 706 int dest_width) const { |
707 return GetFaceCache()->LoadGlyphPath(this, glyph_index, dest_width); | 707 return GetFaceCache()->LoadGlyphPath(this, glyph_index, dest_width); |
708 } | 708 } |
709 | 709 |
710 #ifdef _SKIA_SUPPORT_ | 710 #ifdef _SKIA_SUPPORT_ |
711 CFX_TypeFace* CFX_Font::GetDeviceCache() const { | 711 CFX_TypeFace* CFX_Font::GetDeviceCache() const { |
712 return GetFaceCache()->GetDeviceCache(this); | 712 return GetFaceCache()->GetDeviceCache(this); |
713 } | 713 } |
714 #endif | 714 #endif |
OLD | NEW |