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 10 matching lines...) Expand all Loading... |
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 class CFX_MacFontInfo : public CFX_FolderFontInfo | 28 class CFX_MacFontInfo : public CFX_FolderFontInfo |
29 { | 29 { |
30 public: | 30 public: |
31 virtual void*» » MapFont(int weight, FX_BOOL bItalic, int charset
, int pitch_family, const FX_CHAR* family, FX_BOOL& bExact); | 31 virtual void*» » MapFont(int weight, bool bItalic, int charset, i
nt pitch_family, const FX_CHAR* family, bool& bExact); |
32 }; | 32 }; |
33 #define JAPAN_GOTHIC "Hiragino Kaku Gothic Pro W6" | 33 #define JAPAN_GOTHIC "Hiragino Kaku Gothic Pro W6" |
34 #define JAPAN_MINCHO "Hiragino Mincho Pro W6" | 34 #define JAPAN_MINCHO "Hiragino Mincho Pro W6" |
35 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) |
36 { | 36 { |
37 if (face.Find("Gothic") >= 0) { | 37 if (face.Find("Gothic") >= 0) { |
38 face = JAPAN_GOTHIC; | 38 face = JAPAN_GOTHIC; |
39 return; | 39 return; |
40 } | 40 } |
41 if (!(picth_family & FXFONT_FF_ROMAN) && weight > 400) { | 41 if (!(picth_family & FXFONT_FF_ROMAN) && weight > 400) { |
42 face = JAPAN_GOTHIC; | 42 face = JAPAN_GOTHIC; |
43 } else { | 43 } else { |
44 face = JAPAN_MINCHO; | 44 face = JAPAN_MINCHO; |
45 } | 45 } |
46 } | 46 } |
47 void* CFX_MacFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pit
ch_family, const FX_CHAR* cstr_face, FX_BOOL& bExact) | 47 void* CFX_MacFontInfo::MapFont(int weight, bool bItalic, int charset, int pitch_
family, const FX_CHAR* cstr_face, bool& bExact) |
48 { | 48 { |
49 CFX_ByteString face = cstr_face; | 49 CFX_ByteString face = cstr_face; |
50 int iBaseFont; | 50 int iBaseFont; |
51 for (iBaseFont = 0; iBaseFont < 12; iBaseFont ++) | 51 for (iBaseFont = 0; iBaseFont < 12; iBaseFont ++) |
52 if (face == CFX_ByteStringC(Base14Substs[iBaseFont].m_pName)) { | 52 if (face == CFX_ByteStringC(Base14Substs[iBaseFont].m_pName)) { |
53 face = Base14Substs[iBaseFont].m_pSubstName; | 53 face = Base14Substs[iBaseFont].m_pSubstName; |
54 bExact = TRUE; | 54 bExact = true; |
55 break; | 55 break; |
56 } | 56 } |
57 if (iBaseFont < 12) { | 57 if (iBaseFont < 12) { |
58 return GetFont(face); | 58 return GetFont(face); |
59 } | 59 } |
60 void* p; | 60 void* p; |
61 if (m_FontList.Lookup(face, p)) { | 61 if (m_FontList.Lookup(face, p)) { |
62 return p; | 62 return p; |
63 } | 63 } |
64 if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH))
{ | 64 if (charset == FXFONT_ANSI_CHARSET && (pitch_family & FXFONT_FF_FIXEDPITCH))
{ |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 { | 97 { |
98 m_pPlatformData = new CApplePlatform; | 98 m_pPlatformData = new CApplePlatform; |
99 m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault()); | 99 m_pFontMgr->SetSystemFontInfo(IFX_SystemFontInfo::CreateDefault()); |
100 } | 100 } |
101 void CFX_GEModule::DestroyPlatform() | 101 void CFX_GEModule::DestroyPlatform() |
102 { | 102 { |
103 delete (CApplePlatform *)m_pPlatformData; | 103 delete (CApplePlatform *)m_pPlatformData; |
104 m_pPlatformData = NULL; | 104 m_pPlatformData = NULL; |
105 } | 105 } |
106 #endif | 106 #endif |
OLD | NEW |