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 { |
11 FX_LPCSTR m_pName; | 11 FX_LPCSTR m_pName; |
12 FX_LPCSTR m_pSubstName; | 12 FX_LPCSTR m_pSubstName; |
13 } | 13 } |
14 Base14Substs[] = { | 14 Base14Substs[] = { |
15 {"Courier", "Courier New"}, | 15 {"Courier", "Courier New"}, |
16 {"Courier-Bold", "Courier New Bold"}, | 16 {"Courier-Bold", "Courier New Bold"}, |
17 {"Courier-BoldOblique", "Courier New Bold Italic"}, | 17 {"Courier-BoldOblique", "Courier New Bold Italic"}, |
18 {"Courier-Oblique", "Courier New Italic"}, | 18 {"Courier-Oblique", "Courier New Italic"}, |
19 {"Helvetica", "Arial"}, | 19 {"Helvetica", "Arial"}, |
20 {"Helvetica-Bold", "Arial Bold"}, | 20 {"Helvetica-Bold", "Arial Bold"}, |
21 {"Helvetica-BoldOblique", "Arial Bold Italic"}, | 21 {"Helvetica-BoldOblique", "Arial Bold Italic"}, |
22 {"Helvetica-Oblique", "Arial Italic"}, | 22 {"Helvetica-Oblique", "Arial Italic"}, |
23 {"Times-Roman", "Times New Roman"}, | 23 {"Times-Roman", "Times New Roman"}, |
24 {"Times-Bold", "Times New Roman Bold"}, | 24 {"Times-Bold", "Times New Roman Bold"}, |
25 {"Times-BoldItalic", "Times New Roman Bold Italic"}, | 25 {"Times-BoldItalic", "Times New Roman Bold Italic"}, |
26 {"Times-Italic", "Times New Roman Italic"}, | 26 {"Times-Italic", "Times New Roman Italic"}, |
27 }; | 27 }; |
28 #if !defined(_FPDFAPI_MINI_) | |
29 class CFX_MacFontInfo : public CFX_FolderFontInfo | 28 class CFX_MacFontInfo : public CFX_FolderFontInfo |
30 { | 29 { |
31 public: | 30 public: |
32 virtual void* MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, FX_LPCSTR family, FX_BOOL& bExact); | 31 virtual void* MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, FX_LPCSTR family, FX_BOOL& bExact); |
33 }; | 32 }; |
34 #define JAPAN_GOTHIC "Hiragino Kaku Gothic Pro W6" | 33 #define JAPAN_GOTHIC "Hiragino Kaku Gothic Pro W6" |
35 #define JAPAN_MINCHO "Hiragino Mincho Pro W6" | 34 #define JAPAN_MINCHO "Hiragino Mincho Pro W6" |
36 static void GetJapanesePreference(CFX_ByteString& face, int weight, int picth_fa
mily) | 35 static void GetJapanesePreference(CFX_ByteString& face, int weight, int picth_fa
mily) |
37 { | 36 { |
38 if (face.Find("Gothic") >= 0) { | 37 if (face.Find("Gothic") >= 0) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 face = "AppleMyungjo"; | 78 face = "AppleMyungjo"; |
80 break; | 79 break; |
81 case FXFONT_CHINESEBIG5_CHARSET: | 80 case FXFONT_CHINESEBIG5_CHARSET: |
82 face = "LiSong Pro Light"; | 81 face = "LiSong Pro Light"; |
83 } | 82 } |
84 if (m_FontList.Lookup(face, p)) { | 83 if (m_FontList.Lookup(face, p)) { |
85 return p; | 84 return p; |
86 } | 85 } |
87 return NULL; | 86 return NULL; |
88 } | 87 } |
89 #endif | |
90 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() | 88 IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() |
91 { | 89 { |
92 #if !defined(_FPDFAPI_MINI_) | |
93 CFX_MacFontInfo* pInfo = FX_NEW CFX_MacFontInfo; | 90 CFX_MacFontInfo* pInfo = FX_NEW CFX_MacFontInfo; |
94 if (!pInfo) { | 91 if (!pInfo) { |
95 return NULL; | 92 return NULL; |
96 } | 93 } |
97 pInfo->AddPath("~/Library/Fonts"); | 94 pInfo->AddPath("~/Library/Fonts"); |
98 pInfo->AddPath("/Library/Fonts"); | 95 pInfo->AddPath("/Library/Fonts"); |
99 pInfo->AddPath("/System/Library/Fonts"); | 96 pInfo->AddPath("/System/Library/Fonts"); |
100 return pInfo; | 97 return pInfo; |
101 #else | |
102 return NULL; | |
103 #endif | |
104 } | 98 } |
105 void CFX_GEModule::InitPlatform() | 99 void CFX_GEModule::InitPlatform() |
106 { | 100 { |
107 m_pPlatformData = FX_NEW CApplePlatform; | 101 m_pPlatformData = FX_NEW CApplePlatform; |
108 m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault()); | 102 m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault()); |
109 } | 103 } |
110 void CFX_GEModule::DestroyPlatform() | 104 void CFX_GEModule::DestroyPlatform() |
111 { | 105 { |
112 if (m_pPlatformData) { | 106 if (m_pPlatformData) { |
113 delete (CApplePlatform *) m_pPlatformData; | 107 delete (CApplePlatform *) m_pPlatformData; |
114 } | 108 } |
115 m_pPlatformData = NULL; | 109 m_pPlatformData = NULL; |
116 } | 110 } |
117 #endif | 111 #endif |
OLD | NEW |