| 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/apple/apple_int.h" | 7 #include "core/fxge/apple/apple_int.h" |
| 8 #include "core/fxge/include/fx_ge.h" | 8 #include "core/fxge/include/fx_ge.h" |
| 9 | 9 |
| 10 #if _FX_OS_ == _FX_MACOSX_ | 10 #if _FX_OS_ == _FX_MACOSX_ |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 return GetFont(face.c_str()); | 67 return GetFont(face.c_str()); |
| 68 } | 68 } |
| 69 auto it = m_FontList.find(face); | 69 auto it = m_FontList.find(face); |
| 70 if (it != m_FontList.end()) | 70 if (it != m_FontList.end()) |
| 71 return it->second; | 71 return it->second; |
| 72 | 72 |
| 73 if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH)) { | 73 if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH)) { |
| 74 return GetFont("Courier New"); | 74 return GetFont("Courier New"); |
| 75 } | 75 } |
| 76 if (charset == FXFONT_ANSI_CHARSET || charset == FXFONT_SYMBOL_CHARSET) { | 76 if (charset == FXFONT_ANSI_CHARSET || charset == FXFONT_SYMBOL_CHARSET) { |
| 77 return NULL; | 77 return nullptr; |
| 78 } | 78 } |
| 79 switch (charset) { | 79 switch (charset) { |
| 80 case FXFONT_SHIFTJIS_CHARSET: | 80 case FXFONT_SHIFTJIS_CHARSET: |
| 81 GetJapanesePreference(face, weight, pitch_family); | 81 GetJapanesePreference(face, weight, pitch_family); |
| 82 break; | 82 break; |
| 83 case FXFONT_GB2312_CHARSET: | 83 case FXFONT_GB2312_CHARSET: |
| 84 face = "STSong"; | 84 face = "STSong"; |
| 85 break; | 85 break; |
| 86 case FXFONT_HANGEUL_CHARSET: | 86 case FXFONT_HANGEUL_CHARSET: |
| 87 face = "AppleMyungjo"; | 87 face = "AppleMyungjo"; |
| 88 break; | 88 break; |
| 89 case FXFONT_CHINESEBIG5_CHARSET: | 89 case FXFONT_CHINESEBIG5_CHARSET: |
| 90 face = "LiSong Pro Light"; | 90 face = "LiSong Pro Light"; |
| 91 } | 91 } |
| 92 it = m_FontList.find(face); | 92 it = m_FontList.find(face); |
| 93 if (it != m_FontList.end()) | 93 if (it != m_FontList.end()) |
| 94 return it->second; | 94 return it->second; |
| 95 | 95 |
| 96 return NULL; | 96 return nullptr; |
| 97 } | 97 } |
| 98 | 98 |
| 99 std::unique_ptr<IFX_SystemFontInfo> IFX_SystemFontInfo::CreateDefault( | 99 std::unique_ptr<IFX_SystemFontInfo> IFX_SystemFontInfo::CreateDefault( |
| 100 const char** pUnused) { | 100 const char** pUnused) { |
| 101 CFX_MacFontInfo* pInfo(new CFX_MacFontInfo); | 101 CFX_MacFontInfo* pInfo(new CFX_MacFontInfo); |
| 102 pInfo->AddPath("~/Library/Fonts"); | 102 pInfo->AddPath("~/Library/Fonts"); |
| 103 pInfo->AddPath("/Library/Fonts"); | 103 pInfo->AddPath("/Library/Fonts"); |
| 104 pInfo->AddPath("/System/Library/Fonts"); | 104 pInfo->AddPath("/System/Library/Fonts"); |
| 105 return std::unique_ptr<CFX_MacFontInfo>(pInfo); | 105 return std::unique_ptr<CFX_MacFontInfo>(pInfo); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void CFX_GEModule::InitPlatform() { | 108 void CFX_GEModule::InitPlatform() { |
| 109 m_pPlatformData = new CApplePlatform; | 109 m_pPlatformData = new CApplePlatform; |
| 110 m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault(nullptr)); | 110 m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault(nullptr)); |
| 111 } | 111 } |
| 112 void CFX_GEModule::DestroyPlatform() { | 112 void CFX_GEModule::DestroyPlatform() { |
| 113 delete (CApplePlatform*)m_pPlatformData; | 113 delete (CApplePlatform*)m_pPlatformData; |
| 114 m_pPlatformData = NULL; | 114 m_pPlatformData = nullptr; |
| 115 } | 115 } |
| 116 #endif | 116 #endif |
| OLD | NEW |