| 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 "apple_int.h" | 8 #include "apple_int.h" |
| 9 #if _FX_OS_ == _FX_MACOSX_ | 9 #if _FX_OS_ == _FX_MACOSX_ |
| 10 static const struct { | 10 static const struct { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 int iBaseFont; | 58 int iBaseFont; |
| 59 for (iBaseFont = 0; iBaseFont < 12; iBaseFont++) | 59 for (iBaseFont = 0; iBaseFont < 12; iBaseFont++) |
| 60 if (face == CFX_ByteStringC(Base14Substs[iBaseFont].m_pName)) { | 60 if (face == CFX_ByteStringC(Base14Substs[iBaseFont].m_pName)) { |
| 61 face = Base14Substs[iBaseFont].m_pSubstName; | 61 face = Base14Substs[iBaseFont].m_pSubstName; |
| 62 iExact = TRUE; | 62 iExact = TRUE; |
| 63 break; | 63 break; |
| 64 } | 64 } |
| 65 if (iBaseFont < 12) { | 65 if (iBaseFont < 12) { |
| 66 return GetFont(face); | 66 return GetFont(face); |
| 67 } | 67 } |
| 68 void* p; | 68 auto it = m_FontList.find(face); |
| 69 if (m_FontList.Lookup(face, p)) { | 69 if (it != m_FontList.end) |
| 70 return p; | 70 return it->second; |
| 71 } | 71 |
| 72 if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH)) { | 72 if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH)) { |
| 73 return GetFont("Courier New"); | 73 return GetFont("Courier New"); |
| 74 } | 74 } |
| 75 if (charset == FXFONT_ANSI_CHARSET || charset == FXFONT_SYMBOL_CHARSET) { | 75 if (charset == FXFONT_ANSI_CHARSET || charset == FXFONT_SYMBOL_CHARSET) { |
| 76 return NULL; | 76 return NULL; |
| 77 } | 77 } |
| 78 switch (charset) { | 78 switch (charset) { |
| 79 case FXFONT_SHIFTJIS_CHARSET: | 79 case FXFONT_SHIFTJIS_CHARSET: |
| 80 GetJapanesePreference(face, weight, pitch_family); | 80 GetJapanesePreference(face, weight, pitch_family); |
| 81 break; | 81 break; |
| 82 case FXFONT_GB2312_CHARSET: | 82 case FXFONT_GB2312_CHARSET: |
| 83 face = "STSong"; | 83 face = "STSong"; |
| 84 break; | 84 break; |
| 85 case FXFONT_HANGEUL_CHARSET: | 85 case FXFONT_HANGEUL_CHARSET: |
| 86 face = "AppleMyungjo"; | 86 face = "AppleMyungjo"; |
| 87 break; | 87 break; |
| 88 case FXFONT_CHINESEBIG5_CHARSET: | 88 case FXFONT_CHINESEBIG5_CHARSET: |
| 89 face = "LiSong Pro Light"; | 89 face = "LiSong Pro Light"; |
| 90 } | 90 } |
| 91 if (m_FontList.Lookup(face, p)) { | 91 it = m_FontList.Lookup(face); |
| 92 return p; | 92 if (it != m_FontList.end) |
| 93 } | 93 return it->second; |
| 94 |
| 94 return NULL; | 95 return NULL; |
| 95 } | 96 } |
| 96 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) { | 97 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) { |
| 97 CFX_MacFontInfo* pInfo = new CFX_MacFontInfo; | 98 CFX_MacFontInfo* pInfo = new CFX_MacFontInfo; |
| 98 pInfo->AddPath("~/Library/Fonts"); | 99 pInfo->AddPath("~/Library/Fonts"); |
| 99 pInfo->AddPath("/Library/Fonts"); | 100 pInfo->AddPath("/Library/Fonts"); |
| 100 pInfo->AddPath("/System/Library/Fonts"); | 101 pInfo->AddPath("/System/Library/Fonts"); |
| 101 return pInfo; | 102 return pInfo; |
| 102 } | 103 } |
| 103 void CFX_GEModule::InitPlatform() { | 104 void CFX_GEModule::InitPlatform() { |
| 104 m_pPlatformData = new CApplePlatform; | 105 m_pPlatformData = new CApplePlatform; |
| 105 m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault(nullptr)); | 106 m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault(nullptr)); |
| 106 } | 107 } |
| 107 void CFX_GEModule::DestroyPlatform() { | 108 void CFX_GEModule::DestroyPlatform() { |
| 108 delete (CApplePlatform*)m_pPlatformData; | 109 delete (CApplePlatform*)m_pPlatformData; |
| 109 m_pPlatformData = NULL; | 110 m_pPlatformData = NULL; |
| 110 } | 111 } |
| 111 #endif | 112 #endif |
| OLD | NEW |