| 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 30 matching lines...) Expand all Loading... |
| 41 FX_Free(m_pGsubData); | 41 FX_Free(m_pGsubData); |
| 42 m_pGsubData = NULL; | 42 m_pGsubData = NULL; |
| 43 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 43 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
| 44 ReleasePlatformResource(); | 44 ReleasePlatformResource(); |
| 45 #endif | 45 #endif |
| 46 } | 46 } |
| 47 void CFX_Font::DeleteFace() { | 47 void CFX_Font::DeleteFace() { |
| 48 FXFT_Done_Face(m_Face); | 48 FXFT_Done_Face(m_Face); |
| 49 m_Face = NULL; | 49 m_Face = NULL; |
| 50 } | 50 } |
| 51 FX_BOOL CFX_Font::LoadSubst(const CFX_ByteString& face_name, | 51 void CFX_Font::LoadSubst(const CFX_ByteString& face_name, |
| 52 FX_BOOL bTrueType, | 52 FX_BOOL bTrueType, |
| 53 FX_DWORD flags, | 53 FX_DWORD flags, |
| 54 int weight, | 54 int weight, |
| 55 int italic_angle, | 55 int italic_angle, |
| 56 int CharsetCP, | 56 int CharsetCP, |
| 57 FX_BOOL bVertical) { | 57 FX_BOOL bVertical) { |
| 58 m_bEmbedded = FALSE; | 58 m_bEmbedded = FALSE; |
| 59 m_bVertical = bVertical; | 59 m_bVertical = bVertical; |
| 60 m_pSubstFont = new CFX_SubstFont; | 60 m_pSubstFont = new CFX_SubstFont; |
| 61 m_Face = CFX_GEModule::Get()->GetFontMgr()->FindSubstFont( | 61 m_Face = CFX_GEModule::Get()->GetFontMgr()->FindSubstFont( |
| 62 face_name, bTrueType, flags, weight, italic_angle, CharsetCP, | 62 face_name, bTrueType, flags, weight, italic_angle, CharsetCP, |
| 63 m_pSubstFont); | 63 m_pSubstFont); |
| 64 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ | 64 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
| 65 if (m_pSubstFont->m_ExtHandle) { | 65 if (m_pSubstFont->m_ExtHandle) { |
| 66 m_pPlatformFont = m_pSubstFont->m_ExtHandle; | 66 m_pPlatformFont = m_pSubstFont->m_ExtHandle; |
| 67 m_pSubstFont->m_ExtHandle = NULL; | 67 m_pSubstFont->m_ExtHandle = NULL; |
| 68 } | 68 } |
| 69 #endif | 69 #endif |
| 70 if (m_Face) { | 70 if (m_Face) { |
| 71 m_pFontData = FXFT_Get_Face_Stream_Base(m_Face); | 71 m_pFontData = FXFT_Get_Face_Stream_Base(m_Face); |
| 72 m_dwSize = FXFT_Get_Face_Stream_Size(m_Face); | 72 m_dwSize = FXFT_Get_Face_Stream_Size(m_Face); |
| 73 } | 73 } |
| 74 return TRUE; | |
| 75 } | 74 } |
| 76 | 75 |
| 77 int CFX_Font::GetGlyphWidth(FX_DWORD glyph_index) { | 76 int CFX_Font::GetGlyphWidth(FX_DWORD glyph_index) { |
| 78 if (!m_Face) { | 77 if (!m_Face) { |
| 79 return 0; | 78 return 0; |
| 80 } | 79 } |
| 81 if (m_pSubstFont && (m_pSubstFont->m_SubstFlags & FXFONT_SUBST_MM)) { | 80 if (m_pSubstFont && (m_pSubstFont->m_SubstFlags & FXFONT_SUBST_MM)) { |
| 82 AdjustMMParams(glyph_index, 0, 0); | 81 AdjustMMParams(glyph_index, 0, 0); |
| 83 } | 82 } |
| 84 int err = FXFT_Load_Glyph( | 83 int err = FXFT_Load_Glyph( |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 336 |
| 338 if (m_pFont->GetSubstFont() && m_pFont->GetSubstFont()->m_Charset == 2) { | 337 if (m_pFont->GetSubstFont() && m_pFont->GetSubstFont()->m_Charset == 2) { |
| 339 FX_DWORD index = 0; | 338 FX_DWORD index = 0; |
| 340 if (FXFT_Select_Charmap(face, FXFT_ENCODING_MS_SYMBOL) == 0) | 339 if (FXFT_Select_Charmap(face, FXFT_ENCODING_MS_SYMBOL) == 0) |
| 341 index = FXFT_Get_Char_Index(face, charcode); | 340 index = FXFT_Get_Char_Index(face, charcode); |
| 342 if (!index && !FXFT_Select_Charmap(face, FXFT_ENCODING_APPLE_ROMAN)) | 341 if (!index && !FXFT_Select_Charmap(face, FXFT_ENCODING_APPLE_ROMAN)) |
| 343 return FXFT_Get_Char_Index(face, charcode); | 342 return FXFT_Get_Char_Index(face, charcode); |
| 344 } | 343 } |
| 345 return charcode; | 344 return charcode; |
| 346 } | 345 } |
| OLD | NEW |